Load the configuration, merging user options with default values.
(self, user_opt=None)
| 668 | raise ValueError(f"Unknown config keys: {unknown_keys}") |
| 669 | |
| 670 | def load(self, user_opt=None) -> config: |
| 671 | """ |
| 672 | Load the configuration, merging user options with default values. |
| 673 | """ |
| 674 | if user_opt is None: |
| 675 | user_dict = {} |
| 676 | elif isinstance(user_opt, config): |
| 677 | user_dict = vars(user_opt) |
| 678 | elif isinstance(user_opt, dict): |
| 679 | user_dict = user_opt |
| 680 | else: |
| 681 | raise TypeError("user_opt must be dict, config(SimpleNamespace) or None") |
| 682 | |
| 683 | self._validate_keys(user_dict) |
| 684 | merged = {**self._default_dict, **user_dict} |
| 685 | return config(**merged) |
| 686 | |
| 687 | def create_node_mapping(tree): |
| 688 | """Create a flat dict mapping node_id to node for quick lookup.""" |
no test coverage detected