Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,30 +25,43 @@ def tasks_json():
|
|
25 |
print("Before Pretty Printing JSON Data")
|
26 |
print(tasks)
|
27 |
def fix_json():
|
|
|
28 |
with open("tasks.json", "r") as fix_file:
|
29 |
for i, line in enumerate(fix_file.readlines()):
|
30 |
#print (line)
|
31 |
if "name:" in line:
|
32 |
out = line.replace("name:",'"name":')
|
|
|
33 |
print (out)
|
34 |
elif "modality:" in line:
|
35 |
out = line.replace("modality:",'"modality":')
|
|
|
36 |
print (out)
|
37 |
elif "type:" in line:
|
38 |
out = line.replace("type:",'"type":')
|
|
|
39 |
print (out)
|
40 |
elif "subtasks:" in line:
|
41 |
out = line.replace("subtasks:",'"subtasks":')
|
|
|
42 |
print (out)
|
43 |
elif "color:" in line:
|
44 |
out = line.replace("color:",'"color":')
|
|
|
45 |
print (out)
|
46 |
elif "hideInModels:" in line:
|
47 |
out = line.replace("hideInModels:",'"hideInModels":')
|
|
|
48 |
print (out)
|
49 |
elif "hideInDatasets:" in line:
|
50 |
out = line.replace("hideInDatasets:",'"hideInDatasets":')
|
|
|
51 |
print (out)
|
52 |
|
53 |
-
else:
|
|
|
|
|
|
|
|
|
|
|
54 |
fix_json()
|
|
|
25 |
print("Before Pretty Printing JSON Data")
|
26 |
print(tasks)
|
27 |
def fix_json():
|
28 |
+
new_json=[]
|
29 |
with open("tasks.json", "r") as fix_file:
|
30 |
for i, line in enumerate(fix_file.readlines()):
|
31 |
#print (line)
|
32 |
if "name:" in line:
|
33 |
out = line.replace("name:",'"name":')
|
34 |
+
new_json.append(out)
|
35 |
print (out)
|
36 |
elif "modality:" in line:
|
37 |
out = line.replace("modality:",'"modality":')
|
38 |
+
new_json.append(out)
|
39 |
print (out)
|
40 |
elif "type:" in line:
|
41 |
out = line.replace("type:",'"type":')
|
42 |
+
new_json.append(out)
|
43 |
print (out)
|
44 |
elif "subtasks:" in line:
|
45 |
out = line.replace("subtasks:",'"subtasks":')
|
46 |
+
new_json.append(out)
|
47 |
print (out)
|
48 |
elif "color:" in line:
|
49 |
out = line.replace("color:",'"color":')
|
50 |
+
new_json.append(out)
|
51 |
print (out)
|
52 |
elif "hideInModels:" in line:
|
53 |
out = line.replace("hideInModels:",'"hideInModels":')
|
54 |
+
new_json.append(out)
|
55 |
print (out)
|
56 |
elif "hideInDatasets:" in line:
|
57 |
out = line.replace("hideInDatasets:",'"hideInDatasets":')
|
58 |
+
new_json.append(out)
|
59 |
print (out)
|
60 |
|
61 |
+
else:
|
62 |
+
new_json.append(out)
|
63 |
+
print(line)
|
64 |
+
|
65 |
+
|
66 |
+
print (new_json)
|
67 |
fix_json()
|