1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-06 16:07:22 +01:00

Fixed PLW1514 (unspecified-encoding): open in text mode without explicit encoding argument

This commit is contained in:
Teal Dulcet
2023-12-23 05:07:25 -08:00
committed by Joshua Tauberer
parent a02b59d4e4
commit 0e9193651d
12 changed files with 44 additions and 44 deletions

View File

@@ -76,7 +76,7 @@ for setting in settings:
found = set()
buf = ""
with open(filename) as f:
with open(filename, encoding="utf-8") as f:
input_lines = list(f)
while len(input_lines) > 0:
@@ -144,7 +144,7 @@ for i in range(len(settings)):
if not testing:
# Write out the new file.
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(buf)
else:
# Just print the new file to stdout.

View File

@@ -38,7 +38,7 @@ for date, ip in accesses:
# Since logs are rotated, store the statistics permanently in a JSON file.
# Load in the stats from an existing file.
if os.path.exists(outfn):
with open(outfn) as f:
with open(outfn, encoding="utf-8") as f:
existing_data = json.load(f)
for date, count in existing_data:
if date not in by_date:
@@ -51,5 +51,5 @@ by_date = sorted(by_date.items())
by_date.pop(-1)
# Write out.
with open(outfn, "w") as f:
with open(outfn, "w", encoding="utf-8") as f:
json.dump(by_date, f, sort_keys=True, indent=True)