Skip to content

Commit

Permalink
models:reference_files - add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Nov 8, 2023
1 parent 2dbda27 commit a99c9b0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions acacore/models/reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,28 @@ class RenameAction(BaseModel):


class ActionData(BaseModel):
"""
A class representing the data for a specific action.
Separate from Action to avoid duplicating information in the File object.
Attributes:
convert (Optional[list[ConvertAction]]): A list of ConvertAction objects representing the conversion
actions to be performed. Defaults to None.
extract (Optional[ExtractAction]): An ExtractAction object representing the extraction action to be
performed. Defaults to None.
replace (Optional[ReplaceAction]): A ReplaceAction object representing the replacement action to be
performed. Defaults to None.
manual (Optional[ManualAction]): A ManualAction object representing the manual action to be
performed. Defaults to None.
rename (Optional[RenameAction]): A RenameAction object representing the renaming action to be
performed. Defaults to None.
ignore (Optional[IgnoreAction]): An IgnoreAction object representing the ignore action to be
performed. Defaults to None.
reidentify (Optional[ReIdentifyAction]): A ReIdentifyAction object representing the re-identification
action to be performed. Defaults to None.
"""

convert: Optional[list[ConvertAction]] = None
extract: Optional[ExtractAction] = None
replace: Optional[ReplaceAction] = None
Expand All @@ -142,12 +164,33 @@ class ActionData(BaseModel):


class Action(ActionData):
"""
Class representing an Action.
Follows the format as outlined in the reference files repository.
Subclasses ActionData to avoid duplicated properties in the File object.
See Also:
https://github.com/aarhusstadsarkiv/reference-files/blob/main/fileformats.schema.json
Attributes:
name (str): The name of the action.
description (Optional[str]): The description of the action.
action (Optional[TActionType]): The type of action.
"""

name: str
description: Optional[str] = None
action: TActionType

@property
def action_data(self) -> ActionData:
"""
Return only the ActionData portion of the object.
Returns:
ActionData: The action data.
"""
return ActionData(
convert=self.convert,
extract=self.extract,
Expand Down

0 comments on commit a99c9b0

Please sign in to comment.