gh-125542: Deprecate prefix_chars in ArgumentParser.add_argument_group() (GH-125563)

This commit is contained in:
Savannah Ostrowski 2024-10-17 02:11:47 -07:00 committed by GitHub
parent 624be8699a
commit 7b04496e5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 52 additions and 2 deletions

View file

@ -1662,6 +1662,14 @@ class _ActionsContainer(object):
class _ArgumentGroup(_ActionsContainer):
def __init__(self, container, title=None, description=None, **kwargs):
if 'prefix_chars' in kwargs:
import warnings
depr_msg = (
"The use of the undocumented 'prefix_chars' parameter in "
"ArgumentParser.add_argument_group() is deprecated."
)
warnings.warn(depr_msg, DeprecationWarning, stacklevel=3)
# add any missing keyword arguments by checking the container
update = kwargs.setdefault
update('conflict_handler', container.conflict_handler)