|
10 | 10 | import os
|
11 | 11 | import sys
|
12 | 12 | from pathlib import Path
|
13 |
| -from typing import TYPE_CHECKING |
| 13 | +from typing import TYPE_CHECKING, Dict, List, Tuple |
14 | 14 |
|
15 | 15 | from pylint.config.utils import _parse_rich_type_value
|
16 | 16 |
|
|
22 | 22 | if TYPE_CHECKING:
|
23 | 23 | from pylint.lint import PyLinter
|
24 | 24 |
|
| 25 | +PylintConfigFileData = Tuple[Dict[str, str], List[str]] |
| 26 | + |
25 | 27 |
|
26 | 28 | class _RawConfParser:
|
27 | 29 | """Class to parse various formats of configuration files."""
|
28 | 30 |
|
29 | 31 | @staticmethod
|
30 |
| - def parse_ini_file(file_path: Path) -> tuple[dict[str, str], list[str]]: |
| 32 | + def parse_ini_file(file_path: Path) -> PylintConfigFileData: |
31 | 33 | """Parse and handle errors of an ini configuration file.
|
32 | 34 |
|
33 | 35 | Raises ``configparser.Error``.
|
@@ -58,7 +60,7 @@ def _ini_file_with_sections(file_path: Path) -> bool:
|
58 | 60 | return False
|
59 | 61 |
|
60 | 62 | @staticmethod
|
61 |
| - def parse_toml_file(file_path: Path) -> tuple[dict[str, str], list[str]]: |
| 63 | + def parse_toml_file(file_path: Path) -> PylintConfigFileData: |
62 | 64 | """Parse and handle errors of a toml configuration file.
|
63 | 65 |
|
64 | 66 | Raises ``tomllib.TOMLDecodeError``.
|
@@ -87,7 +89,7 @@ def parse_toml_file(file_path: Path) -> tuple[dict[str, str], list[str]]:
|
87 | 89 | @staticmethod
|
88 | 90 | def parse_config_file(
|
89 | 91 | file_path: Path | None, verbose: bool
|
90 |
| - ) -> tuple[dict[str, str], list[str]]: |
| 92 | + ) -> PylintConfigFileData: |
91 | 93 | """Parse a config file and return str-str pairs.
|
92 | 94 |
|
93 | 95 | Raises ``tomllib.TOMLDecodeError``, ``configparser.Error``.
|
@@ -118,9 +120,7 @@ def __init__(self, verbose: bool, linter: PyLinter) -> None:
|
118 | 120 | self.verbose_mode = verbose
|
119 | 121 | self.linter = linter
|
120 | 122 |
|
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: |
124 | 124 | """Parse a config file and return str-str pairs."""
|
125 | 125 | try:
|
126 | 126 | return _RawConfParser.parse_config_file(file_path, self.verbose_mode)
|
|
0 commit comments