diplomat.processing.type_casters.ConvertibleTypeCaster¶
- class diplomat.processing.type_casters.ConvertibleTypeCaster(*args, **kwargs)[source]¶
Bases:
TypeCasterA convertible typecaster, or one that can be converted to normal python type hints. This class also enables square bracket construction. (TypeCaster[args] is the same as TypeCaster(args)) This class is used for handling non-trivial type hinting types (such as Union, Dict, List, etc.)
- __init__(*args, **kwargs)¶
Methods
__init__(*args, **kwargs)Convert this type to a CLI-Friendly format for display on the command line as a metavar.
Abstract method: Convert this typecaster instance to a regular type hint.
- __call__(arg: Any) T[source]¶
Must be implemented by subclasses. Cast a value to this type.
- Parameters:
arg – The value to be casted.
- Returns:
The converted value, correctly converted to this type.
- Raises:
ValueError – If the passed value can’t be properly converted to this type.