Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass types.
(self, args: dict)
| 393 | return self.common_parse(args, return_remaining_strings) |
| 394 | |
| 395 | def parse_dict(self, args: dict) -> Tuple[DataClass, ...]: |
| 396 | """ |
| 397 | Alternative helper method that does not use `argparse` at all, instead uses a dict and populating the dataclass |
| 398 | types. |
| 399 | """ |
| 400 | outputs = [] |
| 401 | for dtype in self.dataclass_types: |
| 402 | keys = {f.name for f in dataclasses.fields(dtype) if f.init} |
| 403 | inputs = {k: v for k, v in args.items() if k in keys} |
| 404 | obj = dtype(**inputs) |
| 405 | outputs.append(obj) |
| 406 | return (*outputs,) |
| 407 | |
| 408 | |
| 409 | def get_config(config_path=None, **kwargs): |
no outgoing calls
no test coverage detected