-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update Click to 7.0 #3027
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
Update Click to 7.0 #3027
Conversation
JelleZijlstra
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! Just a few comments.
third_party/2and3/click/termui.pyi
Outdated
|
|
||
|
|
||
| def echo_via_pager(text: str, color: Optional[bool] = ...) -> None: | ||
| def echo_via_pager(text_or_generator: Union[str, Iterable[str]], color: Optional[bool]) -> None: |
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 argument can also be a generator function, something like Callable[[], Generator[str, None, None]] (https://github.com/pallets/click/blob/master/click/termui.py#L246).
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.
oops, missed that at first. Should be good now.
(I am assuming using Iterable[str] in place of Generator[str, None, None] is fine).
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.
I do think it should be Generator, because the check specifically uses isgeneratorfunction. lambda: ["a", "b"] would not work at runtime.
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.
You are right! Updated it now.
third_party/2and3/click/testing.pyi
Outdated
| exc_info: Optional[Any] | ||
| stdout_bytes: bytes | ||
| stderr_bytes: bytes | ||
| # properties |
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.
Should be given with @property. It matters because this way type checkers can see that assigning to .output is an error.
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.
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.
I haven't checked these against the implementation, but if those are also @propertys without setters, they should use @property in the stub. (If they do have a setter, it's fine to just represent them in the stub as you did here.)
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! I guessed so, but wanted to double check.
I verified that those properties do not have setters, and submitted #3028 to fix that.
Closes python#3020.
Since these properties do not have a setter, be explicit with the `@property` decorator. This will allow type checkers to see that assignment of these attributes is an error. See python#3027 (comment) for some related context.
Since these properties do not have a setter, be explicit with the `@property` decorator. This will allow type checkers to see that assignment of these attributes is an error. See python#3027 (comment) for some related context.
Since these properties do not have a setter, be explicit with the `@property` decorator. This will allow type checkers to see that assignment of these attributes is an error. See python#3027 (comment) for some related context.
Since these properties do not have a setter, be explicit with the `@property` decorator. This will allow type checkers to see that assignment of these attributes is an error. See #3027 (comment) for some related context.
Closes #3020.
This is mostly based on differences I noticed in
git diff, not sure if there's an easy way to verify that I've got them all.Also, this is my first PR here so please let me konw if I've missed something 😄