Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-91832: Add 'required' attr to argparse.Action repr#91841
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fatihkabakk commentedApr 22, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
AbhigyanBose commentedApr 22, 2022
Thanks for pointing it out. I just realized the same. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
Python stdlib doesn’t use a root package name, Lib is just a source directory.
| Added 'required' to names list inLib.argparse.Action. | |
| Added 'required' to names list in argparse.Action. |
Also mentioningparameters may be clearer thannames
AbhigyanBoseApr 25, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
names is the name of the list in Action class that we are adding the element to. I should've put it in a code block.
How does this look ?
"Added an elementrequired to the listnames in argparse.Action._get_kwargs"
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.
Same thing. My point is that it does not matter that a line in the code usesnames, it is not meaninfgul on its own when read by people in the NEWS.
AbhigyanBoseApr 25, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
How does this sound then:
Added a parameter "required" to the list returned by_get_kwargs inargparse.Action.
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.
The bug really is: required is missing from repr output
So this fix is doing:Add 'required' attr to argparse.Action repr
🙂
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.
Ahhh..... Sorry, I'm still new here, and trying to get to know things. Thanks for taking the time to help me understand.
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.
No worry! There is info in the devguide:https://devguide.python.org/pullrequest/
(for future PRs, please don’t force push, it makes reviews harder)
terryjreedy commentedApr 25, 2022
As suggested by Ronald Oussoren on core mentorship, changing a line like ' x ' to ' x \n' should solve the patchcheck failure. In a future issue, parser.format_help might be modified to not format with trailing whitespace. I doubt that it is really needed. Sidenote: I am not sure what you did, but force-pushing is rarely needed when revising PRs and sometimes messes them up. |
AbhigyanBose commentedApr 25, 2022
@terryjreedy Got it. I just wasn't sure if I should change an unrelated test case's content in this particular PR. If that's what you and@merwok recommend I'll add in '\n' and then run I could also create a separate PR to add '\n' to that test case. |
terryjreedy commentedApr 25, 2022
A separate PR would be OK. Azure Pipelines passing is not required but its failure from patchcheck failing is a nuisance. |
terryjreedy commentedApr 25, 2022
I think Zachary Ware's suggestion of '\x20' might be even better. (How to fix argparse is not obvious. It uses %-formatting and I check all %s and no of format string I looked at had trailing spaces of format character that would produce such.) |
merwok commentedApr 25, 2022
This format spec does funky alignment: Line 521 in94d0853
|
AbhigyanBose commentedApr 27, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I created a newissue for this. I also proposed the solution I thought to be the simplest there. |
AbhigyanBose commentedApr 28, 2022
#91984 has been resolved, thus |
Misc/NEWS.d/next/Library/2022-04-23-03-24-00.gh-issue-91832.TyLi65.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
merwok left a comment
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!
Minor change in news entry then this is good to go.
Can you check if backports to 3.10 and 3.9 are needed? (if therequired attribute is present in these versions too)
…Li65.rstCo-authored-by: Éric <merwok@netwok.org>
AbhigyanBose commentedApr 28, 2022
Yeah. Seems like backports to 3.10 and 3.9 are necessary.( |
miss-islington commentedApr 28, 2022
@AbhigyanBose: Status check is done, and it's a success ✅ . |
miss-islington commentedApr 28, 2022
Thanks@AbhigyanBose for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
bedevere-bot commentedApr 28, 2022
GH-92021 is a backport of this pull request to the3.10 branch. |
bedevere-bot commentedApr 28, 2022
GH-92022 is a backport of this pull request to the3.9 branch. |
…-91841)GH- Adding 'required' to names in Lib.argparse.Actionpythongh-91832:Added 'required' to the list `names` in `Lib.argparse.Action`.Changed constant strings that test the Action object.Automerge-Triggered-By: GH:merwok(cherry picked from commit4ed3900)Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
GH- Adding 'required' to names in Lib.argparse.Actiongh-91832:Added 'required' to the list `names` in `Lib.argparse.Action`.Changed constant strings that test the Action object.Automerge-Triggered-By: GH:merwok(cherry picked from commit4ed3900)Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
GH- Adding 'required' to names in Lib.argparse.Actiongh-91832:Added 'required' to the list `names` in `Lib.argparse.Action`.Changed constant strings that test the Action object.Automerge-Triggered-By: GH:merwok(cherry picked from commit4ed3900)Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
…-91841)GH- Adding 'required' to names in Lib.argparse.Actionpythongh-91832:Added 'required' to the list `names` in `Lib.argparse.Action`.Changed constant strings that test the Action object.Automerge-Triggered-By: GH:merwok(cherry picked from commit4ed3900)Co-authored-by: Abhigyan Bose <abhigyandeepbose@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Adding 'required' to names in Lib.argparse.Action
gh-91832:
Added 'required' to the list
namesinLib.argparse.Action.Changed constant strings that test the Action object.
Automerge-Triggered-By: GH:merwok