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

Class StructSet

projects/Python/proto/test.py:12211–12352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12209
12210@functools.total_ordering
12211class StructSet(object):
12212 __slots__ = "f1", "f2", "f3", "f4",
12213
12214 def __init__(self, f1=None, f2=None, f3=None, f4=None):
12215 if f1 is None:
12216 f1 = set()
12217 if f2 is None:
12218 f2 = set()
12219 if f3 is None:
12220 f3 = set()
12221 if f4 is None:
12222 f4 = set()
12223 self.f1 = f1
12224 self.f2 = f2
12225 self.f3 = f3
12226 self.f4 = f4
12227
12228 # Struct shallow copy
12229 def copy(self, other):
12230 self.f1 = other.f1
12231 self.f2 = other.f2
12232 self.f3 = other.f3
12233 self.f4 = other.f4
12234 return self
12235
12236 # Struct deep clone
12237 def clone(self):
12238 # Serialize the struct to the FBE stream
12239 writer = StructSetModel(fbe.WriteBuffer())
12240 writer.serialize(self)
12241
12242 # Deserialize the struct from the FBE stream
12243 reader = StructSetModel(fbe.ReadBuffer())
12244 reader.attach_buffer(writer.buffer)
12245 return reader.deserialize()[0]
12246
12247 def __eq__(self, other):
12248 if not isinstance(self, other.__class__):
12249 return NotImplemented
12250 return True
12251
12252 def __lt__(self, other):
12253 if not isinstance(self, other.__class__):
12254 return NotImplemented
12255 return False
12256
12257 @property
12258 def __key__(self):
12259 return ()
12260
12261 def __hash__(self):
12262 return hash(self.__key__)
12263
12264 def __format__(self, format_spec):
12265 return self.__str__()
12266
12267 def __str__(self):
12268 sb = list()

Callers 5

__from_json__Method · 0.70
getMethod · 0.70
deserializeMethod · 0.70
getMethod · 0.70
deserializeMethod · 0.70

Calls

no outgoing calls

Tested by 5

__from_json__Method · 0.56
getMethod · 0.56
deserializeMethod · 0.56
getMethod · 0.56
deserializeMethod · 0.56