As referenced in demberto/PyFLP#111, I had been using the EnumBase class like this, since it autogenerates missing members.
class MyEnum(ct.EnumBase):
def __new__(cls, id: int, ascii: bool = False):
obj = int.__new__(cls, id)
obj._value_ = id
setattr(obj, "ascii", ascii)
return obj
Member= (51, True)
Normal = 52
causes (Python 3.10):
\lib\enum.py:298: in __new__
enum_member.__init__(*args)
E TypeError: EnumBase.__init__() takes 2 positional arguments but 3 were given
I tried modifiying the __new__ method to use *args instead but it won't work either:
def __new__(cls, *args: Any):
if len(args) == 2:
id, ascii = args
else:
(id,) = args
ascii = False
obj = int.__new__(cls, id)
obj._value_ = id
setattr(obj, "ascii", ascii)
return obj
results in the same error.
As mentioned in demberto/PyFLP#111 (comment) the change in EnumBase.__init__ seems to have caused this.
As referenced in demberto/PyFLP#111, I had been using the
EnumBaseclass like this, since it autogenerates missing members.causes (Python 3.10):
I tried modifiying the
__new__method to use*argsinstead but it won't work either:results in the same error.
As mentioned in demberto/PyFLP#111 (comment) the change in
EnumBase.__init__seems to have caused this.