Update enum.py

This commit is contained in:
Andrei 2023-03-20 04:07:34 +03:00
parent 0553f79576
commit ac8a62de40
1 changed files with 4 additions and 15 deletions

View File

@ -1,9 +1,12 @@
from enum import Enum
from types import DynamicClassAttribute
from typing import List
class MyEnum(Enum):
"""
Base class for work with updated Enums
"""
@classmethod
def list(cls) -> List[Enum]:
return list(map(lambda c: c, cls))
@ -16,20 +19,6 @@ class MyEnum(Enum):
def list_names(cls) -> List[str]:
return list(map(lambda c: c.name, cls))
@DynamicClassAttribute
def name(self) -> str:
"""
The name of the Enum member
"""
return self._name_
@DynamicClassAttribute
def value(self) -> str:
"""
The name of the Enum member
"""
return self._value_
class EndpointPostfixEnm(str, MyEnum):
"""