using the @classmethod _missing_ function in an IntFlag creates an incorrect resolution of intflags. 127 was resolved as 0 due to the _missing_ function. Without that method, 127 becomes a proper multi-flag

This commit is contained in:
Max Metz 2024-08-27 20:33:33 +02:00
parent 6eab98d2a1
commit 8082100b7e

View File

@ -11,10 +11,6 @@ class ParticipantType(IntFlag):
PORT_ADMINISTRATION = 32 PORT_ADMINISTRATION = 32
TUG = 64 TUG = 64
@classmethod
def _missing_(cls, value):
return cls.undefined
class ShipcallType(IntEnum): class ShipcallType(IntEnum):
"""determines the type of a shipcall, as this changes the applicable validation rules""" """determines the type of a shipcall, as this changes the applicable validation rules"""
undefined = 0 undefined = 0
@ -66,7 +62,3 @@ class ParticipantFlag(IntFlag):
""" """
undefined = 0 undefined = 0
BSMD = 1 BSMD = 1
@classmethod
def _missing_(cls, value):
return cls.undefined