Skip to content
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

Fixed a bug that leads to a false positive when a function is decorat… #9518

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

erictraut
Copy link
Collaborator

…ed and has no explicit return type annotation and the body references the decorated function in a loop. This addresses #9492.

…ed and has no explicit return type annotation and the body references the decorated function in a loop. This addresses #9492.
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

ibis (https://github.com/ibis-project/ibis)
-   /tmp/mypy_primer/projects/ibis/ibis/expr/operations/core.py:126:35 - error: Argument of type "() -> Unknown" cannot be assigned to parameter "s" of type "Iterable[_S@union]" in function "union"
+   /tmp/mypy_primer/projects/ibis/ibis/expr/operations/core.py:126:35 - error: Argument of type "Attribute" cannot be assigned to parameter "s" of type "Iterable[_S@union]" in function "union"
-     "function" is incompatible with protocol "Iterable[_S@union]"
+     "Attribute" is incompatible with protocol "Iterable[_S@union]"

asynq (https://github.com/quora/asynq)
-   /tmp/mypy_primer/projects/asynq/asynq/tools.py:268:25 - error: Cannot access attribute "alazy_constant_refresh_time" for class "function"
-     Attribute "alazy_constant_refresh_time" is unknown (reportFunctionMemberAccess)
- 167 errors, 9 warnings, 0 informations 
+ 166 errors, 9 warnings, 0 informations 

prefect (https://github.com/PrefectHQ/prefect)
-   /tmp/mypy_primer/projects/prefect/src/prefect/utilities/dispatch.py:126:33 - error: Cannot assign to attribute "__init_subclass__" for class "Type[Unknown]*"
-     Type "(cls: Unknown, **kwargs: Unknown) -> None" is not assignable to type "() -> None"
-       Extra parameter "cls" (reportAttributeAccessIssue)
-   /tmp/mypy_primer/projects/prefect/src/prefect/utilities/pydantic.py:163:19 - error: "__dispatch_key__" is not a known attribute of module "pydantic" (reportAttributeAccessIssue)
- 9099 errors, 252 warnings, 0 informations 
+ 9097 errors, 252 warnings, 0 informations 

manticore (https://github.com/trailofbits/manticore)
+   /tmp/mypy_primer/projects/manticore/manticore/core/workspace.py:339:9 - error: Method "load_value" overrides class "Store" in an incompatible manner
+     Return type mismatch: base method returns type "bytes | str", override returns type "Unknown | None"
+       Type "Unknown | None" is not assignable to type "bytes | str"
+         Type "None" is not assignable to type "bytes | str"
+           "None" is not assignable to "bytes"
+           "None" is not assignable to "str" (reportIncompatibleMethodOverride)
-     Parameter 3 mismatch: base parameter "binary" is keyword parameter, override parameter is position-only (reportIncompatibleMethodOverride)
+     Parameter 3 mismatch: base parameter "binary" is keyword parameter, override parameter is position-only
+     Return type mismatch: base method returns type "bytes | str", override returns type "bytes | None"
+       Type "bytes | None" is not assignable to type "bytes | str"
+         Type "None" is not assignable to type "bytes | str"
+           "None" is not assignable to "bytes"
+           "None" is not assignable to "str" (reportIncompatibleMethodOverride)
- 25911 errors, 148 warnings, 0 informations 
+ 25912 errors, 148 warnings, 0 informations 

@erictraut erictraut merged commit 17cee31 into main Nov 29, 2024
18 checks passed
@erictraut erictraut deleted the issue-9492 branch November 29, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant