From b8942672378fccc7d557dfc2e40a4d90aecf7a0d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 28 Jun 2014 15:53:29 +0200 Subject: [Lib] Revert libraries to original status (remove all cosmetics optimizations) --- module/lib/thrift/protocol/TBase.py | 7 ++++--- module/lib/thrift/protocol/TBinaryProtocol.py | 2 +- module/lib/thrift/protocol/TProtocol.py | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'module/lib/thrift/protocol') diff --git a/module/lib/thrift/protocol/TBase.py b/module/lib/thrift/protocol/TBase.py index 08e154026..e675c7dc0 100644 --- a/module/lib/thrift/protocol/TBase.py +++ b/module/lib/thrift/protocol/TBase.py @@ -43,10 +43,10 @@ class TBase(object): if my_val != other_val: return False return True - + def __ne__(self, other): return not (self == other) - + 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)) @@ -63,9 +63,10 @@ class TExceptionBase(Exception): # old style class so python2.4 can raise exceptions derived from this # This can't inherit from TBase because of that limitation. __slots__ = [] - + __repr__ = TBase.__repr__.im_func __eq__ = TBase.__eq__.im_func __ne__ = TBase.__ne__.im_func read = TBase.read.im_func write = TBase.write.im_func + diff --git a/module/lib/thrift/protocol/TBinaryProtocol.py b/module/lib/thrift/protocol/TBinaryProtocol.py index 0cc44178c..50c6aa896 100644 --- a/module/lib/thrift/protocol/TBinaryProtocol.py +++ b/module/lib/thrift/protocol/TBinaryProtocol.py @@ -239,7 +239,7 @@ class TBinaryProtocolAccelerated(TBinaryProtocol): our C module to do the encoding, bypassing this object entirely. We inherit from TBinaryProtocol so that the normal TBinaryProtocol encoding can happen if the fastbinary module doesn't work for some - reason. (TODO(dreiss): Make this happen sanely in more cases.) + reason. (TODO(dreiss): Make this happen sanely in more cases.) In order to take advantage of the C module, just use TBinaryProtocolAccelerated instead of TBinaryProtocol. diff --git a/module/lib/thrift/protocol/TProtocol.py b/module/lib/thrift/protocol/TProtocol.py index 595ca5ae6..7338ff68a 100644 --- a/module/lib/thrift/protocol/TProtocol.py +++ b/module/lib/thrift/protocol/TProtocol.py @@ -202,7 +202,7 @@ class TProtocolBase: # tuple of: ( 'reader method' name, is_container boolean, 'writer_method' name ) _TTYPE_HANDLERS = ( - (None, None, False), # 0 == TType, STOP + (None, None, False), # 0 == TType,STOP (None, None, False), # 1 == TType.VOID # TODO: handle void? ('readBool', 'writeBool', False), # 2 == TType.BOOL ('readByte', 'writeByte', False), # 3 == TType.BYTE and I08 @@ -279,7 +279,7 @@ class TProtocolBase: obj = obj_class() obj.read(self) return obj - + def readContainerMap(self, spec): results = dict() key_ttype, key_spec = spec[0], spec[1] @@ -298,7 +298,7 @@ class TProtocolBase: v_val = val_reader() else: v_val = self.readFieldByTType(val_ttype, val_spec) - # this raises a TypeError with unhashable keys types. i.e. d=dict(); d[[0, 1]] = 2 fails + # this raises a TypeError with unhashable keys types. i.e. d=dict(); d[[0,1]] = 2 fails results[k_val] = v_val self.readMapEnd() return results @@ -401,3 +401,4 @@ class TProtocolBase: class TProtocolFactory: def getProtocol(self, trans): pass + -- cgit v1.2.3