plateau.utils.converters module
Helper module to convert user inputs into normalized forms.
- plateau.utils.converters.converter_str_set(obj) frozenset [source]
Convert input to a set of unicode strings.
None
will be converted to an empty set.
- plateau.utils.converters.converter_str_set_optional(obj)[source]
Convert input to a set of unicode strings.
None
will be preserved.- Parameters:
obj (Optional[Union[Iterable[str], str]]) – Object to convert.
- Returns:
obj – String set.
- Return type:
Optional[FrozenSet[str]]
- Raises:
ValueError – If an element in the passed object is not string/byte/like.
- plateau.utils.converters.converter_str_tupleset(obj: Iterable[str] | str | None) Tuple[str, ...] [source]
Convert input to tuple of unique unicode strings.
None
will be converted to an empty set.The input must not contain duplicate entries.
- Parameters:
obj – Object to convert.
- Raises:
TypeError – If passed object is not string/byte-like, or if
obj
is known to have an unstable iteration order.ValueError – If passed set contains duplicates.
- plateau.utils.converters.converter_tuple(obj) tuple [source]
Convert input to a tuple.
None
will be converted to an empty tuple.- Parameters:
obj (Any) – Object to convert.
- Returns:
obj – Tuple.
- Return type:
Tuple[Any]
- plateau.utils.converters.get_str_to_python_converter(pa_type)[source]
Get converter to parse string into python object.
- Parameters:
pa_type (pyarrow.DataType) – Data type.
- Returns:
converter – Converter.
- Return type:
Callable[[str], Any]