From 730b160e28d711fad96e6a61070e374ad0966566 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Apr 2015 01:07:33 +0200 Subject: Spare code cosmetics (2) --- pyload/remote/SocketBackend.py | 7 ++----- pyload/remote/thriftbackend/Processor.py | 3 ++- pyload/remote/thriftbackend/Protocol.py | 4 ++-- pyload/remote/thriftbackend/thriftgen/pyload/constants.py | 1 + 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'pyload/remote') diff --git a/pyload/remote/SocketBackend.py b/pyload/remote/SocketBackend.py index 6b88663f8..05b2d8425 100644 --- a/pyload/remote/SocketBackend.py +++ b/pyload/remote/SocketBackend.py @@ -4,22 +4,19 @@ import SocketServer from pyload.manager.Remote import BackendBase -class RequestHandler(SocketServer.BaseRequestHandler): +class RequestHandler(SocketServer.BaseRequestHandler): def setup(self): pass def handle(self): - print self.request.recv(1024) - class SocketBackend(BackendBase): - def setup(self, host, port): - #local only + # local only self.server = SocketServer.ThreadingTCPServer(("localhost", port), RequestHandler) diff --git a/pyload/remote/thriftbackend/Processor.py b/pyload/remote/thriftbackend/Processor.py index 24a0c05b6..7ccc2bee2 100644 --- a/pyload/remote/thriftbackend/Processor.py +++ b/pyload/remote/thriftbackend/Processor.py @@ -2,6 +2,7 @@ from pyload.remote.thriftbackend.thriftgen.pyload import Pyload + class Processor(Pyload.Processor): def __init__(self, *args, **kwargs): @@ -66,7 +67,7 @@ class Processor(Pyload.Processor): self._processMap[name](self, seqid, iprot, oprot) else: - #no permission + # no permission iprot.skip(Pyload.TType.STRUCT) iprot.readMessageEnd() # 21 - Not authorized diff --git a/pyload/remote/thriftbackend/Protocol.py b/pyload/remote/thriftbackend/Protocol.py index c020e7a23..cc5352d40 100644 --- a/pyload/remote/thriftbackend/Protocol.py +++ b/pyload/remote/thriftbackend/Protocol.py @@ -2,12 +2,13 @@ from thrift.protocol import TBinaryProtocol + class Protocol(TBinaryProtocol.TBinaryProtocol): def writeString(self, str): try: str = str.encode("utf8", "ignore") - except Exception, e: + except Exception: pass self.writeI32(len(str)) @@ -26,7 +27,6 @@ class Protocol(TBinaryProtocol.TBinaryProtocol): class ProtocolFactory(TBinaryProtocol.TBinaryProtocolFactory): - def getProtocol(self, trans): prot = Protocol(trans, self.strictRead, self.strictWrite) return prot diff --git a/pyload/remote/thriftbackend/thriftgen/pyload/constants.py b/pyload/remote/thriftbackend/thriftgen/pyload/constants.py index 3bdd64cc1..e0a811c8a 100644 --- a/pyload/remote/thriftbackend/thriftgen/pyload/constants.py +++ b/pyload/remote/thriftbackend/thriftgen/pyload/constants.py @@ -8,3 +8,4 @@ from thrift.Thrift import TType, TMessageType, TException from ttypes import * + -- cgit v1.2.3