-
Notifications
You must be signed in to change notification settings - Fork 128
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
Use ExtendOverwriteDefault
for all multi-value options
#1709
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1709 +/- ##
==========================================
+ Coverage 72.72% 72.90% +0.17%
==========================================
Files 79 79
Lines 8287 8299 +12
Branches 1697 1694 -3
==========================================
+ Hits 6027 6050 +23
+ Misses 1972 1961 -11
Partials 288 288 ☔ View full report in Codecov by Sentry. |
I'll contribute a test file for this shortly. |
See 8f6f145. |
Amazing!
|
8f6f145
to
db14caf
Compare
f37ce4f
to
38233fd
Compare
38233fd
to
89950c8
Compare
This simplifies the logic since 'extend' directly handles a one-to-many relationship (e.g. --maintainers a b c) instead of using a nested list.
These should have been a part of "Allow repeating an option that takes multiple values" (adf1e78).
This is more in line with the behavior of extending rather than overriding these values. Help text for the command line option has also been reworded. Co-authored-by: Jover Lee <[email protected]>
89950c8
to
8d00203
Compare
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 @victorlin! Sorry for the inconsistent usage of ExtendOverwriteDefault
🙏
nargs="+"/"*" without any action allows overriding the defaults but does not allow multiple of the same option flag. Adding action="extend" allows multiple of the same option flag but removes the ability to override defaults. The custom action=ExtendOverwriteDefault allows the best of both worlds. --- This was partially applied in "Allow repeating an option that takes multiple values" (adf1e78). At the time I chose to only use ExtendOverwriteDefault for options that had a non-empty default list. This was done by manually inspecting each argument that used nargs="+"/"*" at the time, a process prone to future misalignment. Now, I am applying it to all other usage of nargs="+"/"*" to future-proof for any default value changes that could cause action="extend" to behave different than originally intended.
This prevents poor rendering on reStructuredText docs.
49568ad
to
28e6e8c
Compare
Description of proposed changes
This is largely a follow-up to #1445 which in hindsight was not done properly. See commits for details.
Related issue(s)
#1707
89fbda2 closes #1706 (no longer necessary)
Checklist
extend
andExtendOverwriteDefault
actions #1654 (comment)