tron.utils.collections module

Utilities for working with collections.

class tron.utils.collections.MappingCollection(item_name)

Bases: dict

Dictionary like object for managing collections of items. Item is expected to support the following interface, and should be hashable.

class Item(object):

def get_name(self): …

def restore_state(self, state_data): …

def disable(self): …

def __eq__(self, other): …

add(item, update_func)
contains_item(item, handle_update_func)
filter_by_name(names)
remove(name)
remove_item(item)
replace(item)