Created
June 23, 2021 02:28
-
-
Save clifton/b57046aa04c8b42b62467f87b4bc4392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnumDirectValueMeta(EnumMeta): | |
def __getattribute__(cls, name): | |
value = super().__getattribute__(name) | |
if isinstance(value, cls): | |
value = value.value | |
return value | |
def __iter__(self): | |
for item in super().__iter__(): | |
yield item | |
class FilingType(str, Enum, metaclass=EnumDirectValueMeta): | |
FORM_8K = "8-k" | |
FORM_10K = "10-k" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment