qat.utils.pydantic module

class AllowExtraFieldsModel(**data)

Bases: BaseModel

A Pydantic BaseModel with the extra constraints:
  1. Assignment of fields after initialisation is checked again.

  2. Extra fields given to the model are ignored (default behaviour in BaseModel).

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'use_enum_values': False, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FrozenDict(root=PydanticUndefined, **data)

Bases: PydDictBase

A Pydantic dict that is immutable after instantiation.

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

root: pyd_frozendict[K, V]
class FrozenSet(root=PydanticUndefined, **data)

Bases: PydSetBase

A Pydantic set that is immutable after instantiation.

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

root: frozenset[V]
class NoExtraFieldsModel(**data)

Bases: BaseModel

A Pydantic BaseModel with the extra constraints:
  1. Assignment of fields after initialisation is checked again.

  2. Extra fields given to the model are not ignored (default behaviour in BaseModel),

but raise an error now.

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'ser_json_inf_nan': 'constants', 'use_enum_values': False, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class PydDictBase(root=PydanticUndefined, **data)

Bases: RootModel[dict[~GeneralKey, ~GeneralValue]]

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 allow self as a field name.

get(key, default=None)
items()
keys()
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pop(key, *args, **kwargs)
root: dict[K, V]
values()
class PydListBase(root=PydanticUndefined, **data)

Bases: RootModel[list[~GeneralValue]]

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

root: list[V]
class PydSetBase(root=PydanticUndefined, **data)

Bases: RootModel[set[~GeneralValue]]

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

root: set[V]
class ValidatedDict(root=PydanticUndefined, **data)

Bases: PydDictBase

A dict object that validates the input added after instantiation. This way, we are sure that the elements in a dict are only of a certain type. (FYI: Pydantic containers only validate upon instantiation.)

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 allow self as a field name.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

update(data)
class ValidatedList(root=PydanticUndefined, **data)

Bases: PydListBase

A list object that validates the input appended/extended after instantiation. This way, we are sure that the elements in a list are only of a certain type. (FYI: Pydantic containers only validate upon instantiation.)

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 allow self as a field name.

append(value)
extend(values)
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

remove(value)
class ValidatedSet(root=PydanticUndefined, **data)

Bases: PydSetBase

A set object that validates the input added after instantiation. This way, we are sure that the elements in a set are only of a certain type. (FYI: Pydantic containers only validate upon instantiation.)

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 allow self as a field name.

add(value)
discard(value)
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pop()
remove(value)
update(*sets)
find_all_subclasses(cls)

Recursively finds nested subclasses of a class.

Return type:

list[Type]

get_annotated_array(ty)

Creates an annotated type for numeric lists with Pydantic serializers and validators for efficient serialization.

get_validator_from_annotated(annotated_type)
validate_calibratable_positive_float(value)
validate_calibratable_unit_interval(value)
validate_calibratable_unit_interval_array(array)
validate_non_negative(value)
validate_qubit_coupling(value)
validate_waveform_type(value)