minos.common.model.types.model_types

Classes

FieldType

Field Type class.

ModelType

Model Type class.

class ModelType[source]

Bases: type

Model Type class.

namespace: str
type_hints: dict[str, Type]
classmethod build(name_, type_hints_=None, *, namespace_=None, **kwargs)[source]

Build a new ModelType instance.

Parameters
  • name – Name of the new type.

  • type_hints – Type hints of the new type.

  • namespace – Namespace of the new type.

  • kwargs – Type hints of the new type as named parameters.

  • name_ (str) –

  • type_hints_ (Optional[dict[str, type]]) –

  • namespace_ (Optional[str]) –

Returns

A ModelType instance.

Return type

ModelType

classmethod from_typed_dict(typed_dict)[source]

Build a new ModelType instance from a typing.TypedDict.

Parameters

typed_dict – Typed dict to be used as base.

Returns

A ModelType instance.

Return type

ModelType

static from_model(model)[source]

Build a new instance from model class.

Parameters

model (Union[Model, type[Model]]) – The model class.

Returns

A new ModelType instance.

Return type

ModelType

property model_cls: Type[Model]

Get the model class if defined or DataTransferObject otherwise.

Returns

A model class.

property name: str

Get the type name.

Returns

A string object.

property classname: str

Get the full class name.

Returns

An string object.

__init__(*args, **kwargs)
__new__(**kwargs)
mro()

Return a type’s method resolution order.

class FieldType[source]

Bases: NamedTuple

Field Type class.

name: str

Alias for field number 0

static __new__(_cls, name, type)

Create new instance of FieldType(name, type)

Parameters
count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

type: type

Alias for field number 1