Configure an object with a user-supplied factory.
(self, config)
| 478 | return value |
| 479 | |
| 480 | def configure_custom(self, config): |
| 481 | """Configure an object with a user-supplied factory.""" |
| 482 | c = config.pop('()') |
| 483 | if not callable(c): |
| 484 | c = self.resolve(c) |
| 485 | # Check for valid identifiers |
| 486 | kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))} |
| 487 | result = c(**kwargs) |
| 488 | props = config.pop('.', None) |
| 489 | if props: |
| 490 | for name, value in props.items(): |
| 491 | setattr(result, name, value) |
| 492 | return result |
| 493 | |
| 494 | def as_tuple(self, value): |
| 495 | """Utility function which converts lists to tuples.""" |
no test coverage detected