def __init__(self, object_str, type_verify=None): if len(object_str.split(".")) == 3: space, type, id = object_str.split(".") self.space = int(space) self.type = int(type) self.instance = Id(int(id)) self.Id = object_str if type_verify: assert object_type[type_verify] == int(type),\ "Object id does not match object type! " +\ "Excpected %d, got %d" %\ (object_type[type_verify], int(type)) else: raise Exception("Object id is invalid")
def __bytes__(self): return bytes(Id(self.id)) + bytes(self.op)
def __bytes__(self): return bytes(Id(self.id)) + bytes(self.market_type)