Optimized containment check in ChoicesMeta.
This commit is contained in:
parent
9d40b6bbf4
commit
972d93a95e
|
@ -36,7 +36,7 @@ class ChoicesMeta(enum.EnumMeta):
|
||||||
def __contains__(cls, member):
|
def __contains__(cls, member):
|
||||||
if not isinstance(member, enum.Enum):
|
if not isinstance(member, enum.Enum):
|
||||||
# Allow non-enums to match against member values.
|
# Allow non-enums to match against member values.
|
||||||
return member in {x.value for x in cls}
|
return any(x.value == member for x in cls)
|
||||||
return super().__contains__(member)
|
return super().__contains__(member)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in New Issue