Method: pylint.config.config_file_parser._ConfigurationFileParser.parse_config_file
Calls: 1078, Exceptions: 2, Paths: 7Back
Path 1: 1050 calls (0.97)
PosixPath (1050)
tuple (1050)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 2: 17 calls (0.02)
PosixPath (17)
tuple (17)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 3: 5 calls (0.0)
None (5)
tuple (5)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 4: 2 calls (0.0)
PosixPath (2)
tuple (2)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 5: 2 calls (0.0)
None (2)
tuple (2)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 6: 1 calls (0.0)
PosixPath (1)
OSError (1)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []
Path 7: 1 calls (0.0)
PosixPath (1)
tuple (1)
InterpolationSyntaxError (1)
1def parse_config_file(
2 self, file_path: Path | None
3 ) -> tuple[dict[str, str], list[str]]:
4 """Parse a config file and return str-str pairs."""
5 if file_path is None:
6 if self.verbose_mode:
7 print(
8 "No config file found, using default configuration", file=sys.stderr
9 )
10 return {}, []
11
12 file_path = Path(os.path.expandvars(file_path)).expanduser()
13 if not file_path.exists():
14 raise OSError(f"The config file {file_path} doesn't exist!")
15
16 if self.verbose_mode:
17 print(f"Using config file {file_path}", file=sys.stderr)
18
19 try:
20 if file_path.suffix == ".toml":
21 return self._parse_toml_file(file_path)
22 return self._parse_ini_file(file_path)
23 except (configparser.Error, tomllib.TOMLDecodeError) as e:
24 self.linter.add_message("config-parse-error", line=0, args=str(e))
25 return {}, []