dictIO.utils.dict¶
Utility functions for working with dictionaries.
Functions
|
Return the global key thread to the first key the value of which matches the passed in query. |
|
Check whether the specified global key exists in the passed in dict. |
|
alpha-numeric sorting of keys, recursively. |
|
Set the value for the passed in global key. |
- dictIO.utils.dict.find_global_key(arg: MutableMapping[K, V] | MutableSequence[V], query: str = '') list[K | int] | None¶
Return the global key thread to the first key the value of which matches the passed in query.
- Parameters:
arg (Union[MutableMapping[K, V], MutableSequence[V]]) – dict to search in for the queried value
query (str, optional) – query string for the value to search for, by default ‘’
- Returns:
global key thread to the first key the value of which matches the passed in query, if found. Otherwise None.
- Return type:
list[K | int] | None
- dictIO.utils.dict.global_key_exists(dict_in: MutableMapping[K, V], global_key: MutableSequence[K | int]) bool¶
Check whether the specified global key exists in the passed in dict.
- dictIO.utils.dict.order_keys(arg: M) M¶
alpha-numeric sorting of keys, recursively.
- Parameters:
arg (_MT) – MutableMapping, the keys of which shall be sorted.
- Returns:
the passed in MutableMapping, with keys sorted. The same instance is returned.
- Return type:
_MT
- dictIO.utils.dict.set_global_key(arg: MutableMapping[K, V], global_key: Sequence[K | int], value: V) None¶
Set the value for the passed in global key.