mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-28 05:34:28 +01:00
More beautiful way of fixing this
This commit is contained in:
parent
ebcd5ff847
commit
c91df97e25
1 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
import io
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Examples:
|
Examples:
|
||||||
|
@ -263,11 +264,11 @@ def per_line_entries(entries: list):
|
||||||
"""
|
"""
|
||||||
Returns a string of all the entries, with every entry in one line.
|
Returns a string of all the entries, with every entry in one line.
|
||||||
"""
|
"""
|
||||||
out = "[\r\n"
|
out = "[\n"
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
if entry:
|
if entry:
|
||||||
out += json.dumps(entry, ensure_ascii=False) + ",\r\n"
|
out += json.dumps(entry, ensure_ascii=False) + ",\n"
|
||||||
out = out[:-2] + "\r\n]"
|
out = out[:-2] + "\n]"
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def format_all(entry: dict, silent=False):
|
def format_all(entry: dict, silent=False):
|
||||||
|
@ -326,8 +327,8 @@ def go(path):
|
||||||
|
|
||||||
print(f"{len(entries)} checked.")
|
print(f"{len(entries)} checked.")
|
||||||
|
|
||||||
with open(path, "wb") as f2:
|
with io.open(path, "w", encoding='utf-8', newline='\r\n') as f2:
|
||||||
f2.write(per_line_entries(entries).encode(encoding='utf-8'))
|
f2.write(per_line_entries(entries))
|
||||||
|
|
||||||
print("Writing completed. All done.")
|
print("Writing completed. All done.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue