diff options
author | fedeG <federicogonzalez761@gmail.com> | 2015-04-20 22:06:20 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-20 23:01:53 +0200 |
commit | 5b728699354009e9387695f45e6e176a2ab39688 (patch) | |
tree | ec548ca980b3646d14e6306c27197c2bbcf16cb7 | |
parent | PEP-8, Python Zen, refactor and reduce code (part 15 in master module/webui/app) (diff) | |
download | pyload-5b728699354009e9387695f45e6e176a2ab39688.tar.xz |
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
-rw-r--r-- | pyload/remote/socketbackend/create_ttypes.py | 12 |
1 files 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)) |