[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.
This commit is contained in:
Calum Lind 2015-10-24 13:26:59 +01:00
parent d280fa9fbd
commit 2583e9d888
11 changed files with 28 additions and 28 deletions

View File

@ -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))

View File

@ -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()

View File

@ -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):

View File

@ -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

View File

@ -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..")

View File

@ -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:

View File

@ -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)))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]