-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Fix error in argparse documentation example #17399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error in argparse documentation example #17399
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). Recognized GitHub usernameWe couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames: This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @SarahPythonista and welcome!
I tested the suggested changes in the REPL using Python 3.8 and received the following output:
>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', required=True)
_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None)
>>> parser.parse_args(['--foo', 'BAR'])
Namespace(foo='BAR')
>>> parser.parse_args([])
usage: [-h] --foo FOO
: error: the following arguments are required: --foo
The suggested changes look correct to me, good catch.
Also, if you're having issues with the CLA status not updating after 24 hours, I would recommend manually refreshing the status on GitHub through https://check-python-cla.herokuapp.com/. |
@SarahPythonista, thank you for the PR. Your PR will be merged automatically once the CLA is signed. Please take a look at the comment from @aeros and leave a comment if you're having issues with the CLA. Thank you! |
Thanks @SarahPythonista for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
Thanks @SarahPythonista for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
GH-21990 is a backport of this pull request to the 3.8 branch. |
GH-21991 is a backport of this pull request to the 3.7 branch. |
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
GH-21992 is a backport of this pull request to the 3.9 branch. |
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
Going to close the 3.7 backport PR (since we typically only do backports for the current version on docs.python.org and later). |
Thanks for the reminder to take care of this PR @tirkarthi and to @SarahPythonista for the documentation example fix. :-) |
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
Automerge-Triggered-By: @rhettinger (cherry picked from commit 8784d33) Co-authored-by: SarahPythonista <4283226+SarahPythonista@users.noreply.github.com>
Automerge-Triggered-By: @rhettinger
Automerge-Triggered-By: @rhettinger
Automerge-Triggered-By: @aeros