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. - Parameters:
- dict_in (MutableMapping[K, V]) – dict to check for existence of the specified global key 
- global_key (MutableSequence[K | int]) – global key the existence of which is checked in the passed in dict 
 
- Returns:
- True if the specified global key exists, otherwise False 
- Return type:
- bool 
 
- 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. - Parameters:
- arg (MutableMapping[K, V]) – dict the target key in which shall be set 
- global_key (MutableSequence[K | int]) – list of keys defining the global key thread to the target key (such as returned by method find_global_key()) 
- value (V) – value the target key shall be set to