THRIFT-3506 Eliminate old style classes from library code
Client: Python
Patch: Nobuaki Sukegawa
This closes #758
diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index cbb9184..11ee796 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -20,7 +20,7 @@
import sys
-class TType:
+class TType(object):
STOP = 0
VOID = 1
BOOL = 2
@@ -59,14 +59,14 @@
'UTF16')
-class TMessageType:
+class TMessageType(object):
CALL = 1
REPLY = 2
EXCEPTION = 3
ONEWAY = 4
-class TProcessor:
+class TProcessor(object):
"""Base class for procsessor, which works on two streams."""
def process(iprot, oprot):
diff --git a/lib/py/src/protocol/TBinaryProtocol.py b/lib/py/src/protocol/TBinaryProtocol.py
index f92f558..43cb5a4 100644
--- a/lib/py/src/protocol/TBinaryProtocol.py
+++ b/lib/py/src/protocol/TBinaryProtocol.py
@@ -223,7 +223,7 @@
return s
-class TBinaryProtocolFactory:
+class TBinaryProtocolFactory(object):
def __init__(self, strictRead=False, strictWrite=True):
self.strictRead = strictRead
self.strictWrite = strictWrite
@@ -255,6 +255,6 @@
pass
-class TBinaryProtocolAcceleratedFactory:
+class TBinaryProtocolAcceleratedFactory(object):
def getProtocol(self, trans):
return TBinaryProtocolAccelerated(trans)
diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py
index b8d171e..a8b025a 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -79,7 +79,7 @@
shift += 7
-class CompactType:
+class CompactType(object):
STOP = 0x00
TRUE = 0x01
FALSE = 0x02
@@ -399,7 +399,7 @@
return TTYPES[byte & 0x0f]
-class TCompactProtocolFactory:
+class TCompactProtocolFactory(object):
def __init__(self):
pass
diff --git a/lib/py/src/protocol/TJSONProtocol.py b/lib/py/src/protocol/TJSONProtocol.py
index 3539412..acfce4a 100644
--- a/lib/py/src/protocol/TJSONProtocol.py
+++ b/lib/py/src/protocol/TJSONProtocol.py
@@ -559,7 +559,7 @@
self.writeJSONBase64(binary)
-class TJSONProtocolFactory:
+class TJSONProtocolFactory(object):
def getProtocol(self, trans):
return TJSONProtocol(trans)
diff --git a/lib/py/src/protocol/TProtocol.py b/lib/py/src/protocol/TProtocol.py
index 1d703e3..be2fcea 100644
--- a/lib/py/src/protocol/TProtocol.py
+++ b/lib/py/src/protocol/TProtocol.py
@@ -39,7 +39,7 @@
self.type = type
-class TProtocolBase:
+class TProtocolBase(object):
"""Base class for Thrift protocol driver."""
def __init__(self, trans):
@@ -445,6 +445,6 @@
"i64 requires -9223372036854775808 <= number <= 9223372036854775807")
-class TProtocolFactory:
+class TProtocolFactory(object):
def getProtocol(self, trans):
pass
diff --git a/lib/py/src/server/TNonblockingServer.py b/lib/py/src/server/TNonblockingServer.py
index 79748b7..a930a80 100644
--- a/lib/py/src/server/TNonblockingServer.py
+++ b/lib/py/src/server/TNonblockingServer.py
@@ -88,7 +88,7 @@
return read
-class Connection:
+class Connection(object):
"""Basic class is represented connection.
It can be in state:
@@ -222,7 +222,7 @@
self.socket.close()
-class TNonblockingServer:
+class TNonblockingServer(object):
"""Non-blocking server."""
def __init__(self,
diff --git a/lib/py/src/server/TServer.py b/lib/py/src/server/TServer.py
index 130f730..30f063b 100644
--- a/lib/py/src/server/TServer.py
+++ b/lib/py/src/server/TServer.py
@@ -31,7 +31,7 @@
from thrift.transport import TTransport
-class TServer:
+class TServer(object):
"""Base interface for a server, which must have a serve() method.
Three constructors for all servers:
diff --git a/lib/py/src/transport/TTransport.py b/lib/py/src/transport/TTransport.py
index 92dc4cd..8e2da8d 100644
--- a/lib/py/src/transport/TTransport.py
+++ b/lib/py/src/transport/TTransport.py
@@ -36,7 +36,7 @@
self.type = type
-class TTransportBase:
+class TTransportBase(object):
"""Base class for Thrift transport layer."""
def isOpen(self):
@@ -72,7 +72,7 @@
# This class should be thought of as an interface.
-class CReadableTransport:
+class CReadableTransport(object):
"""base class for transports that are readable from C"""
# TODO(dreiss): Think about changing this interface to allow us to use
@@ -100,7 +100,7 @@
pass
-class TServerTransportBase:
+class TServerTransportBase(object):
"""Base class for Thrift server transports."""
def listen(self):
@@ -113,14 +113,14 @@
pass
-class TTransportFactoryBase:
+class TTransportFactoryBase(object):
"""Base class for a Transport Factory"""
def getTransport(self, trans):
return trans
-class TBufferedTransportFactory:
+class TBufferedTransportFactory(object):
"""Factory transport that builds buffered transports"""
def getTransport(self, trans):
@@ -244,7 +244,7 @@
raise EOFError()
-class TFramedTransportFactory:
+class TFramedTransportFactory(object):
"""Factory transport that builds framed transports"""
def getTransport(self, trans):