mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: 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:
1 parent
05815bc992
commit
3c7bc4a192
49 files changed
+165
-138
No files matched your search
+2
-2
@@ -107,7 +107,7 @@ def subcommand_get_keys(arguments):
|
||||
|
||||
path = os.path.join(get_user_homedir(user), '.ssh', 'authorized_keys')
|
||||
try:
|
||||
with open(path, 'r') as file_handle:
|
||||
with open(path, 'r', encoding='utf-8') as file_handle:
|
||||
print(file_handle.read())
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
@@ -130,7 +130,7 @@ def subcommand_set_keys(arguments):
|
||||
os.makedirs(ssh_folder)
|
||||
shutil.chown(ssh_folder, user, 'users')
|
||||
|
||||
with open(key_file_path, 'w') as file_handle:
|
||||
with open(key_file_path, 'w', encoding='utf-8') as file_handle:
|
||||
file_handle.write(arguments.keys)
|
||||
|
||||
shutil.chown(key_file_path, user, 'users')
|
||||
|
||||
Reference in new issue
Block a user