Method: pylint.config.arguments_manager._ArgumentsManager.add_option_group
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
'' (1)
None (1)
list (1)
SampleChecker (1)
1def add_option_group(
2 self,
3 group_name: str,
4 _: str | None,
5 options: list[tuple[str, OptionDict]],
6 provider: ConfigProvider,
7 ) -> None: # pragma: no cover
8 """DEPRECATED."""
9 warnings.warn(
10 "add_option_group has been deprecated. Option groups should be "
11 "registered by initializing ArgumentsProvider. "
12 "This automatically registers the group on the ArgumentsManager.",
13 DeprecationWarning,
14 stacklevel=2,
15 )
16 # add option group to the command line parser
17 if group_name in self._mygroups:
18 group = self._mygroups[group_name]
19 else:
20 group = optparse.OptionGroup(
21 self.cmdline_parser, title=group_name.capitalize()
22 )
23 self.cmdline_parser.add_option_group(group)
24 self._mygroups[group_name] = group
25 # add section to the config file
26 if (
27 group_name != "DEFAULT"
28 and group_name not in self.cfgfile_parser._sections # type: ignore[attr-defined]
29 ):
30 self.cfgfile_parser.add_section(group_name)
31 # add provider's specific options
32 for opt, optdict in options:
33 if not isinstance(optdict.get("action", "store"), str):
34 optdict["action"] = "callback"
35 with warnings.catch_warnings():
36 warnings.filterwarnings("ignore", category=DeprecationWarning)
37 self.add_optik_option(provider, group, opt, optdict)