Skip to content

Commit

Permalink
models:file - allow to set UUID in File.from_file
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Nov 6, 2023
1 parent 69f0195 commit dc09882
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def from_file(
siegfried: Optional[Siegfried] = None,
actions: Optional[dict[str, Action]] = None,
custom_signatures: Optional[list[CustomSignature]] = None,
*,
uuid: Optional[UUID4] = None,
):
"""
Create a File object from a given file.
Expand All @@ -75,11 +77,13 @@ def from_file(
siegfried: A Siegfried class object to identify the file.
actions: A dictionary with PUID keys and Action values to assign an action.
custom_signatures: A list of CustomSignature objects to refine the identification.
uuid: Optionally, a specific UUID to use for the file.
Returns:
File: A File object.
"""
file = cls(
uuid=uuid or uuid4(),
checksum=file_checksum(path),
puid=None,
relative_path=path.relative_to(root) if root else path,
Expand Down

0 comments on commit dc09882

Please sign in to comment.