nomenclate.core.tools module¶
- class nomenclate.core.tools.NomenclateNotifier(observer)[source]
Bases:
object
- notify_observer(*args, **kwargs)[source]
- register_observer(observer_function)[source]
- class nomenclate.core.tools.Serializable[source]
Bases:
object
- SERIALIZE_ATTRS = []
- deserialize(blob)[source]
- classmethod from_json(json_blob)[source]
- merge_json(json_blob)[source]
- merge_serialization(blob)[source]
- serialize()[source]
- to_json()[source]
- nomenclate.core.tools.combine_dicts(*args, **kwargs)[source]
Combines all arguments (if they are dictionaries) and kwargs to a final dict
- Parameters
args – dict, any dictionaries the user wants combined
kwargs – dict, kwargs.
- Returns
dict, compiled dictionary
- nomenclate.core.tools.flatten(it)[source]
- Flattens any iterable
- Parameters
it – Iterator, iterator to flatten
- Returns
Generator, A generator of the flattened values
- nomenclate.core.tools.flattenDictToLeaves(d, result=None, index=None)[source]
- nomenclate.core.tools.gen_dict_key_matches(key, dictionary, _path=None, full_path=False)[source]
- Generates a list of sets of (path, value) where path is a list of keys to access the given value in the given
nested dictionary
- Parameters
key – object, given dictionary key we are looking for
dictionary – dict, query dictionary
_path – list(str), internal use for the current path to output in case of match.
full_path – bool, return value or (path, value))
- Returns
Generator[object] or Generator[(list(str), object)], generator of (path, value) or just value
- nomenclate.core.tools.get_keys_containing(search_string, input_dict, default=None, first_found=True)[source]
- Searches a dictionary for all keys containing the search string (as long as the keys are not functions) and
returns a filtered dictionary of only those keys
- Parameters
search_string – str, string we are looking for
input_dict – dict, dictionary to search through
default – object, if we find nothing, return this as the default
first_found – bool, return the first found key
- Returns
dict, dictionary filled with any matching keys
- nomenclate.core.tools.get_string_difference(string1, string2)[source]