Skip to content

Commit 7af61d5

Browse files
rxpha3lqkaiser
authored andcommitted
feat(models): allowing directory handler having no extractor
1 parent b6fa621 commit 7af61d5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/unblob/models.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,15 @@ def get_files(self, directory: Path) -> Iterable[Path]:
422422
return [path] if path.exists() else []
423423

424424

425-
class DirectoryHandler(abc.ABC):
425+
DExtractor = TypeVar("DExtractor", bound=Union[None, DirectoryExtractor])
426+
427+
428+
class DirectoryHandler(abc.ABC, Generic[DExtractor]):
426429
"""A directory type handler is responsible for searching, validating and "unblobbing" files from multiple files in a directory."""
427430

428431
NAME: str
429432

430-
EXTRACTOR: DirectoryExtractor
433+
EXTRACTOR: DExtractor
431434

432435
PATTERN: DirectoryPattern
433436

@@ -436,7 +439,7 @@ class DirectoryHandler(abc.ABC):
436439
@classmethod
437440
def get_dependencies(cls):
438441
"""Return external command dependencies needed for this handler to work."""
439-
if cls.EXTRACTOR:
442+
if cls.EXTRACTOR is not None:
440443
return cls.EXTRACTOR.get_dependencies()
441444
return []
442445

0 commit comments

Comments
 (0)