[Python] generate enums as IntEnum or IntFlag type when requested
Fixes #8617 and addresses #5083
This PR has enum types inherit from IntEnum or (IntFlag for bit_flags) directly, instead of just providing this as type hinting, and changes the setter function signatures to require enum types. This code should still be backward and forward compatible on receipt, as ints are still returned by the getters.
This code, chiefly, allows users to go to and from string string values to the enum values, but also provides some runtime type safety (over just type hint safety).
Some docs at least in docs/source/flatc.md would be nice for this change
I played around a bit and it seemed fine, i couldn't integrated it into our main product because this crate was not updated yet https://github.com/rdelfin/flatbuffers-build/pull/30
You said it was compatible.. do we need this flag at all? Can't we always do the better thing? so, I think it depends on what we mean by python 3 support. Now that we have dropped python 2 I think this is safe, but I believe technically this is python 3.4. Though TBF the current implementation is not consistent here so I think just doing this as part of
--python-typingis fine. Will change to that!