Utility types

class Range(string)[source]

Simplified slice with ‘-‘ as separator.

Handles only start and end, does not support negative numbers.

item_type

alias of int

class StringHandlingMixin(string)[source]

Turn string provided on initialization into data_type.

require_separator

If True and the string has no separator ArgumentTypeError will be raised.

separator

Separator for split operation

dsv(value_type, delimiter=', ')[source]

Delimiter Separated Values

n_tuple(n)[source]

Factory for n-tuples.

one_of(*types)[source]

Create a function which attempts to cast input to any of provided types.

The order of provided types is meaningful - if two types accept given input value, the first one on list will be used. Types should be able to accept a string (if correct) as input value for their constructors.