faust.types.models

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

None

abstract clone(**kwargs: Any) FieldDescriptorT[source]
Return type:

FieldDescriptorT

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

_GenericAlias[str, Any]

abstract validate_all(value: Any) Iterable[ValidationError][source]
Return type:

_GenericAlias[ValidationError]

abstract validate(value: T) Iterable[ValidationError][source]
Return type:

_GenericAlias[ValidationError]

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

_UnionGenericAlias[~T, None]

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

_UnionGenericAlias[~T, None]

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

bool

abstract getattr(obj: ModelT) T[source]
Return type:

~T

abstract validation_error(reason: str) ValidationError[source]
Return type:

ValidationError

abstract property ident: str
Return type:

str

related_models[source]
lazy_coercion[source]
class faust.types.models.ModelOptions[source]
serializer: Optional[Union[CodecT, str]] = None
namespace: str
include_metadata: bool = True
polymorphic_fields: bool = False
allow_blessed_key: bool = False
isodates: bool = False
decimals: bool = False
validation: bool = False
coerce: bool = False
coercions: MutableMapping[Union[Type, Tuple[Type, ...]], Callable[[Any], Any]] = None
date_parser: Optional[Callable[[Any], datetime]] = None
fields: Mapping[str, Type] = None

Flattened view of __annotations__ in MRO order.

Type:

Index

fieldset: FrozenSet[str] = None

Set of required field names, for fast argument checking.

Type:

Index

descriptors: Mapping[str, FieldDescriptorT] = None

Mapping of field name to field descriptor.

Type:

Index

fieldpos: Mapping[int, str] = None

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

Type:

Index

optionalset: FrozenSet[str] = None

Set of optional field names, for fast argument checking.

Type:

Index

defaults: Mapping[str, Any] = None

Mapping of field names to default value.

tagged_fields: FrozenSet[str] = None
personal_fields: FrozenSet[str] = None
sensitive_fields: FrozenSet[str] = None
secret_fields: FrozenSet[str] = None
has_tagged_fields: bool = False
has_personal_fields: bool = False
has_sensitive_fields: bool = False
has_secret_fields: bool = False
clone_defaults() ModelOptions[source]
Return type:

ModelOptions

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

ModelT

abstract classmethod loads(s: bytes, *, default_serializer: Optional[Union[CodecT, str]] = None, serializer: Optional[Union[CodecT, str]] = None) ModelT[source]
Return type:

ModelT

abstract dumps(*, serializer: Optional[Union[CodecT, str]] = None) bytes[source]
Return type:

bytes

abstract derive(*objects: ModelT, **fields: Any) ModelT[source]
Return type:

ModelT

abstract to_representation() Any[source]
Return type:

Any

abstract is_valid() bool[source]
Return type:

bool

abstract validate() List[ValidationError][source]
Return type:

_GenericAlias[ValidationError]

abstract validate_or_raise() None[source]
Return type:

None

abstract property validation_errors: List[ValidationError]
Return type:

_GenericAlias[ValidationError]