Skip to content

Commit e9dde1a

Browse files
committed
update(pmole.py): Fix issue with compressing and decompressing directories
The solution was to regenerate a new dictionary for each file that is being compressed, this by consequence will create preformance issues that we will solve by adding cache support for the dictionary.
1 parent 220e43e commit e9dde1a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pmole/pmole.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def compress(self, file_path: str | None = None, directory_path: str | None = No
6060
"""
6161
files: list[FileHandler] = list()
6262
files_paths: list[str] = list()
63-
dictionary: LZWDictionary = LZWDictionary()
64-
dictionary.create()
63+
6564

6665
if directory_path is not None:
6766
files_paths = list_files_in_directory(
@@ -82,6 +81,9 @@ def compress(self, file_path: str | None = None, directory_path: str | None = No
8281
output_data: list[list[int]] = list()
8382

8483
for file in files:
84+
dictionary: LZWDictionary = LZWDictionary()
85+
dictionary.create()
86+
8587
logger.info(f"Compressing file `{file.file_path}`...")
8688

8789
file_buffer = file.read(threads)

0 commit comments

Comments
 (0)