MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / EnumByte

Class EnumByte

projects/Python/proto/enums.py:19–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class EnumByte(enum.IntEnum, metaclass=fbe.DefaultEnumMeta):
20 ENUM_VALUE_0 = int(0) + 0
21 ENUM_VALUE_1 = int(0) + 0
22 ENUM_VALUE_2 = int(0) + 1
23 ENUM_VALUE_3 = int(254) + 0
24 ENUM_VALUE_4 = int(254) + 1
25 ENUM_VALUE_5 = ENUM_VALUE_3
26 unknown = ~0
27
28 __slots__ = ()
29
30 def __format__(self, format_spec):
31 return self.__str__()
32
33 def __str__(self):
34 if self.value == EnumByte.ENUM_VALUE_0:
35 return "ENUM_VALUE_0"
36 if self.value == EnumByte.ENUM_VALUE_1:
37 return "ENUM_VALUE_1"
38 if self.value == EnumByte.ENUM_VALUE_2:
39 return "ENUM_VALUE_2"
40 if self.value == EnumByte.ENUM_VALUE_3:
41 return "ENUM_VALUE_3"
42 if self.value == EnumByte.ENUM_VALUE_4:
43 return "ENUM_VALUE_4"
44 if self.value == EnumByte.ENUM_VALUE_5:
45 return "ENUM_VALUE_5"
46 return "<unknown>"
47
48 @classmethod
49 def _missing_(cls, value):
50 return EnumByte.unknown
51
52 @staticmethod
53 def __from_json__(value):
54 if value is None:
55 return None
56 return EnumByte(value)
57
58
59# Fast Binary Encoding EnumByte field model

Callers 3

__from_json__Method · 0.70
getMethod · 0.70
getMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected