Skip to content

Commit

Permalink
Delete enums.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Gobot1234 committed Jul 12, 2020
1 parent 83e47b1 commit 907c91b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 150 deletions.
149 changes: 0 additions & 149 deletions betterproto/enums.py

This file was deleted.

9 changes: 8 additions & 1 deletion src/betterproto/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def __new__(
value_mapping: Dict[Any, EnumMember] = {}
member_mapping: Dict[str, EnumMember] = {}
member_names: List[str] = []
value_cls = IntEnumMember if int in bases else EnumMember
try:
value_cls = IntEnumMember if IntEnum in bases else EnumMember
except NameError:
value_cls = EnumMember

for key, value in tuple(attrs.items()):
is_descriptor = _is_descriptor(value)
Expand Down Expand Up @@ -165,4 +168,8 @@ def patched_instance_check(self: _EnumMeta, instance: Any) -> bool:
return type.__instancecheck__(self, instance)


class MyEnum(IntEnum):
pass


_EnumMeta.__instancecheck__ = patched_instance_check # fake it till you make it

0 comments on commit 907c91b

Please sign in to comment.