nat.data_models.common#
Attributes#
Classes#
Subclass of a Pydantic BaseModel that is hashable. Use in objects that need to be hashed for caching purposes. |
|
Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions. |
Functions#
|
Compute a class' subclass depth. |
|
Get the origin of a type or the base class if it is not a generic. |
Module Contents#
- _LT#
- class HashableBaseModel(/, **data: Any)#
Bases:
pydantic.BaseModel
Subclass of a Pydantic BaseModel that is hashable. Use in objects that need to be hashed for caching purposes.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.
- _get_origin_or_base(cls: type) type #
Get the origin of a type or the base class if it is not a generic.
- class BaseModelRegistryTag#
- class TypedBaseModel(/, **data: Any)#
Bases:
pydantic.BaseModel
Subclass of Pydantic BaseModel that allows for specifying the object type. Use in Pydantic discriminated unions.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError
][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.self
is explicitly positional-only to allowself
as a field name.- model_post_init(__context)#
Set the type field to the correct value after instance creation.
- classmethod model_json_schema(
- by_alias: bool = True,
- ref_template: str = '#/$defs/{model}',
- schema_generator: type[GenerateJsonSchema] = GenerateJsonSchema,
- mode: pydantic.json_schema.JsonSchemaMode = 'validation',
Override to provide correct default for type field in schema.
- classmethod static_type()#
- classmethod static_full_type()#
- TypedBaseModelT#