-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
New enum features in Python 3.11 #12841
Comments
Fixes #12483 Fixes python/typeshed#7564 Ref #12841 The fix is straightforward. I can't use a unit test for this because there are some builtins fixtures that don't have tuple, so I can't do version check.
There are 83 open Enum mypy issues at the the time of this writing. Getting the Enum datatype to work with mypy is becoming impossible as I find myself having to use |
@AlexWaygood there's also Enum's |
This PR adds support for https://docs.python.org/3.11/library/enum.html#enum.nonmember Refs #12841
With #17376 being merged we should be able to check off |
Done |
There's a ton of new
enum
features in Python 3.11 that mypy doesn't yet support:enum.property
enum.verify
enum.(non)member
ReprEnum
StrEnum
enum.property
is not yet supported:Enum.name
isAny
in 3.11 / supportenum.property
#12483The new
enum.verify
decorator isn't supported: the following snippet will raise an exception at runtime on 3.11 due to not all values being unique, but it passes mypy:enum.member
/enum.nonmember
. The docs are a bit thin on these, but it looks like in the following enum, BAR is converted to become a member, but BAZis not:
(These two can also be used as decorators)
ReprEnum
: this doesn't need any special support by mypy, but the following mypy bug but means that it can't really be used idiomatically at the moment:ReprEnum
" error #12787StrEnum
: I didn't think this required any special treatment from mypy, but there's a weird bug here in mypy's handling ofStrEnum
:The text was updated successfully, but these errors were encountered: