diff --git a/.pylintrc b/.pylintrc index 1cfda0b8a1..524e8cce9f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -62,8 +62,7 @@ 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, bad-continuation, wrong-import-position, - wrong-import-order, +disable=missing-docstring, invalid-name, wrong-import-position, wrong-import-order, no-member, not-callable, no-name-in-module, locally-disabled, R, diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 7f6f46184c..acdc63260c 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -1009,8 +1009,8 @@ def _create_status_funcs(self): "save_path": lambda: self.options["download_location"], # Deprecated, use download_location "download_location": lambda: self.options["download_location"], "seeding_time": lambda: self.status.seeding_time, - "seeds_peers_ratio": lambda: -1.0 if self.status.num_incomplete == 0 else - self.status.num_complete / self.status.num_incomplete, # Use -1.0 to signify infinity + "seeds_peers_ratio": lambda: -1.0 if self.status.num_incomplete == 0 else ( # Use -1.0 to signify infinity + self.status.num_complete / self.status.num_incomplete), "seed_rank": lambda: self.status.seed_rank, "state": lambda: self.state, "stop_at_ratio": lambda: self.options["stop_at_ratio"], @@ -1087,7 +1087,7 @@ def resume(self): elif self.forced_error and self.forced_error.was_paused: log.debug("Resume skipped for error'd torrent as it was originally paused.") elif (self.status.is_finished and self.options["stop_at_ratio"] and - self.get_ratio() >= self.options["stop_ratio"]): + self.get_ratio() >= self.options["stop_ratio"]): log.debug("Resume skipped for torrent as it has reached 'stop_seed_ratio'.") else: # Check if torrent was originally being auto-managed. diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 1d62b3d779..e158e891f6 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -66,8 +66,7 @@ def __init__(self, shared=False, super_seeding=False, priority=0, - name=None - ): + name=None): # Build the class atrribute list from args for key, value in locals().items(): if key == "self": diff --git a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py index fa108b9147..8c8c91b3fc 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py @@ -30,20 +30,22 @@ log = logging.getLogger(__name__) -DEFAULT_CONF = {'version': 1, - 'colors': { - 'bandwidth_graph': {'upload_rate': str(gtk.gdk.Color("blue")), - 'download_rate': str(gtk.gdk.Color("green")), - }, - 'connections_graph': {'dht_nodes': str(gtk.gdk.Color("orange")), - 'dht_cache_nodes': str(gtk.gdk.Color("blue")), - 'dht_torrents': str(gtk.gdk.Color("green")), - 'num_connections': str(gtk.gdk.Color("darkred")), - }, - 'seeds_graph': {'num_peers': str(gtk.gdk.Color("blue")), - }, - } - } +DEFAULT_CONF = { + 'version': 1, + 'colors': { + 'bandwidth_graph': { + 'upload_rate': str(gtk.gdk.Color("blue")), + 'download_rate': str(gtk.gdk.Color("green")), + }, + 'connections_graph': { + 'dht_nodes': str(gtk.gdk.Color("orange")), + 'dht_cache_nodes': str(gtk.gdk.Color("blue")), + 'dht_torrents': str(gtk.gdk.Color("green")), + 'num_connections': str(gtk.gdk.Color("darkred")), + }, + 'seeds_graph': { + 'num_peers': str(gtk.gdk.Color("blue")), + }}} def neat_time(column, cell, model, data): diff --git a/deluge/ui/common.py b/deluge/ui/common.py index a4bf424bdc..245a093b59 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -305,12 +305,14 @@ def walk(directory, parent_path): for path in directory["contents"].keys(): full_path = os.path.join(parent_path, path).replace("\\", "/") if directory["contents"][path]["type"] == "dir": - directory["contents"][path] = callback(full_path, directory["contents"][path] - ) or directory["contents"][path] + directory["contents"][path] = callback( + full_path, directory["contents"][path] + ) or directory["contents"][path] walk(directory["contents"][path], full_path) else: - directory["contents"][path] = callback(full_path, directory["contents"][path] - ) or directory["contents"][path] + directory["contents"][path] = callback( + full_path, directory["contents"][path] + ) or directory["contents"][path] walk(self.tree, "") def __str__(self): diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index eadf57c4bc..6a178db41e 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -324,9 +324,9 @@ def on_connect_failed(reason, host_id): user = row[HOSTLIST_COL_USER] if client.connected() and ( - gethostbyname(host), - port, - "localclient" if not user and host in ("127.0.0.1", "localhost") else user + gethostbyname(host), + port, + "localclient" if not user and host in ("127.0.0.1", "localhost") else user ) == client.connection_info(): def on_info(info, row): if not self.running: diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py index 4c9930f756..cfe4aa0468 100644 --- a/deluge/ui/gtkui/mainwindow.py +++ b/deluge/ui/gtkui/mainwindow.py @@ -80,24 +80,19 @@ def patched_connect_signals(*a, **k): # Get the gtk builder file for the main window self.main_builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "main_window.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "main_window.ui"))) # The new release dialog self.main_builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "main_window.new_release.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "main_window.new_release.ui"))) # The tabs self.main_builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.ui"))) # The tabs file menu self.main_builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_file.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_file.ui"))) # The tabs peer menu self.main_builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_peer.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "main_window.tabs.menu_peer.ui"))) self.window = self.main_builder.get_object("main_window") diff --git a/deluge/ui/gtkui/path_combo_chooser.py b/deluge/ui/gtkui/path_combo_chooser.py index ee12c7b116..4c41f16d87 100755 --- a/deluge/ui/gtkui/path_combo_chooser.py +++ b/deluge/ui/gtkui/path_combo_chooser.py @@ -791,9 +791,7 @@ def on_buttonbox_key_press_event(self, widget, event): """ keyval = event.keyval state = event.state & gtk.accelerator_get_default_mod_mask() - if (keyval == keysyms.Escape or - (key_is_up(keyval) and - state == gdk.MOD1_MASK)): + if keyval == keysyms.Escape or (key_is_up(keyval) and state == gdk.MOD1_MASK): self.popdown() return True return False diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 83677a10ce..76c573ff53 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -833,10 +833,11 @@ def on_toggle(self, widget): except Exception: return - path_choosers = {"download_location_path_chooser": self.download_location_path_chooser, - "move_completed_path_chooser": self.move_completed_path_chooser, - "torrentfiles_location_path_chooser": self.copy_torrent_files_path_chooser - } + path_choosers = { + "download_location_path_chooser": self.download_location_path_chooser, + "move_completed_path_chooser": self.move_completed_path_chooser, + "torrentfiles_location_path_chooser": self.copy_torrent_files_path_chooser + } dependents = { "chk_show_dialog": {"chk_focus_dialog": True}, diff --git a/deluge/ui/gtkui/queuedtorrents.py b/deluge/ui/gtkui/queuedtorrents.py index a3689b746f..9f22b5bd82 100644 --- a/deluge/ui/gtkui/queuedtorrents.py +++ b/deluge/ui/gtkui/queuedtorrents.py @@ -31,8 +31,7 @@ def __init__(self): self.config = ConfigManager("gtkui.conf") self.builder = gtk.Builder() self.builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "queuedtorrents.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "queuedtorrents.ui"))) self.builder.get_object("chk_autoadd").set_active(self.config["autoadd_queued"]) self.dialog = self.builder.get_object("queued_torrents_dialog") self.dialog.set_icon(get_logo(32)) diff --git a/deluge/ui/gtkui/removetorrentdialog.py b/deluge/ui/gtkui/removetorrentdialog.py index 63000b1fd4..822f089f5e 100644 --- a/deluge/ui/gtkui/removetorrentdialog.py +++ b/deluge/ui/gtkui/removetorrentdialog.py @@ -41,8 +41,7 @@ def __init__(self, torrent_ids, delete_files=False): self.builder = gtk.Builder() self.builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "remove_torrent_dialog.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "remove_torrent_dialog.ui"))) self.__dialog = self.builder.get_object("remove_torrent_dialog") self.__dialog.set_transient_for(component.get("MainWindow").window) diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index 66ab3d8e8c..17e050eb55 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -64,8 +64,7 @@ def enable(self): """Enables the system tray icon.""" self.builder = gtk.Builder() self.builder.add_from_file(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "tray_menu.ui")) - ) + "deluge.ui.gtkui", os.path.join("glade", "tray_menu.ui"))) self.builder.connect_signals({ "on_menuitem_show_deluge_activate": self.on_menuitem_show_deluge_activate, diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index d511ccbeda..f31c444e50 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -42,22 +42,23 @@ # Cache the key used to calculate the current value set for the specific cell # renderer. This is much cheaper than fetch the current value and test if # it's equal. -func_last_value = {"cell_data_speed_down": None, - "cell_data_speed_up": None, - "cell_data_time": None, - "cell_data_ratio_seeds_peers": None, - "cell_data_ratio_ratio": None, - "cell_data_ratio_avail": None, - "cell_data_date_added": None, - "cell_data_date_completed": None, - "cell_data_date_or_never": None, - "cell_data_speed_limit_down": None, - "cell_data_speed_limit_up": None, - "cell_data_trackericon": None, - "cell_data_statusicon": None, - "cell_data_queue": None, - "cell_data_progress": [None, None], - } +func_last_value = { + "cell_data_speed_down": None, + "cell_data_speed_up": None, + "cell_data_time": None, + "cell_data_ratio_seeds_peers": None, + "cell_data_ratio_ratio": None, + "cell_data_ratio_avail": None, + "cell_data_date_added": None, + "cell_data_date_completed": None, + "cell_data_date_or_never": None, + "cell_data_speed_limit_down": None, + "cell_data_speed_limit_up": None, + "cell_data_trackericon": None, + "cell_data_statusicon": None, + "cell_data_queue": None, + "cell_data_progress": [None, None], +} def cell_data_statusicon(column, cell, model, row, data): diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index c9c5ced5d4..21c5d59a8b 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -766,9 +766,9 @@ def on_info(info): return client.daemon.info().addCallback(on_info) else: c = Client() - return c.connect(host, port, user, password - ).addCallback(on_connect, c, host_id - ).addErrback(on_connect_failed, host_id) + d = c.connect(host, port, user, password) + d.addCallback(on_connect, c, host_id).addErrback(on_connect_failed, host_id) + return d @export def start_daemon(self, port):