mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
[Flake8] Fix import and docstrings issues
This commit is contained in:
parent
ff85c334c7
commit
ee196f5035
18 changed files with 37 additions and 33 deletions
|
@ -210,15 +210,15 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
"""
|
"""
|
||||||
Sends an error response with the contents of the exception that was raised.
|
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()
|
formated_tb = traceback.format_exc()
|
||||||
try:
|
try:
|
||||||
self.sendData((
|
self.sendData((
|
||||||
RPC_ERROR,
|
RPC_ERROR,
|
||||||
request_id,
|
request_id,
|
||||||
exceptionType.__name__,
|
exc_type.__name__,
|
||||||
exceptionValue._args,
|
exc_value._args,
|
||||||
exceptionValue._kwargs,
|
exc_value._kwargs,
|
||||||
formated_tb
|
formated_tb
|
||||||
))
|
))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -227,7 +227,8 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
'client. Wrapping it and resending. Error to '
|
'client. Wrapping it and resending. Error to '
|
||||||
'send(causing exception goes next):\n%s', formated_tb)
|
'send(causing exception goes next):\n%s', formated_tb)
|
||||||
try:
|
try:
|
||||||
raise WrappedException(str(exceptionValue), exceptionType.__name__, formated_tb)
|
raise WrappedException(
|
||||||
|
str(exc_value), exc_type.__name__, formated_tb)
|
||||||
except WrappedException:
|
except WrappedException:
|
||||||
send_error()
|
send_error()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
|
|
@ -23,10 +23,10 @@ class DelugeEventMetaClass(type):
|
||||||
"""
|
"""
|
||||||
This metaclass simply keeps a list of all events classes created.
|
This metaclass simply keeps a list of all events classes created.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, bases, dct): # pylint: disable=bad-mcs-method-argument
|
def __init__(cls, name, bases, dct): # pylint: disable=bad-mcs-method-argument
|
||||||
super(DelugeEventMetaClass, self).__init__(name, bases, dct)
|
super(DelugeEventMetaClass, cls).__init__(name, bases, dct)
|
||||||
if name != 'DelugeEvent':
|
if name != 'DelugeEvent':
|
||||||
known_events[name] = self
|
known_events[name] = cls
|
||||||
|
|
||||||
|
|
||||||
class DelugeEvent(object):
|
class DelugeEvent(object):
|
||||||
|
|
|
@ -162,12 +162,12 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
'sets the config dictionary'
|
"""Sets the config dictionary."""
|
||||||
for key in config:
|
for key in config:
|
||||||
self.config[key] = config[key]
|
self.config[key] = config[key]
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
'returns the config dictionary'
|
"""Returns the config dictionary."""
|
||||||
return self.config.config
|
return self.config.config
|
||||||
|
|
|
@ -70,7 +70,7 @@ class LabelSidebarMenu(object):
|
||||||
self.options_dialog.show(self.treeview.value)
|
self.options_dialog.show(self.treeview.value)
|
||||||
|
|
||||||
def on_show(self, widget=None, data=None):
|
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')
|
log.debug('label-sidebar-popup:on-show')
|
||||||
|
|
||||||
cat = self.treeview.cat
|
cat = self.treeview.cat
|
||||||
|
@ -182,7 +182,7 @@ class OptionsDialog(object):
|
||||||
self.apply_sensitivity()
|
self.apply_sensitivity()
|
||||||
|
|
||||||
def on_options_ok(self, event=None):
|
def on_options_ok(self, event=None):
|
||||||
'save options..'
|
"""Save options."""
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
for spin_id in self.spin_ids:
|
for spin_id in self.spin_ids:
|
||||||
|
|
|
@ -205,14 +205,14 @@ class Core(CorePluginBase, CoreNotifications):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
'sets the config dictionary'
|
"""Sets the config dictionary."""
|
||||||
for key in config:
|
for key in config:
|
||||||
self.config[key] = config[key]
|
self.config[key] = config[key]
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
'returns the config dictionary'
|
"""Returns the config dictionary."""
|
||||||
return self.config.config
|
return self.config.config
|
||||||
|
|
||||||
@export
|
@export
|
||||||
|
|
|
@ -508,7 +508,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
||||||
client.notifications.get_config().addCallback(self.cb_get_config)
|
client.notifications.get_config().addCallback(self.cb_get_config)
|
||||||
|
|
||||||
def cb_get_config(self, core_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_host').set_text(core_config['smtp_host'])
|
||||||
self.builder.get_object('smtp_port').set_value(core_config['smtp_port'])
|
self.builder.get_object('smtp_port').set_value(core_config['smtp_port'])
|
||||||
self.builder.get_object('smtp_user').set_text(core_config['smtp_user'])
|
self.builder.get_object('smtp_user').set_text(core_config['smtp_user'])
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
'sets the config dictionary'
|
"""Sets the config dictionary."""
|
||||||
for key in config:
|
for key in config:
|
||||||
self.config[key] = config[key]
|
self.config[key] = config[key]
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
@ -155,7 +155,7 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
'returns the config dictionary'
|
"""Returns the config dictionary."""
|
||||||
return self.config.config
|
return self.config.config
|
||||||
|
|
||||||
@export()
|
@export()
|
||||||
|
|
|
@ -197,17 +197,17 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
'sets the config dictionary'
|
"""Sets the config dictionary."""
|
||||||
for key in config:
|
for key in config:
|
||||||
self.config[key] = config[key]
|
self.config[key] = config[key]
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
'returns the config dictionary'
|
"""Returns the config dictionary."""
|
||||||
return self.config.config
|
return self.config.config
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_intervals(self):
|
def get_intervals(self):
|
||||||
'Returns the available resolutions'
|
"""Returns the available resolutions."""
|
||||||
return self.intervals
|
return self.intervals
|
||||||
|
|
|
@ -272,5 +272,5 @@ class GtkUI(GtkPluginBase):
|
||||||
client.stats.get_config().addCallback(self.cb_get_config)
|
client.stats.get_config().addCallback(self.cb_get_config)
|
||||||
|
|
||||||
def cb_get_config(self, config):
|
def cb_get_config(self, config):
|
||||||
'callback for on show_prefs'
|
"""Callback for on show_prefs."""
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
'sets the config dictionary'
|
"""Sets the config dictionary."""
|
||||||
|
|
||||||
action = None
|
action = None
|
||||||
if 'enabled' in config:
|
if 'enabled' in config:
|
||||||
|
@ -120,5 +120,5 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
'returns the config dictionary'
|
"""Returns the config dictionary."""
|
||||||
return self.config.config
|
return self.config.config
|
||||||
|
|
|
@ -57,7 +57,7 @@ class GtkUI(GtkPluginBase):
|
||||||
client.webui.get_config().addCallback(self.cb_get_config)
|
client.webui.get_config().addCallback(self.cb_get_config)
|
||||||
|
|
||||||
def cb_get_config(self, 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('enabled_checkbutton').set_active(config['enabled'])
|
||||||
self.builder.get_object('ssl_checkbutton').set_active(config['ssl'])
|
self.builder.get_object('ssl_checkbutton').set_active(config['ssl'])
|
||||||
self.builder.get_object('port_spinbutton').set_value(config['port'])
|
self.builder.get_object('port_spinbutton').set_value(config['port'])
|
||||||
|
|
|
@ -17,7 +17,7 @@ from . import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
'Shutdown the deluge server'
|
"""Shutdown the deluge server."""
|
||||||
|
|
||||||
def handle(self, options):
|
def handle(self, options):
|
||||||
self.console = component.get('ConsoleUI')
|
self.console = component.get('ConsoleUI')
|
||||||
|
|
|
@ -20,8 +20,8 @@ import deluge.configmanager
|
||||||
from deluge.decorators import overrides
|
from deluge.decorators import overrides
|
||||||
from deluge.ui.console.cmdline.command import Commander
|
from deluge.ui.console.cmdline.command import Commander
|
||||||
from deluge.ui.console.modes.basemode import BaseMode, move_cursor
|
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 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
|
from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, strwidth
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -36,7 +36,10 @@ MAX_HISTFILE_SIZE = 2000
|
||||||
|
|
||||||
|
|
||||||
def complete_line(line, possible_matches):
|
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:
|
if not possible_matches:
|
||||||
return line
|
return line
|
||||||
|
@ -80,7 +83,7 @@ def complete_line(line, possible_matches):
|
||||||
|
|
||||||
|
|
||||||
def commonprefix(m):
|
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:
|
if not m:
|
||||||
return ''
|
return ''
|
||||||
s1 = min(m)
|
s1 = min(m)
|
||||||
|
|
|
@ -18,8 +18,8 @@ from deluge.ui.client import client
|
||||||
from deluge.ui.common import FILE_PRIORITY
|
from deluge.ui.common import FILE_PRIORITY
|
||||||
from deluge.ui.console.modes.basemode import BaseMode
|
from deluge.ui.console.modes.basemode import BaseMode
|
||||||
from deluge.ui.console.modes.torrentlist.torrentactions import ACTION, torrent_actions_popup
|
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 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.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.utils.format_utils import format_priority, format_progress, format_row
|
||||||
from deluge.ui.console.widgets.popup import InputPopup, MessagePopup, PopupsHandler, SelectablePopup
|
from deluge.ui.console.widgets.popup import InputPopup, MessagePopup, PopupsHandler, SelectablePopup
|
||||||
|
|
|
@ -216,7 +216,7 @@ class TorrentView(InputKeyHandler):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _sort_torrents(self, state):
|
def _sort_torrents(self, state):
|
||||||
'sorts by primary and secondary sort fields'
|
"""Sorts by primary and secondary sort fields."""
|
||||||
|
|
||||||
if not state:
|
if not state:
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -16,8 +16,8 @@ import os
|
||||||
|
|
||||||
from deluge.decorators import overrides
|
from deluge.decorators import overrides
|
||||||
from deluge.ui.console.modes.basemode import InputKeyHandler
|
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 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
|
from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, wrap_string
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -228,7 +228,7 @@ class SelectablePopup(BaseInputPane, Popup):
|
||||||
return Popup.visible_content_pane_height.fget(self)
|
return Popup.visible_content_pane_height.fget(self)
|
||||||
|
|
||||||
def current_selection(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
|
return self.active_input
|
||||||
|
|
||||||
def set_selection(self, index):
|
def set_selection(self, index):
|
||||||
|
|
|
@ -335,7 +335,7 @@ class FilterTreeView(component.Component):
|
||||||
item.set_sensitive(sensitive)
|
item.set_sensitive(sensitive)
|
||||||
|
|
||||||
def select_all(self):
|
def select_all(self):
|
||||||
'for use in popup menu'
|
"""For use in popup menu."""
|
||||||
component.get('TorrentView').treeview.get_selection().select_all()
|
component.get('TorrentView').treeview.get_selection().select_all()
|
||||||
|
|
||||||
def on_select_all(self, event):
|
def on_select_all(self, event):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue