Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/checkmk_weblate_syncer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from pathlib import Path
from typing import TypeVar, assert_never
from typing import assert_never

from .cli import Mode, parse_arguments
from .config import UpdateSourcesConfig, UpdateTranslationsConfig
Expand Down Expand Up @@ -29,10 +29,10 @@ def main() -> int:
if __name__ == "__main__":
sys.exit(main())

_ConfigTypeT = TypeVar("_ConfigTypeT", UpdateSourcesConfig, UpdateTranslationsConfig)


def _load_config(config_path: Path, config_type: type[_ConfigTypeT]) -> _ConfigTypeT:
def _load_config[T: (UpdateSourcesConfig, UpdateTranslationsConfig)](
config_path: Path, config_type: type[T]
) -> T:
try:
return config_type.model_validate_json(config_path.read_text())
except Exception:
Expand Down
Loading