Module hoshmap.value.cacheableival
Expand source code
from hoshmap.value.ival import iVal
class CacheableiVal(iVal):
replace: callable
deps: dict
def __init__(self, caches=None, did=None, dids=None):
self.caches = caches
self.did = did
self.dids = dids
def withcaches(self, caches, did, dids):
# Only set cache on cacheless CacheableiVal objects
if self.caches is None:
return self.replace(caches=caches, did=did, dids=dids)
return self
def __repr__(self):
if not self.isevaluated:
lst = (k + ("" if dep.isevaluated else f"={repr(dep)}") for k, dep in self.deps.items())
return f"λ({' '.join(lst)})"
return repr(self.value)
Classes
class CacheableiVal (caches=None, did=None, dids=None)-
Expand source code
class CacheableiVal(iVal): replace: callable deps: dict def __init__(self, caches=None, did=None, dids=None): self.caches = caches self.did = did self.dids = dids def withcaches(self, caches, did, dids): # Only set cache on cacheless CacheableiVal objects if self.caches is None: return self.replace(caches=caches, did=did, dids=dids) return self def __repr__(self): if not self.isevaluated: lst = (k + ("" if dep.isevaluated else f"={repr(dep)}") for k, dep in self.deps.items()) return f"λ({' '.join(lst)})" return repr(self.value)Ancestors
Subclasses
Class variables
var deps : dictvar replace :
Methods
def withcaches(self, caches, did, dids)-
Expand source code
def withcaches(self, caches, did, dids): # Only set cache on cacheless CacheableiVal objects if self.caches is None: return self.replace(caches=caches, did=did, dids=dids) return self
Inherited members