(self)
| 159 | super(LazyLoader, self).__init__(name) |
| 160 | |
| 161 | def _load(self): |
| 162 | # Import the target module and insert it into the parent's namespace |
| 163 | module = importlib.import_module(self.__name__) |
| 164 | self._parent_module_globals[self._local_name] = module |
| 165 | |
| 166 | # Update this object's dict so that if someone keeps a reference to the |
| 167 | # LazyLoader, lookups are efficient (__getattr__ is only called on lookups |
| 168 | # that fail). |
| 169 | self.__dict__.update(module.__dict__) |
| 170 | |
| 171 | return module |
| 172 | |
| 173 | def __getattr__(self, item): |
| 174 | module = self._load() |
no test coverage detected