MambuPy.api.classes

Base and utility Classes for Mambu Objects.

Classes

GenericClass(*args, **kwargs)

Generic class for init of MambuMapObj

MambuMapObj([cf_class])

An object with dictionary-like behaviour for key-value data

class MambuPy.api.classes.GenericClass(*args, **kwargs)[source]

Bases: object

Generic class for init of MambuMapObj

__dict__ = mappingproxy({'__module__': 'MambuPy.api.classes', '__doc__': 'Generic class for init of MambuMapObj', '__init__': <function GenericClass.__init__>, '__dict__': <attribute '__dict__' of 'GenericClass' objects>, '__weakref__': <attribute '__weakref__' of 'GenericClass' objects>, '__annotations__': {}})
__init__(*args, **kwargs)[source]
__module__ = 'MambuPy.api.classes'
__weakref__

list of weak references to the object (if defined)

class MambuPy.api.classes.MambuMapObj(cf_class=<class 'MambuPy.api.classes.GenericClass'>, **kwargs)[source]

Bases: object

An object with dictionary-like behaviour for key-value data

__contains__(item)[source]

Dict-like and List-like behaviour

__delitem__(key)[source]

Dict-like del key

__dict__ = mappingproxy({'__module__': 'MambuPy.api.classes', '__doc__': 'An object with dictionary-like behaviour for key-value data', '__init__': <function MambuMapObj.__init__>, '__getattribute__': <function MambuMapObj.__getattribute__>, '__setattr__': <function MambuMapObj.__setattr__>, '__getitem__': <function MambuMapObj.__getitem__>, '__setitem__': <function MambuMapObj.__setitem__>, '__delitem__': <function MambuMapObj.__delitem__>, '__str__': <function MambuMapObj.__str__>, '__repr__': <function MambuMapObj.__repr__>, '__eq__': <function MambuMapObj.__eq__>, '__hash__': <function MambuMapObj.__hash__>, '__len__': <function MambuMapObj.__len__>, '__contains__': <function MambuMapObj.__contains__>, 'get': <function MambuMapObj.get>, 'keys': <function MambuMapObj.keys>, 'items': <function MambuMapObj.items>, 'values': <function MambuMapObj.values>, 'has_key': <function MambuMapObj.has_key>, '__dict__': <attribute '__dict__' of 'MambuMapObj' objects>, '__weakref__': <attribute '__weakref__' of 'MambuMapObj' objects>, '__annotations__': {}})
__eq__(other)[source]

Very basic way to compare to Mambu objects.

Only looking at their EncodedKey field (its primary key on the Mambu DB).

Todo

a lot of improvements may be done here.

__getattribute__(name)[source]

Object-like get attribute

When accessing an attribute, tries to find it in the _attrs dictionary, so now MambuMapObj may act not only as a dict-like structure, but as a full object-like too (this is the getter side).

__getitem__(key)[source]

Dict-like key query

__hash__()[source]

Hash of the object

__init__(cf_class=<class 'MambuPy.api.classes.GenericClass'>, **kwargs)[source]
__len__()[source]

Length of the _attrs attribute.

If dict-like (not iterable), it’s the number of keys holded on the _attrs dictionary. If list-like (iterable), it’s the number of elements of the _attrs list.

__module__ = 'MambuPy.api.classes'
__repr__()[source]

Mambu object repr tells the class name and the usual ‘id’ for it.

If an iterable, it instead gives its length.

__setattr__(name, value)[source]

Object-like set attribute

When setting an attribute, tries to set it in the _attrs dictionary, so now MambuMapObj acts not only as a dict-like structure, but as a full object-like too (this is the setter side).

__setitem__(key, value)[source]

Dict-like set

__str__()[source]

Mambu object str gives a string representation of the _attrs attribute.

__weakref__

list of weak references to the object (if defined)

get(key, default=None)[source]

Dict-like behaviour

has_key(key)[source]

Dict-like behaviour

items()[source]

Dict-like behaviour

keys()[source]

Dict-like behaviour

values()[source]

Dict-like behaviour