parse_type

parse_type(value, Type)[source]

Parses a value given a specific type.

Parameters:
  • value (Any) – The value to parse.

  • Type (T) – The type used to decide how to parse the value.

Returns:

The parsed value.

Return type:

T

Raises:

ValueError – If the target type is ambiguous or the value cannot be parsed to the given type.