pydantic
CythonFunctionDetector
Cython function detector for solution to pydantic/cython issue: https://github.com/pydantic/pydantic/issues/6670#issuecomment-1644799636
HashableBaseModelIO
Bases: BaseModel
Input/output utilities for the models with support for the following features:
- Hashing of the model
- Conversion to and from dictionaries, json, toml, and yaml files
- Compatibility with pydantic v1 and v2
exclude
property
Fields to exclude from the model, typically used to exclude arbitrary types when it is allowed in the pydantic model to avoid hashing issues.
dataFromAny
classmethod
dataFromAny(
*,
data: dict | None = None,
text: str | bytes | None = None,
path: str | PathLike | None = None,
key: str = ""
) -> dict
Load the data from a dictionary, json, toml, yaml, or binary string, or file if a path is provided.
dataFromBytes
classmethod
dataFromBytes(
binary_or_path: bytes | str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = ""
) -> dict
Load the data from a binary string or file if a path is provided.
dataFromDict
classmethod
Load the data from a dictionary.
dataFromJson
classmethod
dataFromJson(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = ""
) -> dict
Load the data from a json string or file if a path is provided.
dataFromToml
classmethod
dataFromToml(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = ""
) -> dict
Load the data from a toml string or file if a path is provided.
dataFromYaml
classmethod
dataFromYaml(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = ""
) -> dict
Load the data from a yaml string or file if a path is provided.
format
Format the model with the given specifications.
PARAMETER | DESCRIPTION |
---|---|
copy
|
Whether to copy the current model.
TYPE:
|
rebuild
|
Whether to rebuild the model. If true, the model will be rebuilt with the formatted data which is a copy of the model.
TYPE:
|
specs
|
The specifications for the formatting.
TYPE:
|
fromAny
classmethod
fromAny(
*,
data: dict | None = None,
text: str | bytes | None = None,
path: str | PathLike | None = None,
key: str = "",
**kwargs
) -> Self
Load the model from a dictionary, json, toml, yaml, or binary string, or file if a path is provided.
fromBytes
classmethod
fromBytes(
binary_or_path: bytes | str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = "",
**kwargs
) -> Self
Load the model from a binary string or file if a path is provided.
fromDict
classmethod
Load the model from a dictionary.
fromJson
classmethod
fromJson(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = "",
**kwargs
)
Load the model from a json string or file if a path is provided.
fromToml
classmethod
fromToml(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = "",
**kwargs
)
Load the model from a toml string or file if a path is provided.
fromYaml
classmethod
fromYaml(
string_or_path: str | PathLike | None = None,
path: str | PathLike | None = None,
*,
key: str = "",
**kwargs
)
Load the model from a yaml string or file if a path is provided.
merge
merge(
*others: Self,
deep: bool = True,
copy: bool = True,
rebuild: bool = False,
exclude_unset: bool = False,
**specs
)
Merge the model with other models.
PARAMETER | DESCRIPTION |
---|---|
others
|
The other models to merge.
TYPE:
|
deep
|
Whether to deep merge the dictionaries.
TYPE:
|
copy
|
Whether to copy the current model.
TYPE:
|
rebuild
|
Whether to rebuild the model. If true, the model will be rebuilt with the formatted data which is a copy of the model.
TYPE:
|
exclude_unset
|
Whether to exclude unset values from the dictionaries.
TYPE:
|
specs
|
The specifications for the formatting.
DEFAULT:
|
setParameters
Set the material parameters.
toAny
Convert the model to a dictionary, json, toml, yaml, or binary string.
toBytes
Convert the model to a binary string or save it to a file if a path is provided.
toJson
Convert the model to a json string or save it to a file if a path is provided.
toToml
Convert the model to a toml string or save it to a file if a path is provided.
toYaml
Convert the model to a yaml string or save it to a file if a path is provided.
_CyFunctionDetectorMeta
Bases: type