diff --git a/.pylintrc b/.pylintrc index f49d7ba4..507d1b41 100644 --- a/.pylintrc +++ b/.pylintrc @@ -44,7 +44,7 @@ optimize-ast=no confidence= # Disable the message, report, category or checker with the given id(s) -disable=missing-docstring,locally-disabled,logging-format-interpolation +disable=missing-docstring,locally-disabled,logging-format-interpolation,wrong-import-order [REPORTS] diff --git a/fact_extractor/plugins/unpacking/xerox/code/dlm.py b/fact_extractor/plugins/unpacking/xerox/code/dlm.py index 97036908..08b43486 100644 --- a/fact_extractor/plugins/unpacking/xerox/code/dlm.py +++ b/fact_extractor/plugins/unpacking/xerox/code/dlm.py @@ -28,7 +28,7 @@ def _create_meta_dict(xeroxdlm): class XeroxDLM: - def __init__(self, firmware_file): + def __init__(self, firmware_file: str): self.firmware_file = firmware_file self.header_end_offset = None self.dlm_signature = None diff --git a/fact_extractor/plugins/unpacking/xerox/test/test_dlm.py b/fact_extractor/plugins/unpacking/xerox/test/test_dlm.py index 870672ea..f4188c8c 100644 --- a/fact_extractor/plugins/unpacking/xerox/test/test_dlm.py +++ b/fact_extractor/plugins/unpacking/xerox/test/test_dlm.py @@ -13,7 +13,7 @@ class TestXeroxDLM(TestUnpackerBase): def setUp(self): super().setUp() - self.test_path = Path(TEST_DATA_DIR, 'DLM-First_1MB.DLM') + self.test_path = str(Path(TEST_DATA_DIR, 'DLM-First_1MB.DLM')) self.firmware_container = XeroxDLM(self.test_path) def test_unpacker_selection(self): @@ -39,7 +39,7 @@ def test_header_and_binary(self): files, meta_data = self.unpacker.extract_files_from_file(self.test_path, self.tmp_dir.name) files = set(files) self.assertEqual(len(files), 1, 'file number incorrect') - data_bin = get_binary_from_file(Path(self.tmp_dir.name, 'dlm_data.bin')) + data_bin = get_binary_from_file(str(Path(self.tmp_dir.name, 'dlm_data.bin'))) self.assertEqual(get_sha256(data_bin), '701962b0d11f50d9129d5a1655ee054865e90cd1b547d40d590ea96f7dfb64eb') self.assertEqual(meta_data['dlm_version'], 'NO_DLM_VERSION_CHECK', 'meta: dlm_version not correct') self.assertEqual(meta_data['dlm_signature'], '90ec11f7b52468378362987a4ed9e56855070915887e6afe567e1c47875b29f9', 'meta: dlm_signature not correct') diff --git a/fact_extractor/test/unit/helperFunctions/test_statistics.py b/fact_extractor/test/unit/helperFunctions/test_statistics.py index d1a17d91..7e2e9080 100644 --- a/fact_extractor/test/unit/helperFunctions/test_statistics.py +++ b/fact_extractor/test/unit/helperFunctions/test_statistics.py @@ -46,7 +46,7 @@ def test_unpack_status_unpacked_file(config_fixture): def test_detect_unpack_loss_data_lost(config_fixture, common_tmpdir): - included_file = Path(common_tmpdir, 'inner') + included_file = Path(str(common_tmpdir), 'inner') included_file.write_bytes(256 * b'ABCDEFGH') result = {'summary': []} @@ -57,7 +57,7 @@ def test_detect_unpack_loss_data_lost(config_fixture, common_tmpdir): def test_detect_unpack_loss_no_data_lost(config_fixture, common_tmpdir): - included_file = Path(common_tmpdir, 'inner') + included_file = Path(str(common_tmpdir), 'inner') included_file.write_bytes(512 * b'ABCDEFGH') result = {'summary': []} diff --git a/fact_extractor/unpacker/unpack.py b/fact_extractor/unpacker/unpack.py index b9e77ae1..8de77a02 100644 --- a/fact_extractor/unpacker/unpack.py +++ b/fact_extractor/unpacker/unpack.py @@ -67,6 +67,6 @@ def move_extracted_files(self, file_paths: List[str], extraction_dir: Path) -> L relative_path = absolute_path.relative_to(extraction_dir) target_path = Path(self._file_folder, relative_path) os.makedirs(str(target_path.parent), exist_ok=True) - shutil.move(absolute_path, target_path) + shutil.move(str(absolute_path), str(target_path)) extracted_files.append(target_path) return extracted_files