Skip to content

Commit d1d8f91

Browse files
rxpha3lqkaiser
authored andcommitted
feat(models): allowing directory handler having no extractor
1 parent ee02ccb commit d1d8f91

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
@@ -408,19 +408,22 @@ def get_files(self, directory: Path) -> Iterable[Path]:
408408
return [path] if path.exists() else []
409409

410410

411-
class DirectoryHandler(abc.ABC):
411+
DExtractor = TypeVar("DExtractor", bound=Union[None, DirectoryExtractor])
412+
413+
414+
class DirectoryHandler(abc.ABC, Generic[DExtractor]):
412415
"""A directory type handler is responsible for searching, validating and "unblobbing" files from multiple files in a directory."""
413416

414417
NAME: str
415418

416-
EXTRACTOR: DirectoryExtractor
419+
EXTRACTOR: DExtractor
417420

418421
PATTERN: DirectoryPattern
419422

420423
@classmethod
421424
def get_dependencies(cls):
422425
"""Return external command dependencies needed for this handler to work."""
423-
if cls.EXTRACTOR:
426+
if cls.EXTRACTOR is not None:
424427
return cls.EXTRACTOR.get_dependencies()
425428
return []
426429

0 commit comments

Comments
 (0)