mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
GH-127133: Remove ability to nest argument groups & mutually exclusive groups (#127186)
This commit is contained in:
parent
f7bb658124
commit
2104bde572
5 changed files with 41 additions and 95 deletions
|
@ -1709,14 +1709,7 @@ class _ArgumentGroup(_ActionsContainer):
|
|||
self._group_actions.remove(action)
|
||||
|
||||
def add_argument_group(self, *args, **kwargs):
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"Nesting argument groups is deprecated.",
|
||||
category=DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return super().add_argument_group(*args, **kwargs)
|
||||
|
||||
raise ValueError('argument groups cannot be nested')
|
||||
|
||||
class _MutuallyExclusiveGroup(_ArgumentGroup):
|
||||
|
||||
|
@ -1737,15 +1730,8 @@ class _MutuallyExclusiveGroup(_ArgumentGroup):
|
|||
self._container._remove_action(action)
|
||||
self._group_actions.remove(action)
|
||||
|
||||
def add_mutually_exclusive_group(self, *args, **kwargs):
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"Nesting mutually exclusive groups is deprecated.",
|
||||
category=DeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return super().add_mutually_exclusive_group(*args, **kwargs)
|
||||
|
||||
def add_mutually_exclusive_group(self, **kwargs):
|
||||
raise ValueError('mutually exclusive groups cannot be nested')
|
||||
|
||||
def _prog_name(prog=None):
|
||||
if prog is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue