Pylint: False positive on Enum.__members__.items()

Created on 22 Feb 2021  路  3Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. Create an Enum subclass
  2. Try to iterate over the Enum contents using MyEnum.__members__.items()
  3. Lint the code

Current behavior

observe E1101: Function '__members__' has no 'items' member (no-member)

Expected behavior

Iterating over an Enum per the Python docs does not result in a linting error.

pylint --version output

pylint 2.7.0
astroid 2.5
bug false-positive

Most helpful comment

I'm facing the same issue, but with values instead of items. Would expect it's the same for keys as well.

All 3 comments

I can make a patch about this issue

I'm facing the same issue, but with values instead of items. Would expect it's the same for keys as well.

I have __members__[something] which gives me unsubscriptable-object. I guess everything under __members__ is invisible...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanchewy picture ethanchewy  路  3Comments

TBoshoven picture TBoshoven  路  3Comments

adamtheturtle picture adamtheturtle  路  3Comments

PCManticore picture PCManticore  路  3Comments

DGalt picture DGalt  路  3Comments