faust.models.typing

Parsing Type Expressions.

This module contains tools for parsing type expressions such as List[Mapping[str, Tuple[int, Tuple[str, str]]]], then converting that to a generator expression that can be used to deserialize such a structure.

class faust.models.typing.NodeType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
ROOT = 'ROOT'
UNION = 'UNION'
ANY = 'ANY'
LITERAL = 'LITERAL'
DATETIME = 'DATETIME'
DECIMAL = 'DECIMAL'
NAMEDTUPLE = 'NAMEDTUPLE'
TUPLE = 'TUPLE'
SET = 'SET'
DICT = 'DICT'
LIST = 'LIST'
MODEL = 'MODEL'
USER = 'USER'
class faust.models.typing.TypeExpression(expr: Type, root: RootNode = None, *, user_types: MutableMapping[Union[Type, Tuple[Type, ...]], Callable[[Any], Any]] = None, date_parser: Callable[[Any], datetime] = None)[source]
DEFAULT_NODE

alias of LiteralNode

type: ClassVar[NodeType] = 'ROOT'
compatible_types: Union[Type, Tuple[Type, ...]] = ()
as_function(*, name: str = 'expr', argument_name: str = 'a', stacklevel: int = 1, locals: Dict[str, Any] = None, globals: Dict[str, Any] = None) Callable[[T], T][source]
Return type:

_CallableGenericAlias[~T, ~T]

as_string(*, name: str = 'expr', argument_name: str = 'a') str[source]
Return type:

str

as_comprehension(argument_name: str = 'a') str[source]
Return type:

str

build(var: Variable, *args: Type) str[source]
Return type:

str

property has_models: bool
Return type:

bool

property has_custom_types: bool
Return type:

bool

property has_generic_types: bool
Return type:

bool

property has_nonfield_types: bool
Return type:

bool