degenbot.types.concrete¶

Concrete type definitions (state caches).

Module Contents¶

class degenbot.types.concrete.KeyedDefaultDict[KT, VT](default_factory: collections.abc.Callable[[KT], VT])¶

Bases: collections.defaultdict[KT, VT]

A modified defaultdict that passes the key to default_factory at runtime and records it.

This differs from the defaultdict behavior, which calls default_factory with no arguments.

class degenbot.types.concrete.BoundedCache[KT, VT](max_items: int)¶

Bases: collections.OrderedDict[KT, VT]

A cache holding key-value pairs, tracked by entry order. The cache automatically removes old.

items if the number of items would exceed the maximum number of entries set by max_items.

Setting a value at an existing key will overwrite that value without affecting ordering.

max_items¶
copy() → Self¶

Copy.

Returns:

The computed value.