Resolve strings to objects using standard import and attribute syntax.
(self, s)
| 391 | self.config.configurator = self |
| 392 | |
| 393 | def resolve(self, s): |
| 394 | """ |
| 395 | Resolve strings to objects using standard import and attribute |
| 396 | syntax. |
| 397 | """ |
| 398 | name = s.split('.') |
| 399 | used = name.pop(0) |
| 400 | try: |
| 401 | found = self.importer(used) |
| 402 | for frag in name: |
| 403 | used += '.' + frag |
| 404 | try: |
| 405 | found = getattr(found, frag) |
| 406 | except AttributeError: |
| 407 | self.importer(used) |
| 408 | found = getattr(found, frag) |
| 409 | return found |
| 410 | except ImportError as e: |
| 411 | v = ValueError('Cannot resolve %r: %s' % (s, e)) |
| 412 | raise v from e |
| 413 | |
| 414 | def ext_convert(self, value): |
| 415 | """Default converter for the ext:// protocol.""" |
no test coverage detected