If the dictionary is empty, calls lazydict.load(). Replaces lazydict.method() with dict.method() and calls it.
(self, method, *args)
| 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__") |
no test coverage detected