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:55 +00:00
parent 9fa78968d3
commit cd2cc703c9

View File

@@ -1,9 +1,8 @@
"""INI format converter."""
import re
from configparser import ConfigParser, RawConfigParser
from pathlib import Path
from typing import Any, Dict, Optional
from typing import Any, Dict, Union
from config_converter.converters.base import BaseConverter, ConversionError
@@ -40,7 +39,7 @@ class IniConverter(BaseConverter):
FORMAT_NAME = "ini"
FILE_EXTENSIONS = ["ini", "cfg"]
def read(self, source: str | Path) -> Dict[str, Any]:
def read(self, source: Union[str, Path]) -> Dict[str, Any]:
"""Read and parse an INI configuration file."""
try:
config = RawConfigParser(allow_no_value=True)
@@ -69,7 +68,7 @@ class IniConverter(BaseConverter):
except Exception as e:
raise ConversionError(f"Invalid INI in {source}: {e}") 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 an INI file."""
try:
config = ConfigParser()
@@ -89,8 +88,6 @@ class IniConverter(BaseConverter):
def parse(self, content: str) -> Dict[str, Any]:
"""Parse INI content from a string."""
try:
from io import StringIO
config = RawConfigParser(allow_no_value=True)
config.read_string(content)
result: Dict[str, Any] = {}