Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The enum generation only works with direct classes of Enum. #11

Closed
gustavo-mazzei opened this issue Jul 14, 2023 · 2 comments · Fixed by #12
Closed

The enum generation only works with direct classes of Enum. #11

gustavo-mazzei opened this issue Jul 14, 2023 · 2 comments · Fixed by #12
Assignees
Labels
bug Something isn't working

Comments

@gustavo-mazzei
Copy link

The current code to generate an enum is the following:

def is_enum(t) -> bool:
    return t.__base__.__name__ == 'Enum'

This allows only direct classes of Enum to be generated. If you have something like

class BasicEnum(Enum):
   some stuff

class MyEnum(BasicEnum):
   VALUE_1 = 1
   VALUE_2 = 2

it wont work.
This can be fixed by just asking if it is instance of Enum instead

@christianhelle
Copy link
Owner

@gmazzei-chartboost thanks for taking the time to report this. I'm unfortunately on my summer vacation and won't be able to look into this in detail in the next 2 weeks.

If you know the fix and don't mind creating a PR yourself then I will approve and merge it from my phone and make sure it gets released to PyPi on the same day

@christianhelle christianhelle added the bug Something isn't working label Jul 14, 2023
@christianhelle christianhelle self-assigned this Jul 14, 2023
@christianhelle
Copy link
Owner

christianhelle commented Jul 20, 2023

The fix for this is released and published as version 1.0.15 to PyPi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants