typerig.core.objects.collection
# MODULE: TypeRig / Core / Collection (Objects)
# -----------------------------------------------------------
# (C) Vassil Kateliev, 2018-2020 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
Classes
-
A more or less complete user-defined wrapper around dictionary objects.
Adapted from Source: https://github.com/enthought/Python-2.7.3/blob/master/Lib/self.__class__.py
Methods
- cmp(self, dict)
-
- contains(self, key)
-
- delitem(self, key)
-
- getitem(self, key)
-
- init(self, dict=None, **kwargs)
-
- iter(self)
-
- len(self)
-
- repr(self)
-
- setitem(self, key, item)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
Class methods
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
Attributes
- abstractmethods = frozenset([])
- hash = None
- __eq_(self, other)
-
- ne(self, other)
-
- __subclasshook_(cls, C) from abc.ABCMeta
-
- __dict_
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- __metaclass_ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
-
A more or less complete user-defined wrapper around list objects.
Adapted from Source: https://github.com/enthought/Python-2.7.3/blob/master/Lib/UserList.py
Methods
- add(self, other)
-
- cmp(self, other)
-
- contains(self, item)
-
- delitem(self, i)
-
- delslice(self, i, j)
-
- eq(self, other)
-
- ge(self, other)
-
- getitem(self, i)
-
- getslice(self, i, j)
-
- gt(self, other)
-
- iadd(self, other)
-
- imul(self, n)
-
- init(self, initlist=None)
-
- le(self, other)
-
- len(self)
-
- lt(self, other)
-
- mul(self, n)
-
- ne(self, other)
-
- radd(self, other)
-
- repr(self)
-
- rmul = mul(self, n)
- setitem(self, i, item)
-
- setslice(self, i, j, other)
-
- append(self, item)
-
- count(self, item)
-
- extend(self, other)
-
- index(self, item, *args)
-
- insert(self, i, item)
-
- pop(self, i=-1)
-
- remove(self, item)
-
- reverse(self)
-
- sort(self, *args, **kwds)
-
Attributes
- abstractmethods = frozenset([])
- hash = None
- __iter_(self)
-
- reversed(self)
-
- __subclasshook_(cls, C) from abc.ABCMeta
-
- __dict_
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- __metaclass_ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
-
Default dictionary where keys can be accessed as attributes.
Methods
- delattr(self, name)
-
- getattribute(self, name)
-
- hash(self)
-
- init(self, *args, **kwdargs)
-
- repr(self)
-
- setattr(self, name, value)
-
- contains(self, search, search_type=None)
-
Does the object contain ANY value or nested object with given name (search)
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
Bool
- dir(self)
-
- extract(self, search)
-
Pull all values of specified key (search)
Attributes:
search (Str): Search string
Returns:
generator
- factory(self, factory_type)
-
- lock(self)
-
- where(self, search, search_type=None)
-
Pull all objects that contain values of specified search.
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
generator
Descriptors
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- copy(...)
-
D.copy() -> a shallow copy of D.
- missing(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- reduce(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- cmp(...)
-
x.__cmp__(y) <==> cmp(x,y)
- contains(...)
-
D.__contains__(k) -> True if D has a key k, else False
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- eq(...)
-
x.__eq__(y) <==> x==y
- ge(...)
-
x.__ge__(y) <==> x>=y
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- gt(...)
-
x.__gt__(y) <==> x>y
- iter(...)
-
x.__iter__() <==> iter(x)
- le(...)
-
x.__le__(y) <==> x<=y
- len(...)
-
x.__len__() <==> len(x)
- lt(...)
-
x.__lt__(y) <==> x
- ne(...)
-
x.__ne__(y) <==> x!=y
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- sizeof(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
-
Bi-directioanl dictionary partly based on Basj answer st:
https://stackoverflow.com/questions/3318625/efficient-bidirectional-hash-table-in-python
Methods
- delitem(self, key)
-
- init(self, *args, **kwargs)
-
- setitem(self, key, value)
-
Attributes
- abstractmethods = frozenset([])
- cmp(self, dict)
-
- contains(self, key)
-
- getitem(self, key)
-
- iter(self)
-
- len(self)
-
- repr(self)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
- hash = None
- __eq_(self, other)
-
- ne(self, other)
-
- __subclasshook_(cls, C) from abc.ABCMeta
-
- __dict_
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- __metaclass_ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
-
Custom list object that supports multiple dimensions
Example:
a = dimList([[[1, 2, 3, 4], ['a', 'b', 'c', 'd']], [[5, 6, 7, 8], ['e', 'f', 'g', 'h']]])
print(a[0,1,2])
Methods
- getitem(self, *args)
-
- init(self, *args, **kwargs)
-
- setitem(self, *args)
-
Descriptors
- dim
Attributes
- abstractmethods = frozenset([])
- add(self, other)
-
- cmp(self, other)
-
- contains(self, item)
-
- delitem(self, i)
-
- delslice(self, i, j)
-
- eq(self, other)
-
- ge(self, other)
-
- getslice(self, i, j)
-
- gt(self, other)
-
- iadd(self, other)
-
- imul(self, n)
-
- le(self, other)
-
- len(self)
-
- lt(self, other)
-
- mul(self, n)
-
- ne(self, other)
-
- radd(self, other)
-
- repr(self)
-
- rmul = mul(self, n)
-
- setslice(self, i, j, other)
-
- append(self, item)
-
- count(self, item)
-
- extend(self, other)
-
- index(self, item, *args)
-
- insert(self, i, item)
-
- pop(self, i=-1)
-
- remove(self, item)
-
- reverse(self)
-
- sort(self, *args, **kwds)
-
- hash = None
- __iter_(self)
-
- reversed(self)
-
- __subclasshook_(cls, C) from abc.ABCMeta
-
- __dict_
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- __metaclass_ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
-
Bi-directioanl dictionary with lists for values
Methods
- delitem(self, key)
-
- init(self, *args, **kwargs)
-
- setitem(self, key, value)
-
Attributes
- abstractmethods = frozenset([])
- cmp(self, dict)
-
- contains(self, key)
-
- getitem(self, key)
-
- iter(self)
-
- len(self)
-
- repr(self)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
- hash = None
- __eq_(self, other)
-
- ne(self, other)
-
- __subclasshook_(cls, C) from abc.ABCMeta
-
- __dict_
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- __metaclass_ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
-
Default dictionary where keys can be accessed as attributes. Light Version
----
Adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- getattribute(self, name)
-
- init(self, *args, **kwargs)
-
- repr(self)
-
- setattr(self, name, value)
-
Descriptors
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- copy(...)
-
D.copy() -> a shallow copy of D.
- missing(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- reduce(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- cmp(...)
-
x.__cmp__(y) <==> cmp(x,y)
- contains(...)
-
D.__contains__(k) -> True if D has a key k, else False
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- eq(...)
-
x.__eq__(y) <==> x==y
- ge(...)
-
x.__ge__(y) <==> x>=y
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- gt(...)
-
x.__gt__(y) <==> x>y
- iter(...)
-
x.__iter__() <==> iter(x)
- le(...)
-
x.__le__(y) <==> x<=y
- len(...)
-
x.__len__() <==> len(x)
- lt(...)
-
x.__lt__(y) <==> x
- ne(...)
-
x.__ne__(y) <==> x!=y
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- sizeof(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
-
Default dictionary where keys can be accessed as attributes. Light Version
----
Adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- getattribute(self, name)
-
- init(self, *args, **kwargs)
-
- repr(self)
-
- setattr(self, name, value)
-
Descriptors
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- copy(...)
-
D.copy() -> a shallow copy of D.
- missing(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- reduce(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- cmp(...)
-
x.__cmp__(y) <==> cmp(x,y)
- contains(...)
-
D.__contains__(k) -> True if D has a key k, else False
- delitem(...)
-
x.__delitem__(y) <==> del x[y]
- eq(...)
-
x.__eq__(y) <==> x==y
- ge(...)
-
x.__ge__(y) <==> x>=y
- getitem(...)
-
x.__getitem__(y) <==> x[y]
- gt(...)
-
x.__gt__(y) <==> x>y
- iter(...)
-
x.__iter__() <==> iter(x)
- le(...)
-
x.__le__(y) <==> x<=y
- len(...)
-
x.__len__() <==> len(x)
- lt(...)
-
x.__lt__(y) <==> x
- ne(...)
-
x.__ne__(y) <==> x!=y
- setitem(...)
-
x.__setitem__(i, y) <==> x[i]=y
- sizeof(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- hash = None
- new = <built-in method new of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
-
VFJ (JSON) decoder class for deserializing to a jsontree object structure.
----
Parts adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- init(self, *args, **kwdargs)
-
- decode(self, s, _w=<built-in method match of _sre.SRE_Pattern object>)
-
Return the Python representation of ``s`` (a ``str`` or ``unicode``
instance containing a JSON document)
- raw_decode(self, s, idx=0)
-
Decode a JSON document from ``s`` (a ``str`` or ``unicode``
beginning with a JSON document) and return a 2-tuple of the Python
representation and the index in ``s`` where the document ended.
This can be used to decode a JSON document from a string that may
have extraneous data at the end.
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
-
VFJ (JSON) encoder class that serializes out jsontree object structures.
----
Parts adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- init(self, *args, **kwdargs)
-
- default(self, obj)
-
- encode(self, o)
-
Return a JSON string representation of a Python data structure.
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
- iterencode(self, o, _one_shot=False)
-
Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)
- dict
-
dictionary for instance variables (if defined)
- weakref
-
list of weak references to the object (if defined)
- item_separator = ', '
- key_separator = ': '
CustomList
A more or less complete user-defined wrapper around list objects.
Adapted from Source: https://github.com/enthought/Python-2.7.3/blob/master/Lib/UserList.py
Methods
- __add__(self, other)
-
- __cmp__(self, other)
-
- __contains__(self, item)
-
- __delitem__(self, i)
-
- __delslice__(self, i, j)
-
- __eq__(self, other)
-
- __ge__(self, other)
-
- __getitem__(self, i)
-
- __getslice__(self, i, j)
-
- __gt__(self, other)
-
- __iadd__(self, other)
-
- __imul__(self, n)
-
- __init__(self, initlist=None)
-
- __le__(self, other)
-
- __len__(self)
-
- __lt__(self, other)
-
- __mul__(self, n)
-
- __ne__(self, other)
-
- __radd__(self, other)
-
- __repr__(self)
-
- __rmul__ = __mul__(self, n)
- __setitem__(self, i, item)
-
- __setslice__(self, i, j, other)
-
- append(self, item)
-
- count(self, item)
-
- extend(self, other)
-
- index(self, item, *args)
-
- insert(self, i, item)
-
- pop(self, i=-1)
-
- remove(self, item)
-
- reverse(self)
-
- sort(self, *args, **kwds)
-
Attributes
- __abstractmethods__ = frozenset([])
- __hash__ = None
- __iter__(self)
-
- __reversed__(self)
-
- __subclasshook__(cls, C) from abc.ABCMeta
-
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __metaclass__ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
dimList
Custom list object that supports multiple dimensions
Example:
a = dimList([[[1, 2, 3, 4], ['a', 'b', 'c', 'd']], [[5, 6, 7, 8], ['e', 'f', 'g', 'h']]])
print(a[0,1,2])
Methods
- __getitem__(self, *args)
-
- __init__(self, *args, **kwargs)
-
- __setitem__(self, *args)
-
Descriptors
- dim
Attributes
- __abstractmethods__ = frozenset([])
- __add__(self, other)
-
- __cmp__(self, other)
-
- __contains__(self, item)
-
- __delitem__(self, i)
-
- __delslice__(self, i, j)
-
- __eq__(self, other)
-
- __ge__(self, other)
-
- __getslice__(self, i, j)
-
- __gt__(self, other)
-
- __iadd__(self, other)
-
- __imul__(self, n)
-
- __le__(self, other)
-
- __len__(self)
-
- __lt__(self, other)
-
- __mul__(self, n)
-
- __ne__(self, other)
-
- __radd__(self, other)
-
- __repr__(self)
-
- __rmul__ = __mul__(self, n)
-
- __setslice__(self, i, j, other)
-
- append(self, item)
-
- count(self, item)
-
- extend(self, other)
-
- index(self, item, *args)
-
- insert(self, i, item)
-
- pop(self, i=-1)
-
- remove(self, item)
-
- reverse(self)
-
- sort(self, *args, **kwds)
-
- __hash__ = None
- __iter__(self)
-
- __reversed__(self)
-
- __subclasshook__(cls, C) from abc.ABCMeta
-
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __metaclass__ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
CustomDict
A more or less complete user-defined wrapper around dictionary objects.
Adapted from Source: https://github.com/enthought/Python-2.7.3/blob/master/Lib/self.__class__.py
Methods
- __cmp__(self, dict)
-
- __contains__(self, key)
-
- __delitem__(self, key)
-
- __getitem__(self, key)
-
- __init__(self, dict=None, **kwargs)
-
- __iter__(self)
-
- __len__(self)
-
- __repr__(self)
-
- __setitem__(self, key, item)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
Class methods
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
Attributes
- __abstractmethods__ = frozenset([])
- __hash__ = None
- __eq__(self, other)
-
- __ne__(self, other)
-
- __subclasshook__(cls, C) from abc.ABCMeta
-
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __metaclass__ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
biDict
Bi-directioanl dictionary partly based on Basj answer st:
https://stackoverflow.com/questions/3318625/efficient-bidirectional-hash-table-in-python
Methods
- __delitem__(self, key)
-
- __init__(self, *args, **kwargs)
-
- __setitem__(self, key, value)
-
Attributes
- __abstractmethods__ = frozenset([])
- __cmp__(self, dict)
-
- __contains__(self, key)
-
- __getitem__(self, key)
-
- __iter__(self)
-
- __len__(self)
-
- __repr__(self)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
- __hash__ = None
- __eq__(self, other)
-
- __ne__(self, other)
-
- __subclasshook__(cls, C) from abc.ABCMeta
-
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __metaclass__ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
extBiDict
Bi-directioanl dictionary with lists for values
Methods
- __delitem__(self, key)
-
- __init__(self, *args, **kwargs)
-
- __setitem__(self, key, value)
-
Attributes
- __abstractmethods__ = frozenset([])
- __cmp__(self, dict)
-
- __contains__(self, key)
-
- __getitem__(self, key)
-
- __iter__(self)
-
- __len__(self)
-
- __repr__(self)
-
- clear(self)
-
- copy(self)
-
- get(self, key, failobj=None)
-
- has_key(self, key)
-
- items(self)
-
- iteritems(self)
-
- iterkeys(self)
-
- itervalues(self)
-
- keys(self)
-
- pop(self, key, *args)
-
- popitem(self)
-
- setdefault(self, key, failobj=None)
-
- update(self, dict=None, **kwargs)
-
- values(self)
-
- fromkeys(cls, iterable, value=None) from abc.ABCMeta
-
- __hash__ = None
- __eq__(self, other)
-
- __ne__(self, other)
-
- __subclasshook__(cls, C) from abc.ABCMeta
-
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __metaclass__ = <class 'abc.ABCMeta'>
-
Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
attribdict
Default dictionary where keys can be accessed as attributes.
Methods
- __delattr__(self, name)
-
- __getattribute__(self, name)
-
- __hash__(self)
-
- __init__(self, *args, **kwdargs)
-
- __repr__(self)
-
- __setattr__(self, name, value)
-
- contains(self, search, search_type=None)
-
Does the object contain ANY value or nested object with given name (search)
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
Bool
- dir(self)
-
- extract(self, search)
-
Pull all values of specified key (search)
Attributes:
search (Str): Search string
Returns:
generator
- factory(self, factory_type)
-
- lock(self)
-
- where(self, search, search_type=None)
-
Pull all objects that contain values of specified search.
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
generator
Descriptors
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __copy__(...)
-
D.copy() -> a shallow copy of D.
- __missing__(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- __reduce__(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- __cmp__(...)
-
x.__cmp__(y) <==> cmp(x,y)
- __contains__(...)
-
D.__contains__(k) -> True if D has a key k, else False
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __eq__(...)
-
x.__eq__(y) <==> x==y
- __ge__(...)
-
x.__ge__(y) <==> x>=y
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __gt__(...)
-
x.__gt__(y) <==> x>y
- __iter__(...)
-
x.__iter__() <==> iter(x)
- __le__(...)
-
x.__le__(y) <==> x<=y
- __len__(...)
-
x.__len__() <==> len(x)
- __lt__(...)
-
x.__lt__(y) <==> x
- __ne__(...)
-
x.__ne__(y) <==> x!=y
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __sizeof__(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
- typerig.core.objects.collection.attribdict.extract = extract(self, search) unbound typerig.core.objects.collection.attribdict method
-
Pull all values of specified key (search)
Attributes:
search (Str): Search string
Returns:
generator
where
- typerig.core.objects.collection.attribdict.where = where(self, search, search_type=None) unbound typerig.core.objects.collection.attribdict method
-
Pull all objects that contain values of specified search.
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
generator
contains
- typerig.core.objects.collection.attribdict.contains = contains(self, search, search_type=None) unbound typerig.core.objects.collection.attribdict method
-
Does the object contain ANY value or nested object with given name (search)
Attributes:
search (Str): Search string
search_type (type) : Value type
Returns:
Bool
treeDict
Default dictionary where keys can be accessed as attributes. Light Version
----
Adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- __getattribute__(self, name)
-
- __init__(self, *args, **kwargs)
-
- __repr__(self)
-
- __setattr__(self, name, value)
-
Descriptors
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __copy__(...)
-
D.copy() -> a shallow copy of D.
- __missing__(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- __reduce__(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- __cmp__(...)
-
x.__cmp__(y) <==> cmp(x,y)
- __contains__(...)
-
D.__contains__(k) -> True if D has a key k, else False
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __eq__(...)
-
x.__eq__(y) <==> x==y
- __ge__(...)
-
x.__ge__(y) <==> x>=y
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __gt__(...)
-
x.__gt__(y) <==> x>y
- __iter__(...)
-
x.__iter__() <==> iter(x)
- __le__(...)
-
x.__le__(y) <==> x<=y
- __len__(...)
-
x.__len__() <==> len(x)
- __lt__(...)
-
x.__lt__(y) <==> x
- __ne__(...)
-
x.__ne__(y) <==> x!=y
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __sizeof__(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
treeDict
Default dictionary where keys can be accessed as attributes. Light Version
----
Adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- __getattribute__(self, name)
-
- __init__(self, *args, **kwargs)
-
- __repr__(self)
-
- __setattr__(self, name, value)
-
Descriptors
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- __copy__(...)
-
D.copy() -> a shallow copy of D.
- __missing__(...)
-
__missing__(key) # Called by __getitem__ for missing key; pseudo-code:
if self.default_factory is None: raise KeyError((key,))
self[key] = value = self.default_factory()
return value
- __reduce__(...)
-
Return state information for pickling.
- copy(...)
-
D.copy() -> a shallow copy of D.
- default_factory
-
Factory for default value called by __missing__().
- __cmp__(...)
-
x.__cmp__(y) <==> cmp(x,y)
- __contains__(...)
-
D.__contains__(k) -> True if D has a key k, else False
- __delitem__(...)
-
x.__delitem__(y) <==> del x[y]
- __eq__(...)
-
x.__eq__(y) <==> x==y
- __ge__(...)
-
x.__ge__(y) <==> x>=y
- __getitem__(...)
-
x.__getitem__(y) <==> x[y]
- __gt__(...)
-
x.__gt__(y) <==> x>y
- __iter__(...)
-
x.__iter__() <==> iter(x)
- __le__(...)
-
x.__le__(y) <==> x<=y
- __len__(...)
-
x.__len__() <==> len(x)
- __lt__(...)
-
x.__lt__(y) <==> x
- __ne__(...)
-
x.__ne__(y) <==> x!=y
- __setitem__(...)
-
x.__setitem__(i, y) <==> x[i]=y
- __sizeof__(...)
-
D.__sizeof__() -> size of D in memory, in bytes
- clear(...)
-
D.clear() -> None. Remove all items from D.
- fromkeys(...)
-
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
- get(...)
-
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
-
D.has_key(k) -> True if D has a key k, else False
- items(...)
-
D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
-
D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
-
D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
-
D.itervalues() -> an iterator over the values of D
- keys(...)
-
D.keys() -> list of D's keys
- pop(...)
-
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
- popitem(...)
-
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
- setdefault(...)
-
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
- update(...)
-
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
- values(...)
-
D.values() -> list of D's values
- viewitems(...)
-
D.viewitems() -> a set-like object providing a view on D's items
- viewkeys(...)
-
D.viewkeys() -> a set-like object providing a view on D's keys
- viewvalues(...)
-
D.viewvalues() -> an object providing a view on D's values
- __hash__ = None
- __new__ = <built-in method __new__ of type object>
-
T.__new__(S, ...) -> a new object with type S, a subtype of T
vfj_decoder
VFJ (JSON) decoder class for deserializing to a jsontree object structure.
----
Parts adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- __init__(self, *args, **kwdargs)
-
- decode(self, s, _w=<built-in method match of _sre.SRE_Pattern object>)
-
Return the Python representation of ``s`` (a ``str`` or ``unicode``
instance containing a JSON document)
- raw_decode(self, s, idx=0)
-
Decode a JSON document from ``s`` (a ``str`` or ``unicode``
beginning with a JSON document) and return a 2-tuple of the Python
representation and the index in ``s`` where the document ended.
This can be used to decode a JSON document from a string that may
have extraneous data at the end.
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
vfj_encoder
VFJ (JSON) encoder class that serializes out jsontree object structures.
----
Parts adapted from JsonTree by Doug Napoleone: https://github.com/dougn/jsontree
Methods
- __init__(self, *args, **kwdargs)
-
- default(self, obj)
-
- encode(self, o)
-
Return a JSON string representation of a Python data structure.
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
- iterencode(self, o, _one_shot=False)
-
Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)
- __dict__
-
dictionary for instance variables (if defined)
- __weakref__
-
list of weak references to the object (if defined)
- item_separator = ', '
- key_separator = ': '