polymerist.genutils.containers

Custom data containers with useful properties

Attributes

T

Classes

RecursiveDict

A defaultdict which can be recursively nested indefinitely

UnorderedRegistry

For storing and comparing unordered collections of items

Module Contents

polymerist.genutils.containers.T
class polymerist.genutils.containers.RecursiveDict(*args, **kwargs)[source]

Bases: collections.defaultdict

A defaultdict which can be recursively nested indefinitely

class polymerist.genutils.containers.UnorderedRegistry(*defaults: Iterable[T])[source]

For storing and comparing unordered collections of items

elements: list[collections.Counter] = []
input_as_counter()[source]

For transmuting the first input to a method into a counter

insert(elem: T) None[source]

Add a new element to the registry, avoiding duplication

pop(elem: T) T[source]

Removes a registered element from the UnoderedRegistry and returns it; Raises KeyError if the element was never registered in the first place

clear() None[source]

Empty all registered elements

reset() None[source]

Clear contents and restore initialized defaults