bagof.converters.common
Common converters (any, union, etc.).
Classes
ToAny
ToNone
ToType
ToUnion
ToLiteral
ToTypeVar
ToAnnotated
Bases: Converter[TO, FROM]
Converter for Annotated.
Note
Annotated converters look for converters in the metadata of an annotated type hint and apply them in sequence (if they are composable).
Attributes
converters
property
converters: tuple[Converter, ...]
The chain of converters derived from the Annotated metadata.
Methods:
register_metadata
classmethod
Register a converter class for use as Annotated
metadata.
Distinct from Converter.register, which registers a
converter for a type hint in the global registry; this one
registers it for a piece of Annotated metadata.
like
Return the like hint from the first converter in the chain.