fix: resolve CI linting and type checking issues
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-04 22:07:51 +00:00
parent 78d5596531
commit aa7f9ff532

View File

@@ -2,7 +2,7 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from pathlib import Path from pathlib import Path
from typing import Any, Dict, Optional from typing import Any, Dict, Optional, Union
class ConversionError(Exception): class ConversionError(Exception):
@@ -18,11 +18,11 @@ class BaseConverter(ABC):
FILE_EXTENSIONS: list[str] = [] FILE_EXTENSIONS: list[str] = []
@abstractmethod @abstractmethod
def read(self, source: str | Path) -> Dict[str, Any]: def read(self, source: Union[str, Path]) -> Dict[str, Any]:
"""Read and parse a configuration file.""" """Read and parse a configuration file."""
@abstractmethod @abstractmethod
def write(self, data: Dict[str, Any], target: str | Path) -> None: def write(self, data: Dict[str, Any], target: Union[str, Path]) -> None:
"""Write configuration data to a file.""" """Write configuration data to a file."""
@abstractmethod @abstractmethod
@@ -62,7 +62,7 @@ class BaseConverter(ABC):
return ["json", "yaml", "yml", "toml", "ini"] return ["json", "yaml", "yml", "toml", "ini"]
@classmethod @classmethod
def guess_format(cls, filepath: str | Path) -> Optional[str]: def guess_format(cls, filepath: Union[str, Path]) -> Optional[str]:
"""Guess format from file extension.""" """Guess format from file extension."""
ext = Path(filepath).suffix.lower().lstrip(".") ext = Path(filepath).suffix.lower().lstrip(".")
format_map: Dict[str, str] = { format_map: Dict[str, str] = {