Open lequytra opened 1 year ago
My 2 cents:
EnumBase
dynamically based on the values found in VanillaEnum
and ExtendedEnum
. However this makes comparisons more cumbersome and error-prone since for instance cfg.enum_options == VanillaEnum.xyz
always evaluates to False
(so one would need to compare names or values).enum_options=VanillaEnum.xyz
and enum_options=xyz
are supported (with the latter requiring a check for potentially ambiguous names), and (b) make sure that serialization works as expected
Is your feature request related to a problem? Please describe. I have the following code structure:
I want Enum inheritance to be supported, such that the
enum_options
to accept bothVanillaEnum
andExtendedEnum
. Currently, OmegaConf is throwing errors in thevalidate_and_convert_to_enum
method, that the enums are not valid since it doesn't belong to EnumBase.Describe the solution you'd like I want Enum Inheritance to be supported so
enum_options
of typeEnumBase
can accept child enum classes. Can we: in thevalidate_and_convert_to_enum
method, get the subclasses of enum_type usingenum_type.__subclasses__()
and try to returnsubclass[value]
whenenum_type[value]
failed?Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.