GH-127133: Remove ability to nest argument groups & mutually exclusive groups (#127186)

This commit is contained in:
Savannah Ostrowski 2024-11-24 07:20:37 -08:00 committed by GitHub
parent f7bb658124
commit 2104bde572
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 95 deletions

View file

@ -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: