python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class multidict(MutableMapping):

View In Hierarchy

A dictionary-like object that is customized to deal with multiple values for the same key.

Each value in this dictionary will be a list. Methods which emulate the methods of a standard Python dict object will return or manipulate the first items of the lists only. Special methods are provided to deal with keys having multiple values.

Method __contains__ Returns whether there are any items associated to the given key.
Method __delitem__ Removes all the items associated to the given key.
Method __getitem__ Returns an arbitrary item associated to the given key. Raises KeyError if no such key exists.
Method __init__ Undocumented
Method __iter__ Iterates over the keys of the multidict.
Method __len__ Returns the number of distinct keys in this multidict.
Method __setitem__ Sets the item associated to the given key. Any values associated to the key will be erased and replaced by value.
Method add Adds value to the list of items associated to key.
Method clear Removes all the items from the multidict.
Method get Returns an arbitrary item associated to the given key. If key does not exist or has zero associated items, default will be returned.
Method getlist Returns the list of values for the given key. An empty list will be returned if there is no such key.
Method iterlists Iterates over (key, values) pairs where values is the list of values associated with key.
Method lists Returns a list of (key, values) pairs where values is the list of values associated with key.
Method update Undocumented
Instance Variable _dict Undocumented
def __contains__(self, key):
Returns whether there are any items associated to the given key.
def __delitem__(self, key):
Removes all the items associated to the given key.
def __getitem__(self, key):

Returns an arbitrary item associated to the given key. Raises KeyError if no such key exists.

Example:

>>> d = multidict([("spam", "eggs"), ("spam", "bacon")])
>>> d["spam"]
'eggs'
def __init__(self, *args, **kwds):

Undocumented

def __iter__(self):
Iterates over the keys of the multidict.
def __len__(self):
Returns the number of distinct keys in this multidict.
def __setitem__(self, key, value):

Sets the item associated to the given key. Any values associated to the key will be erased and replaced by value.

Example:

>>> d = multidict([("spam", "eggs"), ("spam", "bacon")])
>>> d["spam"] = "ham"
>>> d["spam"]
'ham'
def add(self, key, value):

Adds value to the list of items associated to key.

Example:

>>> d = multidict()
>>> d.add("spam", "ham")
>>> d["spam"]
'ham'
>>> d.add("spam", "eggs")
>>> d.getlist("spam")
['ham', 'eggs']
def clear(self):
Removes all the items from the multidict.
def get(self, key, default=None):
Returns an arbitrary item associated to the given key. If key does not exist or has zero associated items, default will be returned.
def getlist(self, key):
Returns the list of values for the given key. An empty list will be returned if there is no such key.
def iterlists(self):
Iterates over (key, values) pairs where values is the list of values associated with key.
def lists(self):
Returns a list of (key, values) pairs where values is the list of values associated with key.
def update(self, arg, **kwds):

Undocumented

_dict: dict =

Undocumented