harp.utils.collections

Inheritance diagram of harp.utils.collections

class MultiChainMap[source]

Bases: ChainMap

Implements the logic of chainmap, but for multidicts. It also allows to unset values on some key, this will be used for headers, cookies, query string … to allow the user to rewrite requests/responses in a memory efficient way.

The current implementation is neither complete, nor optimized.

TODO: find a better way for __iter__

Initialize a ChainMap by setting maps to the given mappings. If no mappings are provided, a single empty dictionary is used.

items() a set-like object providing a view on D's items[source]
pop(key)[source]

Remove key from maps[0] and return its value. Raise KeyError if key not in maps[0].

popitem()[source]

Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.

all_combinations(iterable)[source]