MCPcopy Index your code
hub / github.com/LabPy/lantz / get_cache

Method get_cache

lantz/feat.py:369–381  ·  view source on GitHub ↗
(self, instance, key=MISSING)

Source from the content-addressed store, hash-verified

367 raise AttributeError('{} is a permanent attribute from {}', self.name, instance.__class__.__name__)
368
369 def get_cache(self, instance, key=MISSING):
370 keys = _dget(self.modifiers, instance, key)['keys']
371 if instance not in self.value:
372 self.value[instance] = dict()
373 if isinstance(keys, dict):
374 keys = keys.values()
375 if keys and key not in keys:
376 raise KeyError('{} is not valid key for {} {}'.format(key, self.name,
377 keys))
378 if key is MISSING:
379 return self.value[instance]
380 else:
381 return self.value[instance].get(key, MISSING)
382
383 def set_cache(self, instance, value, key=MISSING):
384 old_value = self.get_cache(instance, key)

Callers 1

set_cacheMethod · 0.95

Calls 3

getMethod · 0.80
_dgetFunction · 0.70
valuesMethod · 0.45

Tested by

no test coverage detected