-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_pkl.py
82 lines (57 loc) · 1.69 KB
/
convert_pkl.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
70
71
72
73
74
75
76
77
78
79
80
81
82
from main import load_data, save_data, Queue
from console import print_line_in_box
print_line_in_box(
"Converting data file from using old urgency lists to the new ones...")
print_line_in_box("Loading old data...")
data = load_data()
try:
today_schedule_old = data['today_schedule']
urgent = data['urgent']
normal = data['normal']
less_urgent = data['less_urgent']
print_line_in_box("Loaded old data...")
except KeyError:
print_line_in_box("Please make sure you have the right file")
exit()
print_line_in_box("Creating new data object...")
list4 = Queue("4")
list3 = Queue("3", pop_limit=6, lesser_urgent=list4)
list2 = Queue("2", pop_limit=2, lesser_urgent=list3)
list1 = Queue("1", pop_limit=3, lesser_urgent=list2)
new_data = {
'today_schedule': Queue('today_schedule'),
'1': list1,
'2': list2,
'3': list3,
'4': list4,
'latest': None
}
today_schedule_new = new_data['today_schedule']
print_line_in_box("Created new data object...")
print_line_in_box(
"Transferring data from old data object to new data object...")
for i in today_schedule_old:
today_schedule_new.push(i, append=True)
print("old today schedule: ")
print(today_schedule_old)
print("new today schedule: ")
print(today_schedule_new)
for i in urgent:
list1.push(i, append=True)
print(urgent)
print(list1)
for i in normal:
list2.push(i, append=True)
print(normal)
print(list2)
for i in less_urgent:
list3.push(i, append=True)
print(less_urgent)
print(list3)
print("list4")
print(list4)
print_line_in_box("Transferring done...")
print_line_in_box("Saving new data...")
save_data(new_data)
print_line_in_box("Saving done...")
print_line_in_box("Converting completed")