MCPcopy Create free account
hub / github.com/clips/pattern / _lazy

Method _lazy

pattern/text/__init__.py:110–117  ·  view source on GitHub ↗

If the dictionary is empty, calls lazydict.load(). Replaces lazydict.method() with dict.method() and calls it.

(self, method, *args)

Source from the content-addressed store, hash-verified

108 pass
109
110 def _lazy(self, method, *args):
111 """ If the dictionary is empty, calls lazydict.load().
112 Replaces lazydict.method() with dict.method() and calls it.
113 """
114 if dict.__len__(self) == 0:
115 self.load()
116 setattr(self, method, types.MethodType(getattr(dict, method), self))
117 return getattr(dict, method)(self, *args)
118
119 def __repr__(self):
120 return self._lazy("__repr__")

Callers 14

__repr__Method · 0.95
__len__Method · 0.95
__iter__Method · 0.95
__contains__Method · 0.95
__getitem__Method · 0.95
__setitem__Method · 0.95
setdefaultMethod · 0.95
getMethod · 0.95
itemsMethod · 0.95
keysMethod · 0.95
valuesMethod · 0.95
updateMethod · 0.95

Calls 2

loadMethod · 0.95
__len__Method · 0.45

Tested by

no test coverage detected