pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/125563.patch

/Doc/whatsnew/3.14.rst index c1f1e7651b3950..1111a7fc405ec0 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -421,7 +421,7 @@ Deprecated ========== * :mod:`argparse`: - Passing the prefix_chars_ parameter to :meth:`add_argument_group` + Passing *prefix_chars* to :meth:`argparse.add_argument_group` is now deprecated. (Contributed by Savannah Ostrowski in :gh:`125563`.) From 86d91eff3a627cf4bf3cebce3cc9b0c514f8de8c Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Tue, 15 Oct 2024 22:23:13 -0700 Subject: [PATCH 08/12] Update deprecation in docs for consistency --- Doc/library/argparse.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index ea6e8973c78121..9862790b4cb8fe 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1869,7 +1869,7 @@ Argument groups will be removed in the future. .. versionchanged:: 3.14 - Passing the prefix_chars_ parameter to :meth:`add_argument_group` + Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated. From 5897e0ac5e9798be122585ab4658335554ecbca1 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Tue, 15 Oct 2024 22:30:52 -0700 Subject: [PATCH 09/12] Use func --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 1111a7fc405ec0..c74e5ead5cdb6c 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -421,7 +421,7 @@ Deprecated ========== * :mod:`argparse`: - Passing *prefix_chars* to :meth:`argparse.add_argument_group` + Passing *prefix_chars* to :func:`argparse.add_argument_group` is now deprecated. (Contributed by Savannah Ostrowski in :gh:`125563`.) From 3d0ddf3d2e50b73e2cb7065f6bdfa90f46340f73 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Wed, 16 Oct 2024 19:45:24 -0700 Subject: [PATCH 10/12] Address PR comments --- .../pending-removal-in-future.rst | 9 ++++++-- Doc/library/argparse.rst | 2 +- Doc/whatsnew/3.14.rst | 5 +++-- Lib/argparse.py | 2 +- Lib/test/test_argparse.py | 21 +++++++------------ ...-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst | 3 ++- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Doc/deprecations/pending-removal-in-future.rst b/Doc/deprecations/pending-removal-in-future.rst index f916797c07a068..d77fc86eab0ed6 100644 --- a/Doc/deprecations/pending-removal-in-future.rst +++ b/Doc/deprecations/pending-removal-in-future.rst @@ -4,8 +4,13 @@ Pending removal in future versions The following APIs will be removed in the future, although there is currently no date scheduled for their removal. -* :mod:`argparse`: Nesting argument groups and nesting mutually exclusive - groups are deprecated. +* :mod:`argparse`: + + * Nesting argument groups and nesting mutually exclusive + groups are deprecated. + * Passing the undocumented keyword argument *prefix_chars* to + :meth:`~argparse.ArgumentParser.add_argument_group` is now + deprecated. * :mod:`array`'s ``'u'`` format code (:gh:`57281`) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index 9862790b4cb8fe..a72c391c0ddf4e 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1868,7 +1868,7 @@ Argument groups The function exists on the API by accident through inheritance and will be removed in the future. - .. versionchanged:: 3.14 + .. deprecated:: 3.14 Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated. diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index c74e5ead5cdb6c..3bbbdc778328b5 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -421,8 +421,9 @@ Deprecated ========== * :mod:`argparse`: - Passing *prefix_chars* to :func:`argparse.add_argument_group` - is now deprecated. + Passing the undocumented keyword argument *prefix_chars* to + :meth:`~argparse.ArgumentParser.add_argument_group` is now + deprecated. (Contributed by Savannah Ostrowski in :gh:`125563`.) * :mod:`asyncio`: diff --git a/Lib/argparse.py b/Lib/argparse.py index 4c227077512b7b..10c7d0f7e63295 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1666,7 +1666,7 @@ def __init__(self, container, title=None, description=None, **kwargs): import warnings depr_msg = ( "The use of the undocumented 'prefix_chars' parameter in " - "ArgumentParser.add_argument_group is deprecated." + "ArgumentParser.add_argument_group() is deprecated." ) warnings.warn(depr_msg, DeprecationWarning, stacklevel=3) diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 39702a6e0330e9..d39bd8dba628ea 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2819,32 +2819,27 @@ def test_interleaved_groups(self): class TestGroupConstructor(TestCase): def test_group_prefix_chars(self): parser = ErrorRaisingArgumentParser() - msg = ( "The use of the undocumented 'prefix_chars' parameter in " - "ArgumentParser.add_argument_group is deprecated." + "ArgumentParser.add_argument_group() is deprecated." ) - with self.assertWarnsRegex(DeprecationWarning, msg): + with self.assertWarns(DeprecationWarning) as cm: parser.add_argument_group(prefix_chars='-+') + self.assertEqual(msg, str(cm.warning)) + self.assertEqual(cm.filename, __file__) def test_group_prefix_chars_default(self): # "default" isn't quite the right word here, but it's the same as # the parser's default prefix so it's a good test parser = ErrorRaisingArgumentParser() - msg = ( "The use of the undocumented 'prefix_chars' parameter in " - "ArgumentParser.add_argument_group is deprecated." + "ArgumentParser.add_argument_group() is deprecated." ) - - with self.assertWarnsRegex(DeprecationWarning, msg): + with self.assertWarns(DeprecationWarning) as cm: parser.add_argument_group(prefix_chars='-') - - def test_group_without_prefix_chars(self): - parser = ErrorRaisingArgumentParser() - group = parser.add_argument_group() - group.add_argument('--foo') - self.assertEqual(parser.parse_args(['--foo', 'bar']), NS(foo='bar')) + self.assertEqual(msg, str(cm.warning)) + self.assertEqual(cm.filename, __file__) # =================== # Parent parser tests diff --git a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst index 202c15b014e9b7..1126b286df1133 100644 --- a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst +++ b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst @@ -1 +1,2 @@ -Deprecate passing prefix_chars_ parameter to :meth:`ArgumentParser.add_argument_group`. +Deprecate passing keyword-only :ref:`prefix_chars` argument to +:meth:`argparse.ArgumentParser.add_argument_group`. From d3a2f4105b010b0c3e91f84fab207f286057c433 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Wed, 16 Oct 2024 19:53:30 -0700 Subject: [PATCH 11/12] Use double backtick syntax --- .../next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst index 1126b286df1133..2c2938511978b2 100644 --- a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst +++ b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst @@ -1,2 +1,2 @@ -Deprecate passing keyword-only :ref:`prefix_chars` argument to +Deprecate passing keyword-only ``prefix_chars`` argument to :meth:`argparse.ArgumentParser.add_argument_group`. From f43f6f22bfa42fb4da52baea2eff6f570fb7b847 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 17 Oct 2024 11:47:03 +0300 Subject: [PATCH 12/12] Update Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst --- .../next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst index 2c2938511978b2..777920cc54ff9b 100644 --- a/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst +++ b/Misc/NEWS.d/next/Library/2024-10-16-04-50-53.gh-issue-125542.vZJ-Ns.rst @@ -1,2 +1,2 @@ -Deprecate passing keyword-only ``prefix_chars`` argument to +Deprecate passing keyword-only *prefix_chars* argument to :meth:`argparse.ArgumentParser.add_argument_group`. pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy