-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 overloads for all and from_input to not return Never
types
#16139
Conversation
Changelog[uncommitted] (2024-05-07) |
|
||
@overload | ||
@staticmethod | ||
def from_input(val: Input[T_co]) -> "Output[T_co]": ... |
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.
This signature is exactly the same as the one of implementation below, is it needed?
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.
mypy docs say it is, that you should list all the overloads with the annotation then have the implementation without @overload
.
Fixes #16027. Seems mypy was having issues with Outputs being passed into these methods and tracking that they should have just been returning the same Output in the result. Adding these extra overloads seems to have appeased the type checker when using these methods.
b024522
to
55a2f00
Compare
Tentative changelog: ### Bug Fixes - [engine] Fix dataraces between snapshot and deployment systems. [#16148](#16148) - [cli/display] Fix mangled diffs of strings containing url-encoded chars [#16147](#16147) - [sdk/nodejs] Don't load punycode module in function serialization code [#16149](#16149) - [sdk/python] Fix typings for `from_input` and `all` to not return `Never` types. [#16139](#16139) - [sdk/python] Fix a race condition in output handling [#16155](#16155)
Tentative changelog: ### Bug Fixes - [engine] Fix dataraces between snapshot and deployment systems. [#16148](#16148) - [cli/display] Fix mangled diffs of strings containing url-encoded chars [#16147](#16147) - [sdk/nodejs] Don't load punycode module in function serialization code [#16149](#16149) - [sdk/nodejs] Return error in RPC response instead of exiting in the language runtime [#16162](#16162) - [sdk/nodejs] Return the underlying error if we can't locate the pulumi SDK [#16160](#16160) - [sdk/python] Provide more descriptive exception [#16098](#16098) - [sdk/python] Fix typings for `from_input` and `all` to not return `Never` types. [#16139](#16139) - [sdk/python] Fix a race condition in output handling [#16155](#16155) ### Miscellaneous - [pkg] Upgrade pulumi-java to v0.11.0
Description
Fixes #16027.
Seems mypy was having issues with Outputs being passed into these methods and tracking that they should have just been returning the same Output in the result. Adding these extra overloads seems to have appeased the type checker when using these methods.
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change