Method: pylint.config.arguments_provider._ArgumentsProvider.options_by_section
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
tuple (3)
1def options_by_section(
2 self,
3 ) -> Iterator[
4 tuple[str, list[tuple[str, OptionDict, Any]]]
5 | tuple[None, dict[str, list[tuple[str, OptionDict, Any]]]]
6 ]: # pragma: no cover
7 """DEPRECATED: Return an iterator on options grouped by section.
8
9 (section, [list of (optname, optdict, optvalue)])
10 """
11 # TODO 3.0: Make this function private see
12 # https://github.com/PyCQA/pylint/pull/6665#discussion_r880143229
13 # It's only used in '_get_global_options_documentation'
14 warnings.warn(
15 "options_by_section has been deprecated. It will be removed "
16 "in a future release.",
17 DeprecationWarning,
18 stacklevel=2,
19 )
20 sections: dict[str, list[tuple[str, OptionDict, Any]]] = {}
21 for optname, optdict in self.options:
22 with warnings.catch_warnings():
23 warnings.filterwarnings("ignore", category=DeprecationWarning)
24 sections.setdefault(optdict.get("group"), []).append( # type: ignore[arg-type]
25 (optname, optdict, self.option_value(optname))
26 )
27 if None in sections:
28 yield None, sections.pop(None) # type: ignore[call-overload]
29 for section, options in sorted(sections.items()):
30 yield section.upper(), options