(self, dictionary: dict[str, t.Any])
| 578 | return t.cast("dict[str, t.Any]", json.load(f)) |
| 579 | |
| 580 | def _convert_to_config(self, dictionary: dict[str, t.Any]) -> Config: |
| 581 | if "version" in dictionary: |
| 582 | version = dictionary.pop("version") |
| 583 | else: |
| 584 | version = 1 |
| 585 | |
| 586 | if version == 1: |
| 587 | return Config(dictionary) |
| 588 | else: |
| 589 | raise ValueError(f"Unknown version of JSON config file: {version}") |
| 590 | |
| 591 | def __enter__(self) -> Config: |
| 592 | self.load_config() |