kartothek.utils.converters module¶
Helper module to convert user inputs into normalized forms.
-
kartothek.utils.converters.converter_str_set(obj) → frozenset[source]¶ Convert input to a set of unicode strings.
Nonewill be converted to an empty set.
-
kartothek.utils.converters.converter_str_set_optional(obj)[source]¶ Convert input to a set of unicode strings.
Nonewill 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.
-
kartothek.utils.converters.converter_str_tupleset(obj: Optional[Union[Iterable[str], str]]) → Tuple[str, …][source]¶ Convert input to tuple of unique unicode strings.
Nonewill 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
objis known to have an unstable iteration order.ValueError – If passed set contains duplicates.
-
kartothek.utils.converters.converter_tuple(obj) → tuple[source]¶ Convert input to a tuple.
Nonewill be converted to an empty tuple.- Parameters
obj (Any) – Object to convert.
- Returns
obj – Tuple.
- Return type
Tuple[Any]
-
kartothek.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]