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

Class EnumSimple

projects/Python/proto/test.py:20–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

__from_json__Method · 0.70
getMethod · 0.70
getMethod · 0.70
__init__Method · 0.70
get_fieldsMethod · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by 6

__from_json__Method · 0.56
getMethod · 0.56
getMethod · 0.56
__init__Method · 0.56
get_fieldsMethod · 0.56
__init__Method · 0.56