multidirmap

A multidirectional mapping with an arbitrary number of key columns.

class multidirmap.MultiDirMap(columns, key_columns=None, data=None)[source]

A multidirectional mapping with an arbitrary number of key columns.

clear()[source]

Clear all key dicts, thereby deleting all stored data.

get(key, default=None)[source]

Redirects to get() of the primary key dict.

items()[source]

Redirects to items() of the primary key dict.

keys()[source]

Redirects to keys() of the primary key dict.

pop(key, default=<object object>)[source]

Pop an entry from the mapping.

Entry is returned from the primary key dict and it as well as all consequently orphaned entries are removed from the secondary key dicts.

popitem()[source]

Pop from the end of the primary key dict.

All consequently orphaned entries are removed from the secondary key dicts.

print_settings(**kwargs)[source]

Change the print settings for __str__().

max_width gives the maximum width of the entire table. max_cols gives the maximum number of columns. max_col width gives the maximum width of each column.

update(data, overwrite='primary', skip_duplicates=False)[source]

Update the map with the provided data.

overwrite can be “none”, “primary”, “secondary”, or “all” and determines whether an entry can still be added when it conflicts with an existing entry. skip_duplicates determines whether a conflicting entry that will not overwrite should be skipped. If False, an exception will be raised in that situation and a rollback performed, so that the update() operation does not change the state of the map.

values()[source]

Redirects to values() of the primary key dict.

exception multidirmap.DuplicateKeyError[source]

Raised when secondary key is not unique.