binobj.typedefs module

Definitions of aliases for common type annotations.

FieldOrName

A Field object or its name.

alias of Union[str, Field[Any]]

FieldValidator

A function that, given a field, returns True if it’s valid and False otherwise.

alias of Callable[[Field[Any], Any], Optional[bool]]

MethodFieldValidator

A field validator that’s a method in its containing struct.

alias of Callable[[Struct, Field[Any], Any], Optional[bool]]

MutableStrDict

Any mutable mapping using strings for the keys.

alias of MutableMapping[str, Any]

StrDict

Any mapping using strings as the keys.

alias of Mapping[str, Any]

StructOrName

A Struct or its name.

alias of Union[str, Struct, Type[Struct]]

StructValidator

A classmethod that validates an entire struct.

alias of Callable[[Struct, Mapping[str, Any]], Optional[bool]]