minos.common.model.types.model_types module

class minos.common.model.types.model_types.FieldType(name: str, type: type)[source]

Bases: NamedTuple

Field Type class.

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.

name: str

Alias for field number 0

type: type

Alias for field number 1

class minos.common.model.types.model_types.ModelType[source]

Bases: type

Model Type class.

__init__(*args, **kwargs)
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.

Return type

minos.common.model.types.model_types.ModelType

Returns

A ModelType instance.

property classname: str

Get the full class name.

Return type

str

Returns

An string object.

static from_model(type_)[source]

Build a new instance from model class.

Parameters

type – The model class.

Return type

minos.common.model.types.model_types.ModelType

Returns

A new ModelType instance.

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.

Return type

minos.common.model.types.model_types.ModelType

Returns

A ModelType instance.

property model_cls: Type[Model]

Get the model class if defined or DataTransferObject otherwise.

Return type

Type[Model]

Returns

A model class.

mro()

Return a type’s method resolution order.

property name: str

Get the type name.

Return type

str

Returns

A string object.

namespace: str
type_hints: dict