diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py index 0b4b7d221..0d56b2bcf 100644 --- a/deluge/core/rpcserver.py +++ b/deluge/core/rpcserver.py @@ -210,15 +210,15 @@ class DelugeRPCProtocol(DelugeTransferProtocol): """ Sends an error response with the contents of the exception that was raised. """ - exceptionType, exceptionValue, dummy_exceptionTraceback = sys.exc_info() + exc_type, exc_value, dummy_exc_trace = sys.exc_info() formated_tb = traceback.format_exc() try: self.sendData(( RPC_ERROR, request_id, - exceptionType.__name__, - exceptionValue._args, - exceptionValue._kwargs, + exc_type.__name__, + exc_value._args, + exc_value._kwargs, formated_tb )) except AttributeError: @@ -227,7 +227,8 @@ class DelugeRPCProtocol(DelugeTransferProtocol): 'client. Wrapping it and resending. Error to ' 'send(causing exception goes next):\n%s', formated_tb) try: - raise WrappedException(str(exceptionValue), exceptionType.__name__, formated_tb) + raise WrappedException( + str(exc_value), exc_type.__name__, formated_tb) except WrappedException: send_error() except Exception as ex: diff --git a/deluge/event.py b/deluge/event.py index 63ef41da8..b80e12936 100644 --- a/deluge/event.py +++ b/deluge/event.py @@ -23,10 +23,10 @@ class DelugeEventMetaClass(type): """ This metaclass simply keeps a list of all events classes created. """ - def __init__(self, name, bases, dct): # pylint: disable=bad-mcs-method-argument - super(DelugeEventMetaClass, self).__init__(name, bases, dct) + def __init__(cls, name, bases, dct): # pylint: disable=bad-mcs-method-argument + super(DelugeEventMetaClass, cls).__init__(name, bases, dct) if name != 'DelugeEvent': - known_events[name] = self + known_events[name] = cls class DelugeEvent(object): diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py index 649e91334..27b0d3a2d 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py @@ -162,12 +162,12 @@ class Core(CorePluginBase): @export def set_config(self, config): - 'sets the config dictionary' + """Sets the config dictionary.""" for key in config: self.config[key] = config[key] self.config.save() @export def get_config(self): - 'returns the config dictionary' + """Returns the config dictionary.""" return self.config.config diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py index 1bfdfdf8c..834a45836 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py @@ -70,7 +70,7 @@ class LabelSidebarMenu(object): self.options_dialog.show(self.treeview.value) def on_show(self, widget=None, data=None): - 'No Label:disable options/del' + """No Label:disable options/del.""" log.debug('label-sidebar-popup:on-show') cat = self.treeview.cat @@ -182,7 +182,7 @@ class OptionsDialog(object): self.apply_sensitivity() def on_options_ok(self, event=None): - 'save options..' + """Save options.""" options = {} for spin_id in self.spin_ids: diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py index 2ba001328..46c6812d4 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py @@ -205,14 +205,14 @@ class Core(CorePluginBase, CoreNotifications): @export def set_config(self, config): - 'sets the config dictionary' + """Sets the config dictionary.""" for key in config: self.config[key] = config[key] self.config.save() @export def get_config(self): - 'returns the config dictionary' + """Returns the config dictionary.""" return self.config.config @export diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py index cacca7ed4..51030377c 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py @@ -508,7 +508,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): client.notifications.get_config().addCallback(self.cb_get_config) def cb_get_config(self, core_config): - 'callback for on show_prefs' + """Callback for on show_prefs.""" self.builder.get_object('smtp_host').set_text(core_config['smtp_host']) self.builder.get_object('smtp_port').set_value(core_config['smtp_port']) self.builder.get_object('smtp_user').set_text(core_config['smtp_user']) diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py index 30a692ef8..37830de6e 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py @@ -147,7 +147,7 @@ class Core(CorePluginBase): @export() def set_config(self, config): - 'sets the config dictionary' + """Sets the config dictionary.""" for key in config: self.config[key] = config[key] self.config.save() @@ -155,7 +155,7 @@ class Core(CorePluginBase): @export() def get_config(self): - 'returns the config dictionary' + """Returns the config dictionary.""" return self.config.config @export() diff --git a/deluge/plugins/Stats/deluge/plugins/stats/core.py b/deluge/plugins/Stats/deluge/plugins/stats/core.py index 5fc583f49..af2ccd26b 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/core.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/core.py @@ -197,17 +197,17 @@ class Core(CorePluginBase): @export def set_config(self, config): - 'sets the config dictionary' + """Sets the config dictionary.""" for key in config: self.config[key] = config[key] self.config.save() @export def get_config(self): - 'returns the config dictionary' + """Returns the config dictionary.""" return self.config.config @export def get_intervals(self): - 'Returns the available resolutions' + """Returns the available resolutions.""" return self.intervals diff --git a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py index 2409206c7..670e3cd82 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py @@ -272,5 +272,5 @@ class GtkUI(GtkPluginBase): client.stats.get_config().addCallback(self.cb_get_config) def cb_get_config(self, config): - 'callback for on show_prefs' + """Callback for on show_prefs.""" pass diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/core.py b/deluge/plugins/WebUi/deluge/plugins/webui/core.py index 45f780c56..2e94b7556 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/core.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/core.py @@ -96,7 +96,7 @@ class Core(CorePluginBase): @export def set_config(self, config): - 'sets the config dictionary' + """Sets the config dictionary.""" action = None if 'enabled' in config: @@ -120,5 +120,5 @@ class Core(CorePluginBase): @export def get_config(self): - 'returns the config dictionary' + """Returns the config dictionary.""" return self.config.config diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py index b09cc4361..91d85dfd8 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py @@ -57,7 +57,7 @@ class GtkUI(GtkPluginBase): client.webui.get_config().addCallback(self.cb_get_config) def cb_get_config(self, config): - 'callback for on show_prefs' + """Callback for on show_prefs.""" self.builder.get_object('enabled_checkbutton').set_active(config['enabled']) self.builder.get_object('ssl_checkbutton').set_active(config['ssl']) self.builder.get_object('port_spinbutton').set_value(config['port']) diff --git a/deluge/ui/console/cmdline/commands/halt.py b/deluge/ui/console/cmdline/commands/halt.py index 8bcb89869..ef22873e9 100644 --- a/deluge/ui/console/cmdline/commands/halt.py +++ b/deluge/ui/console/cmdline/commands/halt.py @@ -17,7 +17,7 @@ from . import BaseCommand class Command(BaseCommand): - 'Shutdown the deluge server' + """Shutdown the deluge server.""" def handle(self, options): self.console = component.get('ConsoleUI') diff --git a/deluge/ui/console/modes/cmdline.py b/deluge/ui/console/modes/cmdline.py index 02b4e1ad7..f2fe6e8a4 100644 --- a/deluge/ui/console/modes/cmdline.py +++ b/deluge/ui/console/modes/cmdline.py @@ -20,8 +20,8 @@ import deluge.configmanager from deluge.decorators import overrides from deluge.ui.console.cmdline.command import Commander from deluge.ui.console.modes.basemode import BaseMode, move_cursor -from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import colors +from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, strwidth try: @@ -36,7 +36,10 @@ MAX_HISTFILE_SIZE = 2000 def complete_line(line, possible_matches): - 'Find the common prefix of possible matches, proritizing matching-case elements' + """Find the common prefix of possible matches. + + Proritizing matching-case elements. + """ if not possible_matches: return line @@ -80,7 +83,7 @@ def complete_line(line, possible_matches): def commonprefix(m): - 'Given a list of pathnames, returns the longest common leading component' + """Returns the longest common leading component from list of pathnames.""" if not m: return '' s1 = min(m) diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index 7402b1bed..86f54f8a2 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -18,8 +18,8 @@ from deluge.ui.client import client from deluge.ui.common import FILE_PRIORITY from deluge.ui.console.modes.basemode import BaseMode from deluge.ui.console.modes.torrentlist.torrentactions import ACTION, torrent_actions_popup -from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import colors +from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils.column import get_column_value, torrent_data_fields from deluge.ui.console.utils.format_utils import format_priority, format_progress, format_row from deluge.ui.console.widgets.popup import InputPopup, MessagePopup, PopupsHandler, SelectablePopup diff --git a/deluge/ui/console/modes/torrentlist/torrentview.py b/deluge/ui/console/modes/torrentlist/torrentview.py index 3015faa54..967aa26d4 100644 --- a/deluge/ui/console/modes/torrentlist/torrentview.py +++ b/deluge/ui/console/modes/torrentlist/torrentview.py @@ -216,7 +216,7 @@ class TorrentView(InputKeyHandler): return False def _sort_torrents(self, state): - 'sorts by primary and secondary sort fields' + """Sorts by primary and secondary sort fields.""" if not state: return {} diff --git a/deluge/ui/console/widgets/fields.py b/deluge/ui/console/widgets/fields.py index 6fda24690..a89b5b483 100644 --- a/deluge/ui/console/widgets/fields.py +++ b/deluge/ui/console/widgets/fields.py @@ -16,8 +16,8 @@ import os from deluge.decorators import overrides from deluge.ui.console.modes.basemode import InputKeyHandler -from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import colors +from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, wrap_string try: diff --git a/deluge/ui/console/widgets/popup.py b/deluge/ui/console/widgets/popup.py index 18ec8d24a..dc0fbd599 100644 --- a/deluge/ui/console/widgets/popup.py +++ b/deluge/ui/console/widgets/popup.py @@ -228,7 +228,7 @@ class SelectablePopup(BaseInputPane, Popup): return Popup.visible_content_pane_height.fget(self) def current_selection(self): - 'Returns a tuple of (selected index, selected data)' + """Returns a tuple of (selected index, selected data).""" return self.active_input def set_selection(self, index): diff --git a/deluge/ui/gtkui/filtertreeview.py b/deluge/ui/gtkui/filtertreeview.py index eda7295f5..a6a87f0e6 100644 --- a/deluge/ui/gtkui/filtertreeview.py +++ b/deluge/ui/gtkui/filtertreeview.py @@ -335,7 +335,7 @@ class FilterTreeView(component.Component): item.set_sensitive(sensitive) def select_all(self): - 'for use in popup menu' + """For use in popup menu.""" component.get('TorrentView').treeview.get_selection().select_all() def on_select_all(self, event):