Skip to content

Commit

Permalink
models.reference_files - rename "replace" to "template"
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Jun 26, 2024
1 parent 943ad4e commit e580f9e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions acacore/models/reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ignore",
"reidentify",
]
TReplaceTemplate = Literal[
TTemplateType = Literal[
"text",
"empty",
"password-protected",
Expand All @@ -28,7 +28,7 @@
]

ActionTypeEnum: tuple[TActionType, ...] = get_type_args(TActionType)
ReplaceTemplateEnum: tuple[TReplaceTemplate, ...] = get_type_args(TReplaceTemplate)
TemplateTypeEnum: tuple[TTemplateType, ...] = get_type_args(TTemplateType)


class CustomSignature(BaseModel):
Expand Down Expand Up @@ -78,15 +78,15 @@ class ExtractAction(NoDefaultsModel):
dir_suffix: str


class ReplaceAction(NoDefaultsModel):
class TemplateAction(NoDefaultsModel):
"""
Class representing a replacement action.
Class representing a template replacement action.
:ivar template: The replacement template.
:ivar template_text: Optional. Text to use instead of the default template, if template is set to "text".
"""

template: TReplaceTemplate
template: TTemplateType
template_text: str | None = None


Expand Down Expand Up @@ -169,7 +169,7 @@ class ActionData(NoDefaultsModel):
Defaults to None.
:ivar extract: An ExtractAction object representing the extraction action to be performed.
Defaults to None.
:ivar replace: A ReplaceAction object representing the replacement action to be performed.
:ivar template: A TemplateAction object representing the template replacement action to be performed.
Defaults to None.
:ivar manual: A ManualAction object representing the manual action to be performed.
Defaults to None.
Expand All @@ -183,7 +183,8 @@ class ActionData(NoDefaultsModel):

convert: list[ConvertAction] | None = None
extract: ExtractAction | None = None
replace: ReplaceAction | None = None
# "replace" alias for template to support older versions of fileformats
template: TemplateAction | None = Field(None, alias="replace")
manual: ManualAction | None = None
rename: RenameAction | None = None
ignore: IgnoreAction | None = None
Expand Down

0 comments on commit e580f9e

Please sign in to comment.