diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-12-16 15:31:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 15:31:08 +0000 |
commit | 30322c497e0b8d978f7a0de95985aac9c5daf1ac (patch) | |
tree | 4fb3f46fa7b17cdfc21157b426e5b2e2ec1443bb /Lib/argparse.py | |
parent | d6e13747161d7b634b47d2d3d212ed3be4a21fab (diff) | |
download | cpython-30322c497e0b8d978f7a0de95985aac9c5daf1ac.tar.gz cpython-30322c497e0b8d978f7a0de95985aac9c5daf1ac.zip |
bpo-22047: [argparse] deprecate nested argument groups and mutually exclusive groups (GH-30098)
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r-- | Lib/argparse.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 8a81801ba92..de95eedbee0 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -89,6 +89,8 @@ import os as _os import re as _re import sys as _sys +import warnings + from gettext import gettext as _, ngettext SUPPRESS = '==SUPPRESS==' @@ -1648,6 +1650,14 @@ class _ArgumentGroup(_ActionsContainer): super(_ArgumentGroup, self)._remove_action(action) self._group_actions.remove(action) + def add_argument_group(self, *args, **kwargs): + warnings.warn( + "Nesting argument groups is deprecated.", + category=DeprecationWarning, + stacklevel=2 + ) + return super().add_argument_group(*args, **kwargs) + class _MutuallyExclusiveGroup(_ArgumentGroup): @@ -1668,6 +1678,14 @@ class _MutuallyExclusiveGroup(_ArgumentGroup): self._container._remove_action(action) self._group_actions.remove(action) + def add_mutually_exclusive_group(self, *args, **kwargs): + warnings.warn( + "Nesting mutually exclusive groups is deprecated.", + category=DeprecationWarning, + stacklevel=2 + ) + return super().add_mutually_exclusive_group(*args, **kwargs) + class ArgumentParser(_AttributeHolder, _ActionsContainer): """Object for parsing command line strings into Python objects. |