Skip to content

Add missing enum attributes #1195

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

Merged
merged 1 commit into from
Apr 24, 2017
Merged

Add missing enum attributes #1195

merged 1 commit into from
Apr 24, 2017

Conversation

JelleZijlstra
Copy link
Member

Fixes #854 (unless there's more I'm missing).

Tested with this file:

import enum

class A(enum.Enum):
    b = 1
    c = 2

reveal_type(reversed(A))
reveal_type(A.b in A)
reveal_type(A['a'])
reveal_type(A.__members__)

With mypy master this produces:

../bin/enum36.py:7: error: Revealed type is 'typing.Iterator[enum.Enum*]'
../bin/enum36.py:8: error: Revealed type is 'builtins.bool'
../bin/enum36.py:9: error: Revealed type is 'enum36.A'
../bin/enum36.py:10: error: Revealed type is 'typing.Mapping[builtins.str, enum36.A*]'
../bin/enum36.py:10: error: Invalid method type

The first line should be Iterator[A] but that's due to python/mypy#3210, and the last error is wrong but that's due to python/mypy#3223.

Fixes python#854 (unless there's more I'm missing).
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

Successfully merging this pull request may close these issues.

2 participants