Load the config from a file and return it as a Config object.
(self)
| 563 | """ |
| 564 | |
| 565 | def load_config(self) -> Config: |
| 566 | """Load the config from a file and return it as a Config object.""" |
| 567 | self.clear() |
| 568 | try: |
| 569 | self._find_file() |
| 570 | except OSError as e: |
| 571 | raise ConfigFileNotFound(str(e)) from e |
| 572 | dct = self._read_file_as_dict() |
| 573 | self.config = self._convert_to_config(dct) |
| 574 | return self.config |
| 575 | |
| 576 | def _read_file_as_dict(self) -> dict[str, t.Any]: |
| 577 | with open(self.full_filename) as f: |