Open mwhavens opened 1 month ago
I've tracked the issue to the _resolve(self, base_value=None) function in the _enum.py file. It loops through each step but overwrites the value from the previous iteration. https://github.com/ethanfurman/aenum/blob/523f7d4936b16fc598dcde94f55fe3224d0c96b7/aenum/_enum.py#L725 Adding the following line of code after setting value resolved the issue for me:
value = op(*values)
+ base_value = value
auto() only factors in the last | operation on the right side. I've found a work around is to move the |'s to the left of auto but a fix should probably be done to resolve the code bug as well.
result: [<SBInterfaceTypes.ALL: 0>, <SBInterfaceTypes.UNKNOWN: 1>, <SBInterfaceTypes.URL: 2>, <SBInterfaceTypes.PROD: 4>, <SBInterfaceTypes.DEV: 8>, <SBInterfaceTypes.S3: 16>, <SBInterfaceTypes.T3: 48>] <SBInterfaceTypes.T3: 48> but should be 52.
Using
T3 = PROD| S3 | auto()
works as expected though.