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
@@ -95,7 +95,7 @@ def _backup_handler(packet, encryption_passphrase=None):
|
||||
'backup': component.manifest
|
||||
} for component in packet.components]
|
||||
}
|
||||
with open(manifest_path, 'w') as manifest_file:
|
||||
with open(manifest_path, 'w', encoding='utf-8') as manifest_file:
|
||||
json.dump(manifests, manifest_file)
|
||||
|
||||
paths = packet.directories + packet.files
|
||||
|
||||
@@ -110,7 +110,8 @@ def test_add_repository_when_directory_exists_and_not_empty(
|
||||
temp_user, temp_home, password):
|
||||
remote_path = os.path.join(temp_home, 'non_empty_dir')
|
||||
os.makedirs(remote_path)
|
||||
open(os.path.join(remote_path, 'somefile.txt'), 'w').close()
|
||||
open(os.path.join(remote_path, 'somefile.txt'), 'w',
|
||||
encoding='utf-8').close()
|
||||
data = {
|
||||
'repository': f'{temp_user}@localhost:{remote_path}',
|
||||
'ssh_password': password,
|
||||
|
||||
@@ -381,7 +381,7 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView):
|
||||
known_hosts_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
known_hosts_path.touch()
|
||||
|
||||
with known_hosts_path.open('a') as known_hosts_file:
|
||||
with known_hosts_path.open('a', encoding='utf-8') as known_hosts_file:
|
||||
known_hosts_file.write(ssh_public_key + '\n')
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
|
||||
Reference in new issue
Block a user