3
0
Fork 0

fix: fix 'unspecified-encoding' for pylint

This commit is contained in:
Lance Edgar 2025-08-30 15:52:14 -05:00
parent ac65ec891b
commit 80bb905891
4 changed files with 6 additions and 5 deletions

View file

@ -2,4 +2,5 @@
[MESSAGES CONTROL] [MESSAGES CONTROL]
disable=all disable=all
enable=dangerous-default-value enable=dangerous-default-value,
unspecified-encoding

View file

@ -464,7 +464,7 @@ class AppHandler:
""" """
output = template.render(**context) output = template.render(**context)
if output_path: if output_path:
with open(output_path, 'wt') as f: with open(output_path, 'wt', encoding='utf_8') as f:
f.write(output) f.write(output)
return output return output

View file

@ -274,7 +274,7 @@ class WuttaConfig:
# re-write as temp file with "final" values # re-write as temp file with "final" values
fd, temp_path = tempfile.mkstemp(suffix='.ini') fd, temp_path = tempfile.mkstemp(suffix='.ini')
os.close(fd) os.close(fd)
with open(temp_path, 'wt') as f: with open(temp_path, 'wt', encoding='utf_8') as f:
temp_config.write(f) temp_config.write(f)
# and finally, load that into our main config # and finally, load that into our main config
@ -611,7 +611,7 @@ class WuttaConfig:
# write INI file and return path # write INI file and return path
fd, path = tempfile.mkstemp(suffix='.conf') fd, path = tempfile.mkstemp(suffix='.conf')
os.close(fd) os.close(fd)
with open(path, 'wt') as f: with open(path, 'wt', encoding='utf_8') as f:
parser.write(f) parser.write(f)
return path return path

View file

@ -95,7 +95,7 @@ class FileTestCase(TestCase):
myconf = self.write_file('my.conf', '<file contents>') myconf = self.write_file('my.conf', '<file contents>')
""" """
path = os.path.join(self.tempdir, filename) path = os.path.join(self.tempdir, filename)
with open(path, 'wt') as f: with open(path, 'wt', encoding='utf_8') as f:
f.write(content) f.write(content)
return path return path