BijectiveMemory
- class PlasmaCalcs.tools.iterables.BijectiveMemory(*args, **kw)
Bases:
Bijectionbijection which also stores the next key to use. Keys should be numbers.
self.nextkey is never decremented (don’t “fill in gaps” after deleting keys)Methods
clear()clear all items from this bijection.
copy()fromkeys([value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()key(value)return the key associated with this value; store the value if not already stored.
keys()pop(key[, default])pop the value for this key, and return it.
popitem()pop an item from this bijection, and return it.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update(*args, **kw)update this bijection with new items.
values()Attributes
reverse mapping.
next key for self.key(value) if new value.
- clear()
clear all items from this bijection.
- copy() a shallow copy of D
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- property inverse
reverse mapping. {value: key} for all items in this bijection.
- items() a set-like object providing a view on D's items
- key(value)
return the key associated with this value; store the value if not already stored.
- keys() a set-like object providing a view on D's keys
- property nextkey
next key for self.key(value) if new value.
nextkey >= max(self.keys(), default=-1) + 1.
- pop(key, default=UNSET)
pop the value for this key, and return it.
- popitem()
pop an item from this bijection, and return it.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update(*args, **kw)
update this bijection with new items.
- values() an object providing a view on D's values