(*, data: bytes | str | None = None, path: Path)
| 13 | |
| 14 | |
| 15 | def create_config(*, data: bytes | str | None = None, path: Path) -> BaseConfig: |
| 16 | if "toml" in path.suffix: |
| 17 | return TomlConfig(data=data or "", path=path) |
| 18 | if "json" in path.suffix: |
| 19 | return JsonConfig(data=data or "{}", path=path) |
| 20 | if "yaml" in path.suffix: |
| 21 | return YAMLConfig(data=data or "", path=path) |
| 22 | |
| 23 | # Should be unreachable. See the constant CONFIG_FILES. |
| 24 | raise ValueError( |
| 25 | f"Unsupported config file: {path.name} due to unknown file extension" |
| 26 | ) |
no test coverage detected
searching dependent graphs…