Update enum.py
This commit is contained in:
parent
0553f79576
commit
ac8a62de40
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue