From db9743fdd63341c21df94e86f78151351b8206c4 Mon Sep 17 00:00:00 2001 From: Martin Vrachev Date: Mon, 23 Aug 2021 16:45:04 +0300 Subject: [PATCH] Address Pylint new unspecified-encoding warning A new warning appeared from pylint when calling "tox -e lint" on the "develop" branch with id "unspecified-encoding", I read about the warning and it make sense. Read more about the warning here: https://github.com/PyCQA/pylint/issues/3826 Signed-off-by: Martin Vrachev --- tuf/developer_tool.py | 2 +- tuf/unittest_toolbox.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tuf/developer_tool.py b/tuf/developer_tool.py index 3e578b54fc..82d936c072 100755 --- a/tuf/developer_tool.py +++ b/tuf/developer_tool.py @@ -749,7 +749,7 @@ def _save_project_configuration(metadata_directory, targets_directory, project_config['public_keys'][key] = key_metadata # Save the actual file. - with open(project_filename, 'wt') as fp: + with open(project_filename, 'wt', encoding='utf8') as fp: json.dump(project_config, fp) diff --git a/tuf/unittest_toolbox.py b/tuf/unittest_toolbox.py index a248380d2c..063bec8df6 100755 --- a/tuf/unittest_toolbox.py +++ b/tuf/unittest_toolbox.py @@ -116,7 +116,7 @@ def _destroy_temp_file(): def make_temp_data_file(self, suffix='', directory=None, data = 'junk data'): """Returns an absolute path of a temp file containing data.""" temp_file_path = self.make_temp_file(suffix=suffix, directory=directory) - temp_file = open(temp_file_path, 'wt') + temp_file = open(temp_file_path, 'wt', encoding='utf8') temp_file.write(data) temp_file.close() return temp_file_path