fix: resolve CI linting and type checking issues
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
|
||||
class ConversionError(Exception):
|
||||
@@ -18,11 +18,11 @@ class BaseConverter(ABC):
|
||||
FILE_EXTENSIONS: list[str] = []
|
||||
|
||||
@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."""
|
||||
|
||||
@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."""
|
||||
|
||||
@abstractmethod
|
||||
@@ -62,7 +62,7 @@ class BaseConverter(ABC):
|
||||
return ["json", "yaml", "yml", "toml", "ini"]
|
||||
|
||||
@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."""
|
||||
ext = Path(filepath).suffix.lower().lstrip(".")
|
||||
format_map: Dict[str, str] = {
|
||||
|
||||
Reference in New Issue
Block a user