Skip to content

Commit 9027cde

Browse files
Factorize the typing
1 parent b3fea0d commit 9027cde

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pylint/config/config_file_parser.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
if TYPE_CHECKING:
2323
from pylint.lint import PyLinter
2424

25+
PylintConfigFileData = tuple[dict[str, str], list[str]]
26+
2527

2628
class _RawConfParser:
2729
"""Class to parse various formats of configuration files."""
2830

2931
@staticmethod
30-
def parse_ini_file(file_path: Path) -> tuple[dict[str, str], list[str]]:
32+
def parse_ini_file(file_path: Path) -> PylintConfigFileData:
3133
"""Parse and handle errors of an ini configuration file.
3234
3335
Raises ``configparser.Error``.
@@ -58,7 +60,7 @@ def _ini_file_with_sections(file_path: Path) -> bool:
5860
return False
5961

6062
@staticmethod
61-
def parse_toml_file(file_path: Path) -> tuple[dict[str, str], list[str]]:
63+
def parse_toml_file(file_path: Path) -> PylintConfigFileData:
6264
"""Parse and handle errors of a toml configuration file.
6365
6466
Raises ``tomllib.TOMLDecodeError``.
@@ -87,7 +89,7 @@ def parse_toml_file(file_path: Path) -> tuple[dict[str, str], list[str]]:
8789
@staticmethod
8890
def parse_config_file(
8991
file_path: Path | None, verbose: bool
90-
) -> tuple[dict[str, str], list[str]]:
92+
) -> PylintConfigFileData:
9193
"""Parse a config file and return str-str pairs.
9294
9395
Raises ``tomllib.TOMLDecodeError``, ``configparser.Error``.
@@ -118,9 +120,7 @@ def __init__(self, verbose: bool, linter: PyLinter) -> None:
118120
self.verbose_mode = verbose
119121
self.linter = linter
120122

121-
def parse_config_file(
122-
self, file_path: Path | None
123-
) -> tuple[dict[str, str], list[str]]:
123+
def parse_config_file(self, file_path: Path | None) -> PylintConfigFileData:
124124
"""Parse a config file and return str-str pairs."""
125125
try:
126126
return _RawConfParser.parse_config_file(file_path, self.verbose_mode)

0 commit comments

Comments
 (0)