diplomat.processing.type_casters.ConvertibleTypeCaster

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

Bases: TypeCaster

A 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)

to_metavar()

Convert this type to a CLI-Friendly format for display on the command line as a metavar.

to_type_hint()

Abstract method: Convert this typecaster instance to a regular type hint.

to_metavar() str[source]

Convert this type to a CLI-Friendly format for display on the command line as a metavar.

Returns:

A string, the CLI Friendly format for this type.

to_type_hint() Type[source]

Abstract method: Convert this typecaster instance to a regular type hint.

Returns:

A type from the typing module or primitive, being the underlying type this typecaster converts values to and represents.