diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2015-10-24 14:26:59 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2015-10-30 19:39:57 +0100 |
commit | 2583e9d888d1e77fd2b23218be5f3ff5294be7cc (patch) | |
tree | 3d88a5dad7ef9bd92a768ad69911428c07844f8d | |
parent | [Lint] Cleanup helper scripts to pass PyLint (diff) | |
download | deluge-2583e9d888d1e77fd2b23218be5f3ff5294be7cc.tar.xz deluge-2583e9d888d1e77fd2b23218be5f3ff5294be7cc.zip |
[Lint] Code cleanup for PyLint run by prospector tool
* Fix for pluginmanager multiple inheritance which in this case is using super incorrectly.
* Explicitly disable pylint 'pointless-except' and 'super-on-old-class' that prospector
tool somehow runs.
* Make __all__ a tuple to supress pep257 warning.
* Add a noqa for older versions of pyflakes.
-rw-r--r-- | deluge/core/pluginmanager.py | 4 | ||||
-rw-r--r-- | deluge/log.py | 2 | ||||
-rw-r--r-- | deluge/pluginmanagerbase.py | 2 | ||||
-rw-r--r-- | deluge/rencode.py | 2 | ||||
-rw-r--r-- | deluge/scripts/create_plugin.py | 6 | ||||
-rw-r--r-- | deluge/scripts/deluge_remote.py | 24 | ||||
-rw-r--r-- | deluge/scripts/wiki_docgen.py | 4 | ||||
-rw-r--r-- | deluge/transfer.py | 2 | ||||
-rw-r--r-- | deluge/ui/gtkui/dialogs.py | 1 | ||||
-rw-r--r-- | deluge/ui/web/json_api.py | 2 | ||||
-rw-r--r-- | pylintrc | 7 |
11 files changed, 28 insertions, 28 deletions
diff --git a/deluge/core/pluginmanager.py b/deluge/core/pluginmanager.py index 509299302..4b237dca8 100644 --- a/deluge/core/pluginmanager.py +++ b/deluge/core/pluginmanager.py @@ -53,13 +53,13 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Compon def enable_plugin(self, name): if name not in self.plugins: - super(PluginManager, self).enable_plugin(name) + deluge.pluginmanagerbase.PluginManagerBase.enable_plugin(self, name) if name in self.plugins: component.get("EventManager").emit(PluginEnabledEvent(name)) def disable_plugin(self, name): if name in self.plugins: - super(PluginManager, self).disable_plugin(name) + deluge.pluginmanagerbase.PluginManagerBase.disable_plugin(self, name) if name not in self.plugins: component.get("EventManager").emit(PluginDisabledEvent(name)) diff --git a/deluge/log.py b/deluge/log.py index 8a2ce2aea..4f541d33b 100644 --- a/deluge/log.py +++ b/deluge/log.py @@ -20,7 +20,7 @@ from twisted.python.log import PythonLoggingObserver from deluge import common -__all__ = ["setup_logger", "set_logger_level", "get_plugin_logger", "LOG"] +__all__ = ("setup_logger", "set_logger_level", "get_plugin_logger", "LOG") LoggingLoggerClass = logging.getLoggerClass() diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py index 6d6fd9425..8ca875e77 100644 --- a/deluge/pluginmanagerbase.py +++ b/deluge/pluginmanagerbase.py @@ -44,7 +44,7 @@ git repository to have an idea of what needs to be changed. """ -class PluginManagerBase: +class PluginManagerBase(object): """PluginManagerBase is a base class for PluginManagers to inherit""" def __init__(self, config_file, entry_name): diff --git a/deluge/rencode.py b/deluge/rencode.py index 9078bd5a2..d78fd78ab 100644 --- a/deluge/rencode.py +++ b/deluge/rencode.py @@ -63,7 +63,7 @@ from threading import Lock from types import DictType, FloatType, IntType, ListType, LongType, NoneType, StringType, TupleType, UnicodeType __version__ = '1.0.2' -__all__ = ['dumps', 'loads'] +__all__ = ('dumps', 'loads') # Default number of bits for serialized floats, either 32 or 64 (also a parameter for dumps()). DEFAULT_FLOAT_BITS = 32 diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index fb5f5304c..b8ae99350 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -71,7 +71,7 @@ def create_plugin(): return def write_file(path, filename, template, include_gpl=True): - args = { + plugin_args = { "author_name": options.author_name, "author_email": options.author_email, "name": name, @@ -87,8 +87,8 @@ def create_plugin(): filename = os.path.join(path, filename) f = open(filename, "w") if filename.endswith(".py") and include_gpl: - f.write(GPL % args) - f.write(template % args) + f.write(GPL % plugin_args) + f.write(template % plugin_args) f.close() print("creating folders..") diff --git a/deluge/scripts/deluge_remote.py b/deluge/scripts/deluge_remote.py index e619ed69b..922abd8c4 100644 --- a/deluge/scripts/deluge_remote.py +++ b/deluge/scripts/deluge_remote.py @@ -12,8 +12,8 @@ # Authour: Garett Harnish import logging +import sys from optparse import OptionParser -from sys import exit, stderr def is_float_digit(string): @@ -23,7 +23,7 @@ def is_float_digit(string): try: float(string) return True - except: + except ValueError: return False # set up command-line options @@ -57,38 +57,38 @@ if options.max_active_limit: if options.max_active_limit.isdigit() and int(options.max_active_limit) >= 0: settings['max_active_limit'] = int(options.max_active_limit) else: - stderr.write("ERROR: Invalid max_active_limit parameter!\n") - exit(-1) + sys.stderr.write("ERROR: Invalid max_active_limit parameter!\n") + sys.exit(-1) if options.max_active_downloading: if options.max_active_downloading.isdigit() and int(options.max_active_downloading) >= 0: settings['max_active_downloading'] = int(options.max_active_downloading) else: - stderr.write("ERROR: Invalid max_active_downloading parameter!\n") - exit(-1) + sys.stderr.write("ERROR: Invalid max_active_downloading parameter!\n") + sys.exit(-1) if options.max_active_seeding: if options.max_active_seeding.isdigit() and int(options.max_active_seeding) >= 0: settings['max_active_seeding'] = int(options.max_active_seeding) else: - stderr.write("ERROR: Invalid max_active_seeding parameter!\n") - exit(-1) + sys.stderr.write("ERROR: Invalid max_active_seeding parameter!\n") + sys.exit(-1) if options.max_download_speed: if is_float_digit(options.max_download_speed) and ( float(options.max_download_speed) >= 0.0 or float(options.max_download_speed) == -1.0): settings['max_download_speed'] = float(options.max_download_speed) else: - stderr.write("ERROR: Invalid max_download_speed parameter!\n") - exit(-1) + sys.stderr.write("ERROR: Invalid max_download_speed parameter!\n") + sys.exit(-1) if options.max_upload_speed: if is_float_digit(options.max_upload_speed) and ( float(options.max_upload_speed) >= 0.0 or float(options.max_upload_speed) == -1.0): settings['max_upload_speed'] = float(options.max_upload_speed) else: - stderr.write("ERROR: Invalid max_upload_speed parameter!\n") - exit(-1) + sys.stderr.write("ERROR: Invalid max_upload_speed parameter!\n") + sys.exit(-1) # If there is something to do ... if settings: diff --git a/deluge/scripts/wiki_docgen.py b/deluge/scripts/wiki_docgen.py index 19b70ff19..0043aa741 100644 --- a/deluge/scripts/wiki_docgen.py +++ b/deluge/scripts/wiki_docgen.py @@ -38,7 +38,7 @@ if 0: # aclient non-core func = getattr(aclient, method_name) try: params = inspect.getargspec(func)[0][1:] - except: + except Exception: continue print("\n'''%s(%s): '''\n" % (method_name, ", ".join(params))) @@ -57,7 +57,7 @@ if 1: # baseclient/core func = getattr(Core, m) params = inspect.getargspec(func)[0][1:] - if (aclient.has_callback(method_name) and method_name not in ['add_torrent_file_binary']): + if aclient.has_callback(method_name) and method_name not in ['add_torrent_file_binary']: params = ["[callback]"] + params print("\n'''%s(%s): '''\n" % (method_name, ", ".join(params))) diff --git a/deluge/transfer.py b/deluge/transfer.py index 7f8de0902..45b809dc7 100644 --- a/deluge/transfer.py +++ b/deluge/transfer.py @@ -8,7 +8,7 @@ # try: - import rencode # pylint: disable=relative-import + import rencode # pylint: disable=useless-suppression,relative-import except ImportError: import deluge.rencode as rencode diff --git a/deluge/ui/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index 3bbafa0e2..97172571a 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -6,7 +6,6 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # -# pylint: disable=super-on-old-class import gtk from twisted.internet import defer diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index b1c3d751b..b5a7ea933 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -60,7 +60,7 @@ def export(auth_level=AUTH_LEVEL_DEFAULT): """ global AUTH_LEVEL_DEFAULT, AuthError if AUTH_LEVEL_DEFAULT is None: - from deluge.ui.web.auth import AUTH_LEVEL_DEFAULT, AuthError # pylint: disable=redefined-outer-name + from deluge.ui.web.auth import AUTH_LEVEL_DEFAULT, AuthError # NOQA pylint: disable=redefined-outer-name def wrap(func, *args, **kwargs): func._json_export = True @@ -66,12 +66,13 @@ confidence= # Arranged by category: Convention, Error, Information, Refactor, Warning. # Category per line (wrapped categories are indented) using symbolic names instead of ids. disable=missing-docstring, invalid-name, old-style-class, bad-continuation, - no-member, not-callable, no-name-in-module, + no-member, not-callable, no-name-in-module, super-on-old-class, locally-disabled, R, - unused-argument, broad-except, fixme, protected-access, import-error, unidiomatic-typecheck, + unused-argument, fixme, protected-access, import-error, unidiomatic-typecheck, unused-variable, global-statement, attribute-defined-outside-init, arguments-differ, - no-init, non-parent-init-called, super-init-not-called, signature-differs + no-init, non-parent-init-called, super-init-not-called, signature-differs, + broad-except, pointless-except [REPORTS] |