tm20 utf-8 [ready for rene]

This commit is contained in:
gauthiier 2019-12-09 14:22:26 +01:00
parent 1fa1146df5
commit 21f709c707

View File

@ -5,7 +5,7 @@ EXP = "selection/"
sel = os.path.join(EXP, "tm-selection.js")
sel_dump = os.path.join(EXP, "tm-selection-dump.js")
with open(sel) as f:
with open(sel, encoding='utf-8') as f:
d = json.load(f)
def lists():
@ -28,7 +28,7 @@ def find(li, url):
dir_files = [f for f in glob.glob(os.path.join(d, "*.json"))]
for f in dir_files:
with open(f) as fp:
with open(f, encoding='utf-8') as fp:
dj = json.load(fp)
for t in dj['threads']:
if t['url'] == url: # one level..... not recursive
@ -67,7 +67,7 @@ def commit_dump(li, url, tag):
m = find(li, url) # <--- time
if m is not None:
with open(sel_dump) as f:
with open(sel_dump, encoding='utf-8') as f:
dump = json.load(f)
if tag not in list(dump.keys()):
@ -87,7 +87,7 @@ def commit_dump(li, url, tag):
def commit_from_selection():
dump = {}
with open(sel) as f:
with open(sel, encoding='utf-8') as f:
d = json.load(f)
for k, v in d.items():
@ -132,7 +132,7 @@ def recursive_format(msg):
def format_selection():
with open(sel_dump) as f:
with open(sel_dump, encoding='utf-8') as f:
d = json.load(f)
for k, v in d.items():
@ -148,7 +148,7 @@ def recursive_hashmap(msg, tag, hm):
recursive_hashmap(i, tag, hm)
def hashmap():
with open(sel_dump) as f:
with open(sel_dump, encoding='utf-8') as f:
d = json.load(f)
hm = {}
for k, v in d.items():