Skip to content

Commit 5d2a082

Browse files
committed
processing: _process_one_file function is no longer needed
1 parent 3c33785 commit 5d2a082

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

unblob/processing.py

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,6 @@ def process_file(config: ExtractionConfig, path: Path) -> ProcessResult:
8080
if errors:
8181
return ProcessResult(errors)
8282

83-
result = _process_one_file(config, task)
84-
85-
return result
86-
87-
88-
def check_extract_directory(task: Task, config: ExtractionConfig):
89-
errors = []
90-
91-
extract_dir = get_extract_dir_for_input(config, task.path)
92-
if extract_dir.exists():
93-
if config.force_extract:
94-
shutil.rmtree(extract_dir)
95-
else:
96-
report = ExtractDirectoryExistsReport(path=extract_dir)
97-
logger.error("Extraction directory already exist", **report.asdict())
98-
errors.append(TaskResult(task, [report]))
99-
100-
return errors
101-
102-
103-
def _process_one_file(config: ExtractionConfig, root_task: Task) -> ProcessResult:
10483
processor = Processor(config)
10584
aggregated_result = ProcessResult()
10685

@@ -116,12 +95,27 @@ def process_result(pool, result):
11695
)
11796

11897
with pool:
119-
pool.submit(root_task)
98+
pool.submit(task)
12099
pool.process_until_done()
121100

122101
return aggregated_result
123102

124103

104+
def check_extract_directory(task: Task, config: ExtractionConfig):
105+
errors = []
106+
107+
extract_dir = get_extract_dir_for_input(config, task.path)
108+
if extract_dir.exists():
109+
if config.force_extract:
110+
shutil.rmtree(extract_dir)
111+
else:
112+
report = ExtractDirectoryExistsReport(path=extract_dir)
113+
logger.error("Extraction directory already exist", path=str(extract_dir))
114+
errors.append(TaskResult(task, [report]))
115+
116+
return errors
117+
118+
125119
class Processor:
126120
def __init__(self, config: ExtractionConfig):
127121
self._config = config

0 commit comments

Comments
 (0)