faust.types.models

faust.types.models.FieldMap

alias of typing.Mapping

faust.types.models.CoercionHandler

alias of typing.Callable

class faust.types.models.TypeCoerce(*args, **kwargs)[source]
property target

Alias for field number 0

property handler

Alias for field number 1

class faust.types.models.TypeInfo(*args, **kwargs)[source]
property generic_type

Alias for field number 0

property member_type

Alias for field number 1

class faust.types.models.ModelOptions(*args, **kwargs)[source]
serializer = None
include_metadata = True
polymorphic_fields = False
allow_blessed_key = False
isodates = False
decimals = False
validation = False
coerce = False
coercions = None
date_parser = None
fields = None

Flattened view of __annotations__ in MRO order.

Type

Index

fieldset = None

Set of required field names, for fast argument checking.

Type

Index

descriptors = None

Mapping of field name to field descriptor.

Type

Index

fieldpos = None

Positional argument index to field name. Used by Record.__init__ to map positional arguments to fields.

Type

Index

optionalset = None

Set of optional field names, for fast argument checking.

Type

Index

models = None

Mapping of fields that are ModelT

Type

Index

modelattrs = None
field_coerce = None

Mapping of fields that need to be coerced. Key is the name of the field, value is the coercion handler function.

Type

Index

defaults = None

Mapping of field names to default value.

initfield = None

Mapping of init field conversion callbacks.

polyindex = None

Index of field to polymorphic type

clone_defaults() → faust.types.models.ModelOptions[source]
Return type

ModelOptions

class faust.types.models.ModelT(*args: Any, **kwargs: Any) → None[source]
abstract classmethod from_data(data: Any, *, preferred_type: Type[ModelT] = None) → faust.types.models.ModelT[source]
Return type

ModelT

abstract classmethod loads(s: bytes, *, default_serializer: Union[faust.types.codecs.CodecT, str, None] = None, serializer: Union[faust.types.codecs.CodecT, str, None] = None) → faust.types.models.ModelT[source]
Return type

ModelT

abstract dumps(*, serializer: Union[faust.types.codecs.CodecT, str, None] = None) → bytes[source]
Return type

bytes

abstract derive(*objects: faust.types.models.ModelT, **fields: Any) → faust.types.models.ModelT[source]
Return type

ModelT

abstract to_representation() → Any[source]
Return type

Any

abstract is_valid() → bool[source]
Return type

bool

abstract validate() → List[faust.exceptions.ValidationError][source]
Return type

List[ValidationError]

abstract validate_or_raise() → None[source]
Return type

None

abstract property validation_errors
Return type

List[ValidationError]

class faust.types.models.FieldDescriptorT(*, field: str = None, input_name: str = None, output_name: str = None, type: Type[T] = None, model: Type[faust.types.models.ModelT] = None, required: bool = True, default: T = None, parent: Optional[faust.types.models.FieldDescriptorT] = None, generic_type: Type = None, member_type: Type = None, exclude: bool = None, date_parser: Callable[Any, datetime.datetime] = None, **kwargs: Any) → None[source]
required = True
default = None
abstract clone(**kwargs: Any) → faust.types.models.FieldDescriptorT[source]
Return type

FieldDescriptorT[~T]

abstract as_dict() → Mapping[str, Any][source]
Return type

Mapping[str, Any]

abstract validate_all(value: Any) → Iterable[faust.exceptions.ValidationError][source]
Return type

Iterable[ValidationError]

abstract validate(value: T) → Iterable[faust.exceptions.ValidationError][source]
Return type

Iterable[ValidationError]

abstract prepare_value(value: Any) → Optional[T][source]
Return type

Optional[~T]

abstract should_coerce(value: Any) → bool[source]
Return type

bool

abstract getattr(obj: faust.types.models.ModelT) → T[source]
Return type

~T

abstract validation_error(reason: str) → faust.exceptions.ValidationError[source]
Return type

ValidationError

abstract property ident
Return type

str