-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Don't treat __slots__ as enum member
#7257
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
Conversation
Pull Request Test Coverage Report for Build 2780287184
π - Coveralls |
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit e9b8ad2 |
|
Hi! I think the issue applies to any dunder name; not just class E(Enum):
__x__ = 'x'
class F(E):
member = 3
pylint x.py:
x.py:7:0: E0244: Extending inherited Enum class "E" (invalid-enum-extension) |
|
Another thought that I head is that it might be better to have |
|
+1 @Bibo-Joshi I did not follow everything here but if a fix can be done in astroid it's better to do it in astroid π |
|
All right. I'll try to have a look into it or at least open an issue over at astroid :) |
It doesn't look like it. The dunder name does not appear in the members container: (venv310) Marks-MacBook-Air-2:programming markbyrne$ cat y.py
from enum import Enum
class E(Enum):
__x__ = 'x'
AAA = "aaa"
print(E.__members__)
print(type(E.AAA))
print(type(E.__x__))
(venv310) Marks-MacBook-Air-2:programming markbyrne$ python y.py
{'AAA': <E.AAA: 'aaa'>}
<enum 'E'>
<class 'str'>So I think the issue is Astroid is inserting them into members when it shouldn't be. |
Here it is: pylint-dev/astroid#1730. In any case, I guess this PR is superfluous. Closing. |
|
Thank you @Bibo-Joshi |
Type of Changes
Description
Closes #6887