Method: pylint.utils.utils._ini_format
Calls: 37, Exceptions: 0, Paths: 6Back
Path 1: 21 calls (0.57)
StringIO (21)
list (21)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)
Path 2: 6 calls (0.16)
StringIO (6)
list (6)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)
Path 3: 4 calls (0.11)
StringIO (4)
list (4)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)
Path 4: 2 calls (0.05)
StringIO (2)
list (2)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)
Path 5: 2 calls (0.05)
StringIO (2)
list (2)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)
Path 6: 2 calls (0.05)
StringIO (2)
list (2)
1def _ini_format(stream: TextIO, options: list[tuple[str, OptionDict, Any]]) -> None:
2 """Format options using the INI format."""
3 warnings.warn(
4 "_ini_format has been deprecated. It will be removed in pylint 3.0.",
5 DeprecationWarning,
6 stacklevel=2,
7 )
8 for optname, optdict, value in options:
9 # Skip deprecated option
10 if "kwargs" in optdict:
11 assert isinstance(optdict["kwargs"], dict)
12 if "new_names" in optdict["kwargs"]:
13 continue
14 value = _format_option_value(optdict, value)
15 help_opt = optdict.get("help")
16 if help_opt:
17 assert isinstance(help_opt, str)
18 help_opt = normalize_text(help_opt, indent="# ")
19 print(file=stream)
20 print(help_opt, file=stream)
21 else:
22 print(file=stream)
23 if value in {"None", "False"}:
24 print(f"#{optname}=", file=stream)
25 else:
26 value = str(value).strip()
27 if re.match(r"^([\w-]+,)+[\w-]+$", str(value)):
28 separator = "\n " + " " * len(optname)
29 value = separator.join(x + "," for x in str(value).split(","))
30 # remove trailing ',' from last element of the list
31 value = value[:-1]
32 print(f"{optname}={value}", file=stream)