From 5b728699354009e9387695f45e6e176a2ab39688 Mon Sep 17 00:00:00 2001 From: fedeG Date: Mon, 20 Apr 2015 22:06:20 +0200 Subject: PEP-8, Python Zen, refactor and reduce code (part 12 in master module/remote/socketbackend) Conflicts: module/remote/socketbackend/ttypes.py pyload/remote/socketbackend/create_ttypes.py --- pyload/remote/socketbackend/create_ttypes.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyload/remote/socketbackend/create_ttypes.py b/pyload/remote/socketbackend/create_ttypes.py index 26dd5d06b..00752dc6b 100644 --- a/pyload/remote/socketbackend/create_ttypes.py +++ b/pyload/remote/socketbackend/create_ttypes.py @@ -14,7 +14,6 @@ from pyload.remote.thriftbackend.thriftgen.pyload.Pyload import Iface def main(): - enums = [] classes = [] @@ -23,11 +22,12 @@ def main(): for name in dir(ttypes): klass = getattr(ttypes, name) - if name in ("TBase", "TExceptionBase") or name.startswith("_") or not (issubclass(klass, ttypes.TBase) or issubclass(klass, ttypes.TExceptionBase)): + if name in ("TBase", "TExceptionBase") or name.startswith("_") or not ( + issubclass(klass, ttypes.TBase) or issubclass(klass, ttypes.TExceptionBase)): continue if hasattr(klass, "thrift_spec"): - classes.append(klass) + classes.append(klass) else: enums.append(klass) @@ -44,7 +44,7 @@ class BaseObject(object): """) - ## generate enums + # generate enums for enum in enums: name = enum.__name__ f.write("class %s:\n" % name) @@ -60,10 +60,10 @@ class BaseObject(object): for klass in classes: name = klass.__name__ base = "Exception" if issubclass(klass, ttypes.TExceptionBase) else "BaseObject" - f.write("class %s(%s):\n" % (name, base)) + f.write("class %s(%s):\n" % (name, base)) f.write("\t__slots__ = %s\n\n" % klass.__slots__) - #create init + # create init args = ["self"] + ["%s=None" % x for x in klass.__slots__] f.write("\tdef __init__(%s):\n" % ", ".join(args)) -- cgit v1.2.3