openmnglab.util.dicts#

Functions

get_and_incr(dct, key)

get_any(map, *keys[, default])

Gets any value mapped by one of the existing keys if it exists in the mapping :param map: the mapping to work on :param keys: keys to look for in the mapping :param default: default value to return when none of the given keys exist in the mapping :return: an existing value of any of the given keys or the default

get_any_key(map, *keys)

Returns any of the given keys if they exist in the mapping :param map: mapping in which the keys should be contained :param keys: key to check for in the mapping :return: anyone of the given keys that exists or None if no key exists

group_dict(vals, key_getter)

groups the given vals in a dictionary by the key returned from the key getter.

setfactory(map, key, factory)

Equivalant of dict.setdefault with a factory instead of a value.