-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrem.py
69 lines (50 loc) · 1.36 KB
/
rem.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"""Remember the src and destinaton."""
loc = []
tmp_dir = []
total_size = []
chunk_size = []
t_size = []
def rem(state, src=' ', des=' '):
"""If state is register than add src and dest to loc."""
if state == 'register':
loc.append(src)
loc.append(des)
return True
if state == 'unregister':
temp_src = loc[0]
temp_des = loc[1]
loc.remove(temp_src)
loc.remove(temp_des)
return True
if state == 'grab':
return(loc[0], loc[1])
def rem_dir(state, dir=''):
"""Remeber the tmp_dir."""
if state == 'register':
tmp_dir.append(dir)
return True
if state == 'unregister':
tmp_dir.remove(tmp_dir[0])
return True
if state == 'grab':
return tmp_dir[0]
def rem_size(state, size=''):
"""Remember the size of file for progress."""
if state == 'register':
total_size.append(size)
return True
if state == 'unregister':
total_size.remove(size[0])
return False
if state == 'grab':
return total_size[0]
def rem_read_size(state, chunk=0):
"""Remember the read size."""
if state == 'register':
chunk_size.append(chunk)
return True
if state == 'unregister':
chunk_size.remove(chunk_size[0])
return True
if state == 'grab':
return chunk_size[0]