mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-26 21:24:10 +01:00
Fixed platform specific behaviour in format.py
Previously this would've used CRLF on Windows and LF on Linux, now it's using CRLF on all platforms, as it's the current format
This commit is contained in:
parent
fa8c58164f
commit
ebcd5ff847
1 changed files with 5 additions and 5 deletions
|
@ -263,11 +263,11 @@ def per_line_entries(entries: list):
|
|||
"""
|
||||
Returns a string of all the entries, with every entry in one line.
|
||||
"""
|
||||
out = "[\n"
|
||||
out = "[\r\n"
|
||||
for entry in entries:
|
||||
if entry:
|
||||
out += json.dumps(entry, ensure_ascii=False) + ",\n"
|
||||
out = out[:-2] + "\n]"
|
||||
out += json.dumps(entry, ensure_ascii=False) + ",\r\n"
|
||||
out = out[:-2] + "\r\n]"
|
||||
return out
|
||||
|
||||
def format_all(entry: dict, silent=False):
|
||||
|
@ -326,8 +326,8 @@ def go(path):
|
|||
|
||||
print(f"{len(entries)} checked.")
|
||||
|
||||
with open(path, "w", encoding='UTF-8') as f2:
|
||||
f2.write(per_line_entries(entries))
|
||||
with open(path, "wb") as f2:
|
||||
f2.write(per_line_entries(entries).encode(encoding='utf-8'))
|
||||
|
||||
print("Writing completed. All done.")
|
||||
|
||||
|
|
Loading…
Reference in a new issue