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

False positive with Enum.__members__.items() #899

Closed
chiefnoah opened this issue Feb 17, 2021 · 2 comments
Closed

False positive with Enum.__members__.items() #899

chiefnoah opened this issue Feb 17, 2021 · 2 comments
Assignees

Comments

@chiefnoah
Copy link

Steps to reproduce

  1. Use an enum's __members__ field:
from enum import Enum

class TestEnum(Enum):
    ONE = 1
    TWO = 2

print(x for x in TestEnum.__members__.items())
  1. Run pylint with astroid 2.5 installed
$ pylint --version
pylint 2.6.2
astroid 2.5
Python 3.8.7 (default, Dec 26 2020, 08:45:55)
[GCC 10.2.1 20201203]

Current behavior

$ pylint test.py
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:3:0: C0115: Missing class docstring (missing-class-docstring)
test.py:7:17: E1101: Function 'members' has no 'items' member (no-member)


Your code has been rated at -4.00/10 (previous run: -4.00/10, +0.00)

Expected behavior

Not complaining about __members__.items()

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.5

See #895

@chiefnoah chiefnoah changed the title False positive False positive with Enum.__members__.items() Feb 17, 2021
@hippo91 hippo91 self-assigned this Feb 17, 2021
@hippo91
Copy link
Contributor

hippo91 commented Feb 17, 2021

@chiefnoah thanks for this report and the reproducer.
I can reproduce it.
The faulty commit is the same as the one of #895 (cc3bfc5).
I'm looking for a fix.

@hippo91 hippo91 mentioned this issue Feb 17, 2021
2 tasks
@hippo91
Copy link
Contributor

hippo91 commented Feb 17, 2021

@chiefnoah i reverted the faulty commit in #901. I am the author of this commit. It was a try to improve the inference of numpy objects.
Apologies for the regression you faced.

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

No branches or pull requests

2 participants