*: pylint: Explicitly specify encoding when open a file

This is recommended by PEP-0597: https://peps.python.org/pep-0597/

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2022-07-04 19:45:57 -04:00
1 parent 05815bc992
commit 3c7bc4a192
49 files changed
+165 -138

No files matched your search

+4 -3
View File
@@ -141,7 +141,8 @@ def parse_arguments():
def _is_using_ecc():
"""Return whether the service is using ECC."""
if os.path.exists(SERVER_CONFIGURATION_PATH):
with open(SERVER_CONFIGURATION_PATH, 'r') as file_handle:
with open(SERVER_CONFIGURATION_PATH, 'r',
encoding='utf-8') as file_handle:
for line in file_handle:
if line.strip() == 'dh none':
return True
@@ -169,7 +170,7 @@ def subcommand_setup(_):
def _write_server_config():
"""Write server configuration."""
with open(SERVER_CONFIGURATION_PATH, 'w') as file_handle:
with open(SERVER_CONFIGURATION_PATH, 'w', encoding='utf-8') as file_handle:
file_handle.write(SERVER_CONFIGURATION)
@@ -280,7 +281,7 @@ def set_unique_subject(value):
def _read_file(filename):
"""Return the entire contents of a file as string."""
with open(filename, 'r') as file_handle:
with open(filename, 'r', encoding='utf-8') as file_handle:
return ''.join(file_handle.readlines())