Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
nmslib/query_server/python_client/protocol/QueryService.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
981 lines (864 sloc)
29.1 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Autogenerated by Thrift Compiler (0.9.2) | |
# | |
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | |
# | |
# options string: py | |
# | |
from thrift.Thrift import TType, TMessageType, TException, TApplicationException | |
from ttypes import * | |
from thrift.Thrift import TProcessor | |
from thrift.transport import TTransport | |
from thrift.protocol import TBinaryProtocol, TProtocol | |
try: | |
from thrift.protocol import fastbinary | |
except: | |
fastbinary = None | |
class Iface: | |
def setQueryTimeParams(self, queryTimeParams): | |
""" | |
Parameters: | |
- queryTimeParams | |
""" | |
pass | |
def knnQuery(self, k, queryObj, retExternId, retObj): | |
""" | |
Parameters: | |
- k | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
pass | |
def rangeQuery(self, r, queryObj, retExternId, retObj): | |
""" | |
Parameters: | |
- r | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
pass | |
def getDistance(self, obj1, obj2): | |
""" | |
Parameters: | |
- obj1 | |
- obj2 | |
""" | |
pass | |
class Client(Iface): | |
def __init__(self, iprot, oprot=None): | |
self._iprot = self._oprot = iprot | |
if oprot is not None: | |
self._oprot = oprot | |
self._seqid = 0 | |
def setQueryTimeParams(self, queryTimeParams): | |
""" | |
Parameters: | |
- queryTimeParams | |
""" | |
self.send_setQueryTimeParams(queryTimeParams) | |
self.recv_setQueryTimeParams() | |
def send_setQueryTimeParams(self, queryTimeParams): | |
self._oprot.writeMessageBegin('setQueryTimeParams', TMessageType.CALL, self._seqid) | |
args = setQueryTimeParams_args() | |
args.queryTimeParams = queryTimeParams | |
args.write(self._oprot) | |
self._oprot.writeMessageEnd() | |
self._oprot.trans.flush() | |
def recv_setQueryTimeParams(self): | |
iprot = self._iprot | |
(fname, mtype, rseqid) = iprot.readMessageBegin() | |
if mtype == TMessageType.EXCEPTION: | |
x = TApplicationException() | |
x.read(iprot) | |
iprot.readMessageEnd() | |
raise x | |
result = setQueryTimeParams_result() | |
result.read(iprot) | |
iprot.readMessageEnd() | |
if result.err is not None: | |
raise result.err | |
return | |
def knnQuery(self, k, queryObj, retExternId, retObj): | |
""" | |
Parameters: | |
- k | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
self.send_knnQuery(k, queryObj, retExternId, retObj) | |
return self.recv_knnQuery() | |
def send_knnQuery(self, k, queryObj, retExternId, retObj): | |
self._oprot.writeMessageBegin('knnQuery', TMessageType.CALL, self._seqid) | |
args = knnQuery_args() | |
args.k = k | |
args.queryObj = queryObj | |
args.retExternId = retExternId | |
args.retObj = retObj | |
args.write(self._oprot) | |
self._oprot.writeMessageEnd() | |
self._oprot.trans.flush() | |
def recv_knnQuery(self): | |
iprot = self._iprot | |
(fname, mtype, rseqid) = iprot.readMessageBegin() | |
if mtype == TMessageType.EXCEPTION: | |
x = TApplicationException() | |
x.read(iprot) | |
iprot.readMessageEnd() | |
raise x | |
result = knnQuery_result() | |
result.read(iprot) | |
iprot.readMessageEnd() | |
if result.success is not None: | |
return result.success | |
if result.err is not None: | |
raise result.err | |
raise TApplicationException(TApplicationException.MISSING_RESULT, "knnQuery failed: unknown result"); | |
def rangeQuery(self, r, queryObj, retExternId, retObj): | |
""" | |
Parameters: | |
- r | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
self.send_rangeQuery(r, queryObj, retExternId, retObj) | |
return self.recv_rangeQuery() | |
def send_rangeQuery(self, r, queryObj, retExternId, retObj): | |
self._oprot.writeMessageBegin('rangeQuery', TMessageType.CALL, self._seqid) | |
args = rangeQuery_args() | |
args.r = r | |
args.queryObj = queryObj | |
args.retExternId = retExternId | |
args.retObj = retObj | |
args.write(self._oprot) | |
self._oprot.writeMessageEnd() | |
self._oprot.trans.flush() | |
def recv_rangeQuery(self): | |
iprot = self._iprot | |
(fname, mtype, rseqid) = iprot.readMessageBegin() | |
if mtype == TMessageType.EXCEPTION: | |
x = TApplicationException() | |
x.read(iprot) | |
iprot.readMessageEnd() | |
raise x | |
result = rangeQuery_result() | |
result.read(iprot) | |
iprot.readMessageEnd() | |
if result.success is not None: | |
return result.success | |
if result.err is not None: | |
raise result.err | |
raise TApplicationException(TApplicationException.MISSING_RESULT, "rangeQuery failed: unknown result"); | |
def getDistance(self, obj1, obj2): | |
""" | |
Parameters: | |
- obj1 | |
- obj2 | |
""" | |
self.send_getDistance(obj1, obj2) | |
return self.recv_getDistance() | |
def send_getDistance(self, obj1, obj2): | |
self._oprot.writeMessageBegin('getDistance', TMessageType.CALL, self._seqid) | |
args = getDistance_args() | |
args.obj1 = obj1 | |
args.obj2 = obj2 | |
args.write(self._oprot) | |
self._oprot.writeMessageEnd() | |
self._oprot.trans.flush() | |
def recv_getDistance(self): | |
iprot = self._iprot | |
(fname, mtype, rseqid) = iprot.readMessageBegin() | |
if mtype == TMessageType.EXCEPTION: | |
x = TApplicationException() | |
x.read(iprot) | |
iprot.readMessageEnd() | |
raise x | |
result = getDistance_result() | |
result.read(iprot) | |
iprot.readMessageEnd() | |
if result.success is not None: | |
return result.success | |
if result.err is not None: | |
raise result.err | |
raise TApplicationException(TApplicationException.MISSING_RESULT, "getDistance failed: unknown result"); | |
class Processor(Iface, TProcessor): | |
def __init__(self, handler): | |
self._handler = handler | |
self._processMap = {} | |
self._processMap["setQueryTimeParams"] = Processor.process_setQueryTimeParams | |
self._processMap["knnQuery"] = Processor.process_knnQuery | |
self._processMap["rangeQuery"] = Processor.process_rangeQuery | |
self._processMap["getDistance"] = Processor.process_getDistance | |
def process(self, iprot, oprot): | |
(name, type, seqid) = iprot.readMessageBegin() | |
if name not in self._processMap: | |
iprot.skip(TType.STRUCT) | |
iprot.readMessageEnd() | |
x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) | |
oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) | |
x.write(oprot) | |
oprot.writeMessageEnd() | |
oprot.trans.flush() | |
return | |
else: | |
self._processMap[name](self, seqid, iprot, oprot) | |
return True | |
def process_setQueryTimeParams(self, seqid, iprot, oprot): | |
args = setQueryTimeParams_args() | |
args.read(iprot) | |
iprot.readMessageEnd() | |
result = setQueryTimeParams_result() | |
try: | |
self._handler.setQueryTimeParams(args.queryTimeParams) | |
except(QueryException, err): | |
result.err = err | |
oprot.writeMessageBegin("setQueryTimeParams", TMessageType.REPLY, seqid) | |
result.write(oprot) | |
oprot.writeMessageEnd() | |
oprot.trans.flush() | |
def process_knnQuery(self, seqid, iprot, oprot): | |
args = knnQuery_args() | |
args.read(iprot) | |
iprot.readMessageEnd() | |
result = knnQuery_result() | |
try: | |
result.success = self._handler.knnQuery(args.k, args.queryObj, args.retExternId, args.retObj) | |
except(QueryException, err): | |
result.err = err | |
oprot.writeMessageBegin("knnQuery", TMessageType.REPLY, seqid) | |
result.write(oprot) | |
oprot.writeMessageEnd() | |
oprot.trans.flush() | |
def process_rangeQuery(self, seqid, iprot, oprot): | |
args = rangeQuery_args() | |
args.read(iprot) | |
iprot.readMessageEnd() | |
result = rangeQuery_result() | |
try: | |
result.success = self._handler.rangeQuery(args.r, args.queryObj, args.retExternId, args.retObj) | |
except(QueryException, err): | |
result.err = err | |
oprot.writeMessageBegin("rangeQuery", TMessageType.REPLY, seqid) | |
result.write(oprot) | |
oprot.writeMessageEnd() | |
oprot.trans.flush() | |
def process_getDistance(self, seqid, iprot, oprot): | |
args = getDistance_args() | |
args.read(iprot) | |
iprot.readMessageEnd() | |
result = getDistance_result() | |
try: | |
result.success = self._handler.getDistance(args.obj1, args.obj2) | |
except(QueryException, err): | |
result.err = err | |
oprot.writeMessageBegin("getDistance", TMessageType.REPLY, seqid) | |
result.write(oprot) | |
oprot.writeMessageEnd() | |
oprot.trans.flush() | |
# HELPER FUNCTIONS AND STRUCTURES | |
class setQueryTimeParams_args: | |
""" | |
Attributes: | |
- queryTimeParams | |
""" | |
thrift_spec = ( | |
None, # 0 | |
(1, TType.STRING, 'queryTimeParams', None, None, ), # 1 | |
) | |
def __init__(self, queryTimeParams=None,): | |
self.queryTimeParams = queryTimeParams | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 1: | |
if ftype == TType.STRING: | |
self.queryTimeParams = iprot.readString(); | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('setQueryTimeParams_args') | |
if self.queryTimeParams is not None: | |
oprot.writeFieldBegin('queryTimeParams', TType.STRING, 1) | |
oprot.writeString(self.queryTimeParams) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
if self.queryTimeParams is None: | |
raise TProtocol.TProtocolException(message='Required field queryTimeParams is unset!') | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.queryTimeParams) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class setQueryTimeParams_result: | |
""" | |
Attributes: | |
- err | |
""" | |
thrift_spec = ( | |
None, # 0 | |
(1, TType.STRUCT, 'err', (QueryException, QueryException.thrift_spec), None, ), # 1 | |
) | |
def __init__(self, err=None,): | |
self.err = err | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 1: | |
if ftype == TType.STRUCT: | |
self.err = QueryException() | |
self.err.read(iprot) | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('setQueryTimeParams_result') | |
if self.err is not None: | |
oprot.writeFieldBegin('err', TType.STRUCT, 1) | |
self.err.write(oprot) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.err) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class knnQuery_args: | |
""" | |
Attributes: | |
- k | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
thrift_spec = ( | |
None, # 0 | |
(1, TType.I32, 'k', None, None, ), # 1 | |
(2, TType.STRING, 'queryObj', None, None, ), # 2 | |
(3, TType.BOOL, 'retExternId', None, None, ), # 3 | |
(4, TType.BOOL, 'retObj', None, None, ), # 4 | |
) | |
def __init__(self, k=None, queryObj=None, retExternId=None, retObj=None,): | |
self.k = k | |
self.queryObj = queryObj | |
self.retExternId = retExternId | |
self.retObj = retObj | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 1: | |
if ftype == TType.I32: | |
self.k = iprot.readI32(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 2: | |
if ftype == TType.STRING: | |
self.queryObj = iprot.readString(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 3: | |
if ftype == TType.BOOL: | |
self.retExternId = iprot.readBool(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 4: | |
if ftype == TType.BOOL: | |
self.retObj = iprot.readBool(); | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('knnQuery_args') | |
if self.k is not None: | |
oprot.writeFieldBegin('k', TType.I32, 1) | |
oprot.writeI32(self.k) | |
oprot.writeFieldEnd() | |
if self.queryObj is not None: | |
oprot.writeFieldBegin('queryObj', TType.STRING, 2) | |
oprot.writeString(self.queryObj) | |
oprot.writeFieldEnd() | |
if self.retExternId is not None: | |
oprot.writeFieldBegin('retExternId', TType.BOOL, 3) | |
oprot.writeBool(self.retExternId) | |
oprot.writeFieldEnd() | |
if self.retObj is not None: | |
oprot.writeFieldBegin('retObj', TType.BOOL, 4) | |
oprot.writeBool(self.retObj) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
if self.k is None: | |
raise TProtocol.TProtocolException(message='Required field k is unset!') | |
if self.queryObj is None: | |
raise TProtocol.TProtocolException(message='Required field queryObj is unset!') | |
if self.retExternId is None: | |
raise TProtocol.TProtocolException(message='Required field retExternId is unset!') | |
if self.retObj is None: | |
raise TProtocol.TProtocolException(message='Required field retObj is unset!') | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.k) | |
value = (value * 31) ^ hash(self.queryObj) | |
value = (value * 31) ^ hash(self.retExternId) | |
value = (value * 31) ^ hash(self.retObj) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class knnQuery_result: | |
""" | |
Attributes: | |
- success | |
- err | |
""" | |
thrift_spec = ( | |
(0, TType.LIST, 'success', (TType.STRUCT,(ReplyEntry, ReplyEntry.thrift_spec)), None, ), # 0 | |
(1, TType.STRUCT, 'err', (QueryException, QueryException.thrift_spec), None, ), # 1 | |
) | |
def __init__(self, success=None, err=None,): | |
self.success = success | |
self.err = err | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 0: | |
if ftype == TType.LIST: | |
self.success = [] | |
(_etype3, _size0) = iprot.readListBegin() | |
for _i4 in xrange(_size0): | |
_elem5 = ReplyEntry() | |
_elem5.read(iprot) | |
self.success.append(_elem5) | |
iprot.readListEnd() | |
else: | |
iprot.skip(ftype) | |
elif fid == 1: | |
if ftype == TType.STRUCT: | |
self.err = QueryException() | |
self.err.read(iprot) | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('knnQuery_result') | |
if self.success is not None: | |
oprot.writeFieldBegin('success', TType.LIST, 0) | |
oprot.writeListBegin(TType.STRUCT, len(self.success)) | |
for iter6 in self.success: | |
iter6.write(oprot) | |
oprot.writeListEnd() | |
oprot.writeFieldEnd() | |
if self.err is not None: | |
oprot.writeFieldBegin('err', TType.STRUCT, 1) | |
self.err.write(oprot) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.success) | |
value = (value * 31) ^ hash(self.err) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class rangeQuery_args: | |
""" | |
Attributes: | |
- r | |
- queryObj | |
- retExternId | |
- retObj | |
""" | |
thrift_spec = ( | |
None, # 0 | |
(1, TType.DOUBLE, 'r', None, None, ), # 1 | |
(2, TType.STRING, 'queryObj', None, None, ), # 2 | |
(3, TType.BOOL, 'retExternId', None, None, ), # 3 | |
(4, TType.BOOL, 'retObj', None, None, ), # 4 | |
) | |
def __init__(self, r=None, queryObj=None, retExternId=None, retObj=None,): | |
self.r = r | |
self.queryObj = queryObj | |
self.retExternId = retExternId | |
self.retObj = retObj | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 1: | |
if ftype == TType.DOUBLE: | |
self.r = iprot.readDouble(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 2: | |
if ftype == TType.STRING: | |
self.queryObj = iprot.readString(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 3: | |
if ftype == TType.BOOL: | |
self.retExternId = iprot.readBool(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 4: | |
if ftype == TType.BOOL: | |
self.retObj = iprot.readBool(); | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('rangeQuery_args') | |
if self.r is not None: | |
oprot.writeFieldBegin('r', TType.DOUBLE, 1) | |
oprot.writeDouble(self.r) | |
oprot.writeFieldEnd() | |
if self.queryObj is not None: | |
oprot.writeFieldBegin('queryObj', TType.STRING, 2) | |
oprot.writeString(self.queryObj) | |
oprot.writeFieldEnd() | |
if self.retExternId is not None: | |
oprot.writeFieldBegin('retExternId', TType.BOOL, 3) | |
oprot.writeBool(self.retExternId) | |
oprot.writeFieldEnd() | |
if self.retObj is not None: | |
oprot.writeFieldBegin('retObj', TType.BOOL, 4) | |
oprot.writeBool(self.retObj) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
if self.r is None: | |
raise TProtocol.TProtocolException(message='Required field r is unset!') | |
if self.queryObj is None: | |
raise TProtocol.TProtocolException(message='Required field queryObj is unset!') | |
if self.retExternId is None: | |
raise TProtocol.TProtocolException(message='Required field retExternId is unset!') | |
if self.retObj is None: | |
raise TProtocol.TProtocolException(message='Required field retObj is unset!') | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.r) | |
value = (value * 31) ^ hash(self.queryObj) | |
value = (value * 31) ^ hash(self.retExternId) | |
value = (value * 31) ^ hash(self.retObj) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class rangeQuery_result: | |
""" | |
Attributes: | |
- success | |
- err | |
""" | |
thrift_spec = ( | |
(0, TType.LIST, 'success', (TType.STRUCT,(ReplyEntry, ReplyEntry.thrift_spec)), None, ), # 0 | |
(1, TType.STRUCT, 'err', (QueryException, QueryException.thrift_spec), None, ), # 1 | |
) | |
def __init__(self, success=None, err=None,): | |
self.success = success | |
self.err = err | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 0: | |
if ftype == TType.LIST: | |
self.success = [] | |
(_etype10, _size7) = iprot.readListBegin() | |
for _i11 in xrange(_size7): | |
_elem12 = ReplyEntry() | |
_elem12.read(iprot) | |
self.success.append(_elem12) | |
iprot.readListEnd() | |
else: | |
iprot.skip(ftype) | |
elif fid == 1: | |
if ftype == TType.STRUCT: | |
self.err = QueryException() | |
self.err.read(iprot) | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('rangeQuery_result') | |
if self.success is not None: | |
oprot.writeFieldBegin('success', TType.LIST, 0) | |
oprot.writeListBegin(TType.STRUCT, len(self.success)) | |
for iter13 in self.success: | |
iter13.write(oprot) | |
oprot.writeListEnd() | |
oprot.writeFieldEnd() | |
if self.err is not None: | |
oprot.writeFieldBegin('err', TType.STRUCT, 1) | |
self.err.write(oprot) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.success) | |
value = (value * 31) ^ hash(self.err) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class getDistance_args: | |
""" | |
Attributes: | |
- obj1 | |
- obj2 | |
""" | |
thrift_spec = ( | |
None, # 0 | |
(1, TType.STRING, 'obj1', None, None, ), # 1 | |
(2, TType.STRING, 'obj2', None, None, ), # 2 | |
) | |
def __init__(self, obj1=None, obj2=None,): | |
self.obj1 = obj1 | |
self.obj2 = obj2 | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 1: | |
if ftype == TType.STRING: | |
self.obj1 = iprot.readString(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 2: | |
if ftype == TType.STRING: | |
self.obj2 = iprot.readString(); | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('getDistance_args') | |
if self.obj1 is not None: | |
oprot.writeFieldBegin('obj1', TType.STRING, 1) | |
oprot.writeString(self.obj1) | |
oprot.writeFieldEnd() | |
if self.obj2 is not None: | |
oprot.writeFieldBegin('obj2', TType.STRING, 2) | |
oprot.writeString(self.obj2) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
if self.obj1 is None: | |
raise TProtocol.TProtocolException(message='Required field obj1 is unset!') | |
if self.obj2 is None: | |
raise TProtocol.TProtocolException(message='Required field obj2 is unset!') | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.obj1) | |
value = (value * 31) ^ hash(self.obj2) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) | |
class getDistance_result: | |
""" | |
Attributes: | |
- success | |
- err | |
""" | |
thrift_spec = ( | |
(0, TType.DOUBLE, 'success', None, None, ), # 0 | |
(1, TType.STRUCT, 'err', (QueryException, QueryException.thrift_spec), None, ), # 1 | |
) | |
def __init__(self, success=None, err=None,): | |
self.success = success | |
self.err = err | |
def read(self, iprot): | |
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: | |
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) | |
return | |
iprot.readStructBegin() | |
while True: | |
(fname, ftype, fid) = iprot.readFieldBegin() | |
if ftype == TType.STOP: | |
break | |
if fid == 0: | |
if ftype == TType.DOUBLE: | |
self.success = iprot.readDouble(); | |
else: | |
iprot.skip(ftype) | |
elif fid == 1: | |
if ftype == TType.STRUCT: | |
self.err = QueryException() | |
self.err.read(iprot) | |
else: | |
iprot.skip(ftype) | |
else: | |
iprot.skip(ftype) | |
iprot.readFieldEnd() | |
iprot.readStructEnd() | |
def write(self, oprot): | |
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: | |
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) | |
return | |
oprot.writeStructBegin('getDistance_result') | |
if self.success is not None: | |
oprot.writeFieldBegin('success', TType.DOUBLE, 0) | |
oprot.writeDouble(self.success) | |
oprot.writeFieldEnd() | |
if self.err is not None: | |
oprot.writeFieldBegin('err', TType.STRUCT, 1) | |
self.err.write(oprot) | |
oprot.writeFieldEnd() | |
oprot.writeFieldStop() | |
oprot.writeStructEnd() | |
def validate(self): | |
return | |
def __hash__(self): | |
value = 17 | |
value = (value * 31) ^ hash(self.success) | |
value = (value * 31) ^ hash(self.err) | |
return value | |
def __repr__(self): | |
L = ['%s=%r' % (key, value) | |
for key, value in self.__dict__.iteritems()] | |
return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | |
def __ne__(self, other): | |
return not (self == other) |