diff --git a/acacore/models/file.py b/acacore/models/file.py index 04686f1..12f46ac 100644 --- a/acacore/models/file.py +++ b/acacore/models/file.py @@ -495,16 +495,29 @@ def from_file( processed=processed, ) + file.identify(siegfried, custom_signatures, actions) + + return file + + def identify( + self, + siegfried: Siegfried | SiegfriedFile | None = None, + custom_signatures: list[CustomSignature] | None = None, + actions: dict[str, MasterConvertAction] | None = None, + ): + if not siegfried and not custom_signatures: + return + file_classes: list[TSiegfriedFileClass] = [] - if isinstance(siegfried, SiegfriedFile) and siegfried.matches: - file_classes = siegfried.best_match().file_classes + if siegfried and (match := super().identify(siegfried, set_match=True).best_match()): + file_classes = match.match_class + elif custom_signatures: + self.identify_custom(custom_signatures, set_match=True) if actions: - file.get_action("access", actions, file_classes, set_match=True) - file.get_action("statutory", actions, file_classes, set_match=True) - - return file + self.get_action("access", actions, file_classes, set_match=True) + self.get_action("statutory", actions, file_classes, set_match=True) def get_action( self,