From 3288353be0b021bd3e826dce6e12d13ad3afc31b Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 22 Oct 2015 13:49:19 +0100 Subject: [PATCH] [Lint] Cleanup code to pass PyLint Error category Disabled: * no-member: * not-callable: * no-name-in-module: --- deluge/config.py | 2 +- deluge/ui/console/commands/plugin.py | 10 +++++----- deluge/ui/gtkui/common.py | 4 ++-- deluge/ui/gtkui/createtorrentdialog.py | 2 +- deluge/ui/gtkui/dialogs.py | 1 + deluge/ui/gtkui/gtkui.py | 2 +- deluge/ui/gtkui/path_combo_chooser.py | 2 +- pylintrc | 10 +++++++--- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/deluge/config.py b/deluge/config.py index b5889ca9b..bbf7ad311 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -525,7 +525,7 @@ what is currently in the config and it could not convert the value return self.__config_file @prop - def config(): # pylint: disable=E0211 + def config(): # pylint: disable=no-method-argument """The config dictionary""" def fget(self): return self.__config diff --git a/deluge/ui/console/commands/plugin.py b/deluge/ui/console/commands/plugin.py index 149c3eff5..df89753a5 100644 --- a/deluge/ui/console/commands/plugin.py +++ b/deluge/ui/console/commands/plugin.py @@ -50,7 +50,7 @@ class Command(BaseCommand): self.console.write("{!green!}Plugin list successfully reloaded") return - if options["list"]: + elif options["list"]: def on_available_plugins(result): self.console.write("{!info!}Available Plugins:") for p in result: @@ -58,7 +58,7 @@ class Command(BaseCommand): return client.core.get_available_plugins().addCallback(on_available_plugins) - if options["show"]: + elif options["show"]: def on_enabled_plugins(result): self.console.write("{!info!}Enabled Plugins:") for p in result: @@ -66,7 +66,7 @@ class Command(BaseCommand): return client.core.get_enabled_plugins().addCallback(on_enabled_plugins) - if options["enable"]: + elif options["enable"]: def on_available_plugins(result): plugins = {} for p in result: @@ -79,7 +79,7 @@ class Command(BaseCommand): return client.core.get_available_plugins().addCallback(on_available_plugins) - if options["disable"]: + elif options["disable"]: def on_enabled_plugins(result): plugins = {} for p in result: @@ -92,7 +92,7 @@ class Command(BaseCommand): return client.core.get_enabled_plugins().addCallback(on_enabled_plugins) - if options["plugin_file"]: + elif options["plugin_file"]: filepath = options["plugin_file"] diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index 43f3a8ce7..6d734b725 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -166,7 +166,7 @@ def associate_magnet_links(overwrite=False): try: hkey = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "Magnet") - except WindowsError: # pylint: disable=E0602 + except WindowsError: # pylint: disable=undefined-variable overwrite = True else: _winreg.CloseKey(hkey) @@ -175,7 +175,7 @@ def associate_magnet_links(overwrite=False): deluge_exe = os.path.join(os.path.dirname(sys.executable), "deluge.exe") try: magnet_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT, "Magnet") - except WindowsError: # pylint: disable=E0602 + except WindowsError: # pylint: disable=undefined-variable # Could not create for all users, falling back to current user magnet_key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Classes\\Magnet") diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index c34ebfdd6..5cafc5ced 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -310,7 +310,7 @@ class CreateTorrentDialog: self._on_create_torrent_progress(piece_count, num_pieces) if piece_count == num_pieces: from twisted.internet import reactor - reactor.callLater(0.5, torrent_created) # pylint: disable=E1101 + reactor.callLater(0.5, torrent_created) client.register_event_handler("CreateTorrentProgressEvent", on_create_torrent_progress_event) diff --git a/deluge/ui/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index 97172571a..3bbafa0e2 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -6,6 +6,7 @@ # 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/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index ccc40a3f0..100512acf 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -57,7 +57,7 @@ gobject.set_prgname("deluge") log = logging.getLogger(__name__) try: - from setproctitle import setproctitle, getproctitle # pylint: disable=E0611 + from setproctitle import setproctitle, getproctitle except ImportError: def setproctitle(title): return diff --git a/deluge/ui/gtkui/path_combo_chooser.py b/deluge/ui/gtkui/path_combo_chooser.py index 1914fd485..a43fb9c45 100755 --- a/deluge/ui/gtkui/path_combo_chooser.py +++ b/deluge/ui/gtkui/path_combo_chooser.py @@ -438,7 +438,7 @@ class StoredValuesList(ValueList): return True # Add current value to saved list elif is_ascii_value(keyval, 's'): - super(PathChooserComboBox, self).add_current_value_to_saved_list() + super(PathChooserComboBox, self).add_current_value_to_saved_list() # pylint: disable=bad-super-call return True # Edit selected value elif is_ascii_value(keyval, 'e'): diff --git a/pylintrc b/pylintrc index 193c37b8b..be9fdba09 100644 --- a/pylintrc +++ b/pylintrc @@ -31,7 +31,7 @@ unsafe-load-any-extension=no # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code -extension-pkg-whitelist=libtorrent,gtk,gobject,gnome,twisted,wnck +extension-pkg-whitelist= # Allow optimization of some AST trees. This will activate a peephole AST # optimizer, which will apply various small optimizations. For instance, it can @@ -62,12 +62,16 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -#disable=all #disable=E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625, # W1624,W1609,W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020, # W1618,W1619,W1630,W1626,W1637,W1634,W1635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617, # W1632,W1633,W0704,W1628,W1629,W1636 -disable=E1101,E1102,no-name-in-module,W,C,R,locally-disabled, +disable=C, + no-member, not-callable, no-name-in-module, + W, + R, + locally-disabled + [REPORTS]