示例#1
0
 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")
示例#2
0
 def __bytes__(self):
     return bytes(Id(self.id)) + bytes(self.op)
示例#3
0
 def __bytes__(self):
     return bytes(Id(self.id)) + bytes(self.market_type)