From cd2cc703c9a545901357479b4d93e8856375ad34 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Wed, 4 Feb 2026 22:07:55 +0000 Subject: [PATCH] fix: resolve CI linting and type checking issues --- config_converter/converters/ini_converter.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/config_converter/converters/ini_converter.py b/config_converter/converters/ini_converter.py index 0996d68..1d79083 100644 --- a/config_converter/converters/ini_converter.py +++ b/config_converter/converters/ini_converter.py @@ -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] = {}