Allow unspecified values for composite types#767
Closed
Kamekameha wants to merge 3 commits into
Closed
Conversation
|
@Kamekameha Thanks for the PR. Could you add some inline comments to your changes, and perhaps some documentation? Thanks! |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With this, behavior is (or should be) similar to when only
nargsis used. TheTupleparameter type can't actually handle empty tuples and thus we get theTypeErrorexception about differing value length and type arity.Hopefully this fixes #472 but I'm not sure if this is the correct approach into fixing this since composite parameter types aren't exactly required to return tuples. Besides, ideally, for
nargsunequal to 1nargsparameters should be designed on top of theTupleparameter type, in my opinion, and like any other type without defaults, composite types should returnNonewhen unspecified in the command line (unlessmultipleisTrue, which, as is already the case, should return an empty tuple). Of course that's a way different approach and I'd rather discuss that in here first.I'm definitely open to suggestions or something as I'm not really familiar with
click's internals. All tests runs passed for me so I hope I didn't break anything.(Also, last commit can be ignored if necessary, I just found it appropriate in this case.)