Package genlayer.py.storage#
Warning
This is an internal module
- class genlayer.py.storage.Array[source]#
Constantly sized array that can be persisted on the blockchain
- count(value) integer -- return number of occurrences of value #
- index(value[, start[, stop]]) integer -- return first index of value. #
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- class genlayer.py.storage.DynArray[source]#
Represents exponentially growing array (
list
in python terms) that can be persisted on the blockchain- clear() None -- remove all items from S #
- count(value) integer -- return number of occurrences of value #
- extend(values)#
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value. #
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- pop([index]) item -- remove and return item at index (default last). [source]#
Raise IndexError if list is empty or index is out of range.
- remove(value)#
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()#
S.reverse() – reverse IN PLACE
- class genlayer.py.storage.TreeMap[source]#
Represents a mapping from keys to values that can be persisted on the blockchain
K
must implementgenlayer.py.storage.tree_map.Comparable
protocol (“<” and “=” are needed)- __eq__(other)#
Return self==value.
- __hash__ = None#
- compute_if_absent(k: K, supplier: Callable[[], V]) V [source]#
- Returns:
Value associated with k if it is present, otherwise get’s new value from the supplier, stores it at k and returns
- Return type:
V
- get(k: K, default: G = None) V | G [source]#
- Returns:
Value associated with k or default if there is no such value
- Return type:
V | G
- keys() a set-like object providing a view on D's keys #
- 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() (k, v), remove and return some (key, value) pair #
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D #
- update([E, ]**F) None. Update D from mapping/iterable E and F. #
If E present and has a .keys() method, does: for k in E.keys(): 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, v in F.items(): D[k] = v
- values() an object providing a view on D's values #