| 3006 | |
| 3007 | @functools.total_ordering |
| 3008 | class BalanceMessage(object): |
| 3009 | __slots__ = "body", |
| 3010 | |
| 3011 | def __init__(self, body=None): |
| 3012 | if body is None: |
| 3013 | body = Balance() |
| 3014 | self.body = body |
| 3015 | |
| 3016 | # Struct shallow copy |
| 3017 | def copy(self, other): |
| 3018 | self.body = other.body |
| 3019 | return self |
| 3020 | |
| 3021 | # Struct deep clone |
| 3022 | def clone(self): |
| 3023 | # Serialize the struct to the FBE stream |
| 3024 | writer = BalanceMessageModel(fbe.WriteBuffer()) |
| 3025 | writer.serialize(self) |
| 3026 | |
| 3027 | # Deserialize the struct from the FBE stream |
| 3028 | reader = BalanceMessageModel(fbe.ReadBuffer()) |
| 3029 | reader.attach_buffer(writer.buffer) |
| 3030 | return reader.deserialize()[0] |
| 3031 | |
| 3032 | def __eq__(self, other): |
| 3033 | if not isinstance(self, other.__class__): |
| 3034 | return NotImplemented |
| 3035 | return True |
| 3036 | |
| 3037 | def __lt__(self, other): |
| 3038 | if not isinstance(self, other.__class__): |
| 3039 | return NotImplemented |
| 3040 | return False |
| 3041 | |
| 3042 | @property |
| 3043 | def __key__(self): |
| 3044 | return () |
| 3045 | |
| 3046 | def __hash__(self): |
| 3047 | return hash(self.__key__) |
| 3048 | |
| 3049 | def __format__(self, format_spec): |
| 3050 | return self.__str__() |
| 3051 | |
| 3052 | def __str__(self): |
| 3053 | sb = list() |
| 3054 | sb.append("BalanceMessage(") |
| 3055 | sb.append("body=") |
| 3056 | sb.append(str(self.body)) |
| 3057 | sb.append(")") |
| 3058 | return "".join(sb) |
| 3059 | |
| 3060 | # Get struct JSON value |
| 3061 | def to_json(self): |
| 3062 | return json.dumps(self.__to_json__(), cls=fbe.JSONEncoder, separators=(',', ':')) |
| 3063 | |
| 3064 | def __to_json__(self): |
| 3065 | result = dict() |
no outgoing calls
no test coverage detected