Builds a config from the given list of arguments.
(cls, *args, **kwargs)
| 348 | |
| 349 | @classmethod |
| 350 | def from_args(cls, *args, **kwargs): |
| 351 | """Builds a config from the given list of arguments.""" |
| 352 | # Note we intend to keep `__annotations__` instead of `_get_annotations`. |
| 353 | # Assuming a parent class of (a, b) with the sub-class of (c, d), the |
| 354 | # sub-class will take (c, d) for args, rather than starting from (a, b). |
| 355 | attributes = list(cls.__annotations__.keys()) |
| 356 | default_params = {a: p for a, p in zip(attributes, args)} |
| 357 | default_params.update(kwargs) |
| 358 | return cls(default_params=default_params) |