-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pylint's type checker ignores type interface files #9423
Comments
Thanks! |
#9097 is not a duplicate of this issue. This issue is not about linting .pyi files in a directory, but rather about using .pyi files during inference. We have another bug report in google/jax with the same root cause:
pylint concludes the result of Should I file a new issue in astroid? |
I'm not sure what the current order is for |
Thanks for the comment, but I think it was just that we marked the wrong duplicate. A better duplicate is #9185, which has a fix waiting for review in astroid at pylint-dev/astroid#2375 |
Thanks @DanielNoord and @jacobtylerwalls! This is indeed a more relevant issue/PR, but note that the issue described in my earlier comment is subtly different still. astroid already resolves the import to the .pyi file, since there is no .py file for
returns I assume that the full fix would require revisiting inference logic/heuristics and adjusting them to .pyi files. |
Bug description
First reported at jax-ml/jax#19713, here's a minimal repro:
mypy
returns no error because the code is typed correctly:Foo
supports__neg__
, as declared in the type interface file.pylint
incorrectly errors because it doesn't recognize either the dynamically-defined method or its declaration in the interface file.Configuration
No response
Command used
Pylint output
Expected behavior
pylint should not error for valid code
Pylint version
OS / Environment
Linux (google Colab)
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: