forked from pylint-dev/astroid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fake "name" property to enum.Enum subclasses
Ref pylint-dev/pylint#1932. Ref pylint-dev/pylint#2062. The enum.Enum class itself defines two @DynamicClassAttribute data-descriptors "name" and "value" which behave differently when looked up on an instance or on the class. When dealing with inference of an arbitrary instance of the enum class, e.g. in a method defined in the class body like: class SomeEnum(enum.Enum): def method(self): self.name # <- here we should assume that "self.name" is the string name of some enum member, unless the enum itself defines a "name" member.
- Loading branch information
Showing
2 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters