diplomat.processing.type_casters.TypeCaster

class diplomat.processing.type_casters.TypeCaster(*args, **kwds)[source]

Bases: Protocol[T]

Protocol for a type casting method. These are ‘smart’ types, capable of checking, and converting other types into their own type via the call operator.

A type caster must be able to be called with a single value, and return a single value, being the value coursed into to the correct type.

Casting methods are also allowed to throw an exception when the value received can’t be handled.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)