Skip to content

Commit

Permalink
refactor: remove AntaParamsBaseModel
Browse files Browse the repository at this point in the history
  • Loading branch information
mtache committed Apr 29, 2024
1 parent 0b5ffdb commit af391cd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions anta/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
logger = logging.getLogger(__name__)


class AntaParamsBaseModel(BaseModel):
"""Extends BaseModel and overwrite __getattr__ to return None on missing attribute."""

model_config = ConfigDict(extra="forbid")


class AntaTemplate:
"""Class to define a command template as Python f-string.
Expand Down Expand Up @@ -83,7 +77,7 @@ def __init__( # noqa: PLR0913
fields: dict[str, Any] = {key: (Any, ...) for key in field_names}
self.params_schema = create_model(
"AntaParams",
__base__=AntaParamsBaseModel,
__config__=ConfigDict(extra="forbid"),
**fields,
)

Expand Down Expand Up @@ -166,7 +160,7 @@ class AntaCommand(BaseModel):
output: dict[str, Any] | str | None = None
template: AntaTemplate | None = None
errors: list[str] = []
params: AntaParamsBaseModel = AntaParamsBaseModel()
params: BaseModel | None = None
use_cache: bool = True

@property
Expand Down

0 comments on commit af391cd

Please sign in to comment.