-
-
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
unused-import for names used in class keyword arguments inside if expressions #1630
Comments
It's kind of corner case, we successfully lint code below, which is correct declaration of using metaclass: from abc import ABCMeta
class foo(metaclass=ABCMeta):
pass |
Still present in version 1.8.2 |
Present in 2.1.0 too..
The code:
and then the results |
I'm also facing this, in an |
Thanks for the examples, folks. @jonapich Can you share a minimal reproduction example? |
This example will get
file baseclass.py
file subclass.py
|
Here is another variation on the same theme without using
|
@douglas-raillard-arm thanks for this update. |
I'm also seeing this when using an imported module in an expression in the class definition arguments list.
import django
class SomeMetaClass(type):
pass
class MyClass(metaclass=type if django.VERSION >= (3, 2) else SomeMetaClass):
pass
|
Only the last example in #1630 (comment) seems to still reproduce on 2.14 dev, so I'm going to refocus the issue title. |
@jacobtylerwalls
|
Update 06/25/22: see comment for an example that still reproduces on 2.14.
Steps to reproduce
Lint the following code:
Current behavior
Expected behavior
No
unused-import
error.pylint --version output
The text was updated successfully, but these errors were encountered: