Bases: BaseModel
Pydantic model used to represent a transformation.
The model_dump
method is overwritten to exclude the name field.
Attributes:
Name | Type | Description |
name | str | Name of the transformation. |
Source code in src/careamics/config/transformations/transform_model.py
| class TransformModel(BaseModel):
"""
Pydantic model used to represent a transformation.
The `model_dump` method is overwritten to exclude the name field.
Attributes
----------
name : str
Name of the transformation.
"""
model_config = ConfigDict(
extra="forbid", # throw errors if the parameters are not properly passed
)
name: str
def model_dump(self, **kwargs) -> dict[str, Any]:
"""
Return the model as a dictionary.
Parameters
----------
**kwargs
Pydantic BaseMode model_dump method keyword arguments.
Returns
-------
{str: Any}
Dictionary representation of the model.
"""
model_dict = super().model_dump(**kwargs)
# remove the name field
model_dict.pop("name")
return model_dict
|
Return the model as a dictionary.
Parameters:
Name | Type | Description | Default |
**kwargs | | Pydantic BaseMode model_dump method keyword arguments. | {} |
Returns:
Type | Description |
{str: Any} | Dictionary representation of the model. |
Source code in src/careamics/config/transformations/transform_model.py
| def model_dump(self, **kwargs) -> dict[str, Any]:
"""
Return the model as a dictionary.
Parameters
----------
**kwargs
Pydantic BaseMode model_dump method keyword arguments.
Returns
-------
{str: Any}
Dictionary representation of the model.
"""
model_dict = super().model_dump(**kwargs)
# remove the name field
model_dict.pop("name")
return model_dict
|