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:
@@ -1,7 +1,7 @@
|
|||||||
"""YAML format converter."""
|
"""YAML format converter."""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ class YamlConverter(BaseConverter):
|
|||||||
FORMAT_NAME = "yaml"
|
FORMAT_NAME = "yaml"
|
||||||
FILE_EXTENSIONS = ["yaml", "yml"]
|
FILE_EXTENSIONS = ["yaml", "yml"]
|
||||||
|
|
||||||
def read(self, source: str | Path) -> Dict[str, Any]:
|
def read(self, source: Union[str, Path]) -> Dict[str, Any]:
|
||||||
"""Read and parse a YAML configuration file."""
|
"""Read and parse a YAML configuration file."""
|
||||||
try:
|
try:
|
||||||
with open(source, "r", encoding="utf-8") as f:
|
with open(source, "r", encoding="utf-8") as f:
|
||||||
@@ -26,7 +26,7 @@ class YamlConverter(BaseConverter):
|
|||||||
except PermissionError as e:
|
except PermissionError as e:
|
||||||
raise ConversionError(f"Permission denied: {source}") from e
|
raise ConversionError(f"Permission denied: {source}") from e
|
||||||
|
|
||||||
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 YAML file."""
|
"""Write configuration data to a YAML file."""
|
||||||
try:
|
try:
|
||||||
with open(target, "w", encoding="utf-8") as f:
|
with open(target, "w", encoding="utf-8") as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user