Add symbols from self into a dictionary and return the dict. This is used for import-like syntax: see `import_`.
(self, *args, **kwargs)
| 153 | return wrapper |
| 154 | |
| 155 | def inject(self, *args, **kwargs): |
| 156 | """ |
| 157 | Add symbols from self into a dictionary and return the dict. |
| 158 | |
| 159 | This is used for import-like syntax: see `import_`. |
| 160 | """ |
| 161 | rval = {} |
| 162 | for k in args: |
| 163 | try: |
| 164 | rval[k] = getattr(self, k) |
| 165 | except AttributeError: |
| 166 | raise PyllImportError(k) |
| 167 | for k, origk in list(kwargs.items()): |
| 168 | try: |
| 169 | rval[k] = getattr(self, origk) |
| 170 | except AttributeError: |
| 171 | raise PyllImportError(origk) |
| 172 | return rval |
| 173 | |
| 174 | def import_(self, _globals, *args, **kwargs): |
| 175 | _globals.update(self.inject(*args, **kwargs)) |
no test coverage detected