argclz.types#

Functions

literal_value_type

Parse a string into its literal Python value

bool_type

Convert a string to a boolean.

try_int_type

Attempt to convert a string to int, returning original or None on failure.

try_float_type

Attempt to convert a string to float, returning original or None on failure.

int_tuple_type

tuple[int, ...]

str_tuple_type

tuple[str, ...]

float_tuple_type

tuple[float, ...]

tuple_type

Create a caster that splits a comma-separated string into a tuple of typed values.

list_type

Caster which converts a delimited string into a list of typed values

union_type

Caster that tries multiple converters in order until one succeeds.

dict_type

Caster that accumulates key-value pairs from 'key:value' or 'key=value' strings.

slice_type

Convert a 'start:end' string into a slice object.

literal_type

Caster enforcing membership in a set of string literals with optional prefix matching