typeddfs.utils.parse_utils

Misc tools for typed-dfs.

Module Contents

class typeddfs.utils.parse_utils.ParseUtils
classmethod _re_leaf(cls, at: str, items: Mapping[str, Any]) Generator[Tuple[str, Any], None, None]
classmethod _un_leaf(cls, to: MutableMapping[str, Any], items: Mapping[str, Any]) None
classmethod dict_to_dots(cls, items: Mapping[str, Any]) Mapping[str, Any]

Performs the inverse of dots_to_dict().

Example

Utils.dict_to_dots({"genus": {"species": "fruit bat"}}) == {"genus.species": "fruit bat"}

classmethod dicts_to_toml_aot(cls, dicts: Sequence[Mapping[str, Any]])

Make a tomlkit Document consisting of an array of tables (β€œAOT”).

Parameters

dicts – A sequence of dictionaries

Returns

//github.com/sdispater/tomlkit/blob/master/tomlkit/items.py>`_ (i.e. [[array]])

Return type

A tomlkit`AoT<https

classmethod dots_to_dict(cls, items: Mapping[str, Any]) Mapping[str, Any]

Make sub-dictionaries from substrings in items delimited by .. Used for TOML.

Example

Utils.dots_to_dict({"genus.species": "fruit bat"}) == {"genus": {"species": "fruit bat"}}

See also

dict_to_dots()

classmethod property_key_escape(cls, s: str) str

Escapes a key in a .property file.

classmethod property_key_unescape(cls, s: str) str

Un-escapes a key in a .property file.

classmethod property_value_escape(cls, s: str) str

Escapes a value in a .property file.

classmethod property_value_unescape(cls, s: str) str

Un-escapes a value in a .property file.

classmethod strip_control_chars(cls, s: str) str

Strips all characters under the Unicode β€˜Cc’ category.