Skip to content

Instantly share code, notes, and snippets.

@clifton
Created June 23, 2021 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clifton/b57046aa04c8b42b62467f87b4bc4392 to your computer and use it in GitHub Desktop.
Save clifton/b57046aa04c8b42b62467f87b4bc4392 to your computer and use it in GitHub Desktop.
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