openpathsampling.netcdfplus.cache.WeakKeyCache
- class openpathsampling.netcdfplus.cache.WeakKeyCache(dict=None)[source]
Implements a cache that keeps weak references to all elements
- __init__(dict=None)
Methods
__init__
([dict])clear
()copy
()get
(k[,d])get_silent
(item[, default])get value by key if it exists, None else
items
()keyrefs
()Return a list of weak references to the keys.
keys
()pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
setdefault
(k[,d])transfer
(old_cache)Transfer values between caches
update
([E, ]**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, v in F.items(): D[k] = v
values
()Attributes
count
the number of strong references int : the number of weak references
size
the maximal number of strong references, -1 if infinite int : the maximal number of weak references, -1 if infinite