snap_plugin.v1.config_map module

class snap_plugin.v1.config_map.ConfigMap(*args, **kwargs)

Bases: collections.abc.MutableMapping

ConfigMap provides a map of config key value pairs.

Parameters:
  • *args – variable length argument list. A valid argument is a two item tuple/list. The first item is the key and the second is the value.
  • **kwargs – Arbitrary keyword arguments representing the config.

Example:

cfg0 = snap.ConfigMap(user="john", port=911)
cfg1 = snap.ConfigMap(("user","john"),("port", 911))
Also see:
clear()

Removes all entries from the config map

has_key(key)

Does the config map contain the key?

Returns:True if key exists, False otherwise.
Return type:bool
items()

Returns a list of (key, value) pairs as 2-tuples.

iteritems()

Returns an iterator over the items of ConfigMap.

iterkeys()

Returns an iterator over the keys of ConfigMap.

itervalues()

Returns an iterator over the values of ConfigMap.

keys()

Returns a list of ConfigMap keys.

pb
pop(key, default=None)

Remove specified key and return the corresponding value. If key is not found, default is returned if given, otherwise KeyError is raised.

popitem()

Remove and return some (key, value) pair as a 2-tuple

update(*args, **kwargs)

Update ConfigMap from mapping/iterable.

If the key exists the entry is updated else it is added.

Parameters:
  • *args – variable length argument list. A valid argument is a two item tuple/list. The first item is the key and the second is the value.
  • **kwargs – Arbitrary keyword arguments representing the config.
values()

Returns a list of ConfigMap values.