Skip to content

Conversation

gvanrossum
Copy link
Member

@gvanrossum
Copy link
Member Author

@JelleZijlstra This what you meant?

@JelleZijlstra
Copy link
Member

Yes, thanks! I am going to try this out to see if it works properly in all cases (but don't have time right now).

@JelleZijlstra
Copy link
Member

Seems to work:

$ cat ../bin/enumu.py 
import enum

class X(enum.Enum):
    a = 1
    b = 2
reveal_type(enum.unique(X))

@enum.unique
class Y(enum.Enum):
    c = 3
    d = 4
reveal_type(Y)
$ mypy --custom-typeshed-dir . ../bin/enumu.py 
../bin/enumu.py:6: error: Revealed type is 'def (value: Any) -> enumu.X'
../bin/enumu.py:12: error: Revealed type is 'def (value: Any) -> enumu.Y'

@JelleZijlstra JelleZijlstra merged commit f44e461 into master Apr 5, 2017
@JelleZijlstra JelleZijlstra deleted the fix-enum-type-var-for-unique branch April 5, 2017 06:48
hswong3i pushed a commit to alvistack/python-typeshed that referenced this pull request May 25, 2025
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