Sets the class to use when the base class is instantiated. Keyword arguments will be saved and added to the arguments passed to the constructor. This can be used to set global defaults for some parameters.
(cls, impl, **kwargs)
| 308 | |
| 309 | @classmethod |
| 310 | def configure(cls, impl, **kwargs): |
| 311 | # type: (Union[None, str, Type[Configurable]], Any) -> None |
| 312 | """Sets the class to use when the base class is instantiated. |
| 313 | |
| 314 | Keyword arguments will be saved and added to the arguments passed |
| 315 | to the constructor. This can be used to set global defaults for |
| 316 | some parameters. |
| 317 | """ |
| 318 | base = cls.configurable_base() |
| 319 | if isinstance(impl, str): |
| 320 | impl = typing.cast(Type[Configurable], import_object(impl)) |
| 321 | if impl is not None and not issubclass(impl, cls): |
| 322 | raise ValueError("Invalid subclass of %s" % cls) |
| 323 | base.__impl_class = impl |
| 324 | base.__impl_kwargs = kwargs |
| 325 | |
| 326 | @classmethod |
| 327 | def configured_class(cls): |
nothing calls this directly
no test coverage detected