[Lint] Format code with ruff
`pre-commit run --all-files`
This commit is contained in:
parent
2247668571
commit
0d72195281
|
@ -14,6 +14,7 @@ Example:
|
|||
>>> from deluge._libtorrent import lt
|
||||
|
||||
"""
|
||||
|
||||
from deluge.common import VersionSplit, get_version
|
||||
from deluge.error import LibtorrentImportError
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
"""Common functions for various parts of Deluge to use."""
|
||||
|
||||
import base64
|
||||
import binascii
|
||||
import functools
|
||||
|
|
|
@ -38,6 +38,7 @@ this can only be done for the 'config file version' and not for the 'format'
|
|||
version as this will be done internally.
|
||||
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
|
|
@ -14,6 +14,7 @@ This should typically only be used by the Core. Plugins should utilize the
|
|||
`:mod:EventManager` for similar functionality.
|
||||
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import threading
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
"""The Deluge daemon"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import socket
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
|
||||
"""PluginManager for Core"""
|
||||
|
||||
import logging
|
||||
|
||||
from twisted.internet import defer
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
"""RPCServer Module"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
@ -46,13 +47,11 @@ TCallable = TypeVar('TCallable', bound=Callable)
|
|||
|
||||
|
||||
@overload
|
||||
def export(func: TCallable) -> TCallable:
|
||||
...
|
||||
def export(func: TCallable) -> TCallable: ...
|
||||
|
||||
|
||||
@overload
|
||||
def export(auth_level: int) -> Callable[[TCallable], TCallable]:
|
||||
...
|
||||
def export(auth_level: int) -> Callable[[TCallable], TCallable]: ...
|
||||
|
||||
|
||||
def export(auth_level=AUTH_LEVEL_DEFAULT):
|
||||
|
@ -274,9 +273,9 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
|||
raise IncompatibleClient(deluge.common.get_version())
|
||||
ret = component.get('AuthManager').authorize(*args, **kwargs)
|
||||
if ret:
|
||||
self.factory.authorized_sessions[
|
||||
self.transport.sessionno
|
||||
] = self.AuthLevel(ret, args[0])
|
||||
self.factory.authorized_sessions[self.transport.sessionno] = (
|
||||
self.AuthLevel(ret, args[0])
|
||||
)
|
||||
self.factory.session_protocols[self.transport.sessionno] = self
|
||||
except Exception as ex:
|
||||
send_error()
|
||||
|
|
|
@ -1138,9 +1138,8 @@ class Torrent:
|
|||
'download_location': lambda: self.options['download_location'],
|
||||
'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
|
||||
),
|
||||
# Use -1.0 to signify infinity
|
||||
else (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'],
|
||||
|
@ -1544,20 +1543,18 @@ class Torrent:
|
|||
self.status.pieces, self.handle.piece_availability()
|
||||
):
|
||||
if piece:
|
||||
pieces.append(3) # Completed.
|
||||
# Completed.
|
||||
pieces.append(3)
|
||||
elif avail_piece:
|
||||
pieces.append(
|
||||
1
|
||||
) # Available, just not downloaded nor being downloaded.
|
||||
# Available, just not downloaded nor being downloaded.
|
||||
pieces.append(1)
|
||||
else:
|
||||
pieces.append(
|
||||
0
|
||||
) # Missing, no known peer with piece, or not asked for yet.
|
||||
# Missing, no known peer with piece, or not asked for yet.
|
||||
pieces.append(0)
|
||||
|
||||
for peer_info in self.handle.get_peer_info():
|
||||
if peer_info.downloading_piece_index >= 0:
|
||||
pieces[
|
||||
peer_info.downloading_piece_index
|
||||
] = 2 # Being downloaded from peer.
|
||||
# Being downloaded from peer.
|
||||
pieces[peer_info.downloading_piece_index] = 2
|
||||
|
||||
return pieces
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
"""TorrentManager handles Torrent objects"""
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
import operator
|
||||
|
|
|
@ -206,7 +206,7 @@ _RetT = TypeVar('_RetT')
|
|||
|
||||
|
||||
def maybe_coroutine(
|
||||
f: Callable[..., Coroutine[Any, Any, _RetT]]
|
||||
f: Callable[..., Coroutine[Any, Any, _RetT]],
|
||||
) -> 'Callable[..., defer.Deferred[_RetT]]':
|
||||
"""Wraps a coroutine function to make it usable as a normal function that returns a Deferred."""
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ This module describes the types of events that can be generated by the daemon
|
|||
and subsequently emitted to the clients.
|
||||
|
||||
"""
|
||||
|
||||
known_events = {}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#
|
||||
|
||||
"""Logging functions"""
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
import logging.handlers
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
|
||||
"""PluginManagerBase"""
|
||||
|
||||
import email
|
||||
import logging
|
||||
import os.path
|
||||
|
|
|
@ -292,7 +292,7 @@ class Core(CorePluginBase):
|
|||
if 'Label' in component.get('CorePluginManager').get_enabled_plugins():
|
||||
if watchdir.get('label_toggle', True) and watchdir.get('label'):
|
||||
label = component.get('CorePlugin.Label')
|
||||
if not watchdir['label'] in label.get_labels():
|
||||
if watchdir['label'] not in label.get_labels():
|
||||
label.add(watchdir['label'])
|
||||
try:
|
||||
label.set_torrent(torrent_id, watchdir['label'])
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
torrent-label core plugin.
|
||||
adds a status field for tracker.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
@ -182,7 +183,7 @@ class Core(CorePluginBase):
|
|||
RE_VALID.match(label_id), _('Invalid label, valid characters:[a-z0-9_-]')
|
||||
)
|
||||
check_input(label_id, _('Empty Label'))
|
||||
check_input(not (label_id in self.labels), _('Label already exists'))
|
||||
check_input(label_id not in self.labels, _('Label already exists'))
|
||||
|
||||
self.labels[label_id] = dict(OPTIONS_DEFAULTS)
|
||||
self.config.save()
|
||||
|
|
|
@ -192,12 +192,12 @@ class GtkUI(Gtk3PluginBase):
|
|||
def disable(self):
|
||||
component.get('Preferences').remove_page(_('Scheduler'))
|
||||
# Reset statusbar dict.
|
||||
self.statusbar.config_value_changed_dict[
|
||||
'max_download_speed'
|
||||
] = self.statusbar._on_max_download_speed
|
||||
self.statusbar.config_value_changed_dict[
|
||||
'max_upload_speed'
|
||||
] = self.statusbar._on_max_upload_speed
|
||||
self.statusbar.config_value_changed_dict['max_download_speed'] = (
|
||||
self.statusbar._on_max_download_speed
|
||||
)
|
||||
self.statusbar.config_value_changed_dict['max_upload_speed'] = (
|
||||
self.statusbar._on_max_upload_speed
|
||||
)
|
||||
# Remove statusbar item.
|
||||
self.statusbar.remove_item(self.status_item)
|
||||
del self.status_item
|
||||
|
@ -246,12 +246,12 @@ class GtkUI(Gtk3PluginBase):
|
|||
# Skip error due to Plugin being enabled before statusbar items created on startup.
|
||||
pass
|
||||
else:
|
||||
self.statusbar.config_value_changed_dict[
|
||||
'max_download_speed'
|
||||
] = self.statusbar._on_max_download_speed
|
||||
self.statusbar.config_value_changed_dict[
|
||||
'max_upload_speed'
|
||||
] = self.statusbar._on_max_upload_speed
|
||||
self.statusbar.config_value_changed_dict['max_download_speed'] = (
|
||||
self.statusbar._on_max_download_speed
|
||||
)
|
||||
self.statusbar.config_value_changed_dict['max_upload_speed'] = (
|
||||
self.statusbar._on_max_upload_speed
|
||||
)
|
||||
|
||||
def update_config_values(config):
|
||||
try:
|
||||
|
|
|
@ -193,7 +193,9 @@ class GraphsTab(Tab):
|
|||
self.colors = colors
|
||||
# Fake switch page to update the graph colors (HACKY)
|
||||
self._on_notebook_switch_page(
|
||||
self.notebook, None, self.notebook.get_current_page() # This is unused
|
||||
self.notebook,
|
||||
None,
|
||||
self.notebook.get_current_page(), # This is unused
|
||||
)
|
||||
|
||||
def _on_intervals_changed(self, intervals):
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"""
|
||||
This base class is used in plugin's __init__ for the plugin entry points.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -61,8 +61,7 @@ class TestAlertManager:
|
|||
component.start(['AlertManager'])
|
||||
|
||||
def test_register_handler(self):
|
||||
def handler(alert):
|
||||
...
|
||||
def handler(alert): ...
|
||||
|
||||
self.am.register_handler('dummy1', handler)
|
||||
self.am.register_handler('dummy2_alert', handler)
|
||||
|
@ -97,8 +96,7 @@ class TestAlertManager:
|
|||
assert len(self.am.session.alerts) == 2
|
||||
|
||||
def test_deregister_handler(self):
|
||||
def handler(alert):
|
||||
...
|
||||
def handler(alert): ...
|
||||
|
||||
self.am.register_handler('dummy1', handler)
|
||||
self.am.register_handler('dummy2_alert', handler)
|
||||
|
|
|
@ -229,7 +229,11 @@ class TestUICommon:
|
|||
ti = TorrentInfo(filename, filetree=1, force_bt_version=1)
|
||||
assert ti.files_tree == files_tree
|
||||
del files_tree['torrent_test']['.pad']
|
||||
files_tree['torrent_test']['還在一個人無聊嗎~還不趕緊上來聊天美.txt'] = (1, 32, True)
|
||||
files_tree['torrent_test']['還在一個人無聊嗎~還不趕緊上來聊天美.txt'] = (
|
||||
1,
|
||||
32,
|
||||
True,
|
||||
)
|
||||
ti = TorrentInfo(filename, filetree=1, force_bt_version=2)
|
||||
assert ti.files_tree == files_tree
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"""
|
||||
The ui common module contains methods and classes that are deemed useful for all the interfaces.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from hashlib import sha1 as sha
|
||||
|
|
|
@ -109,13 +109,13 @@ class BasePreferencePane(BaseInputPane, BaseWindow, PopupsHandler):
|
|||
elif ipt.name == 'proxy_port':
|
||||
conf_dict.setdefault('proxy', {})['port'] = ipt.get_value()
|
||||
elif ipt.name == 'proxy_hostnames':
|
||||
conf_dict.setdefault('proxy', {})[
|
||||
'proxy_hostnames'
|
||||
] = ipt.get_value()
|
||||
conf_dict.setdefault('proxy', {})['proxy_hostnames'] = (
|
||||
ipt.get_value()
|
||||
)
|
||||
elif ipt.name == 'proxy_peer_connections':
|
||||
conf_dict.setdefault('proxy', {})[
|
||||
'proxy_peer_connections'
|
||||
] = ipt.get_value()
|
||||
conf_dict.setdefault('proxy', {})['proxy_peer_connections'] = (
|
||||
ipt.get_value()
|
||||
)
|
||||
elif ipt.name == 'proxy_tracker_connections':
|
||||
conf_dict.setdefault('proxy', {})[
|
||||
'proxy_tracker_connections'
|
||||
|
@ -123,9 +123,9 @@ class BasePreferencePane(BaseInputPane, BaseWindow, PopupsHandler):
|
|||
elif ipt.name == 'force_proxy':
|
||||
conf_dict.setdefault('proxy', {})['force_proxy'] = ipt.get_value()
|
||||
elif ipt.name == 'anonymous_mode':
|
||||
conf_dict.setdefault('proxy', {})[
|
||||
'anonymous_mode'
|
||||
] = ipt.get_value()
|
||||
conf_dict.setdefault('proxy', {})['anonymous_mode'] = (
|
||||
ipt.get_value()
|
||||
)
|
||||
else:
|
||||
conf_dict[ipt.name] = ipt.get_value()
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ class QueueMode:
|
|||
self.torrent_ids = torrent_ids
|
||||
|
||||
def set_statusbar_args(self, statusbar_args):
|
||||
statusbar_args[
|
||||
'bottombar'
|
||||
] = '{!black,white!}Queue mode: change queue position of selected torrents.'
|
||||
statusbar_args['bottombar'] = (
|
||||
'{!black,white!}Queue mode: change queue position of selected torrents.'
|
||||
)
|
||||
statusbar_args['bottombar_help'] = ' Press [h] for help'
|
||||
|
||||
def update_cursor(self):
|
||||
|
|
|
@ -219,11 +219,11 @@ class TorrentList(BaseMode, PopupsHandler):
|
|||
# Update the status bars
|
||||
statusbar_args = {'scr': self.stdscr, 'bottombar_help': True}
|
||||
if self.torrentview.curr_filter is not None:
|
||||
statusbar_args[
|
||||
'topbar'
|
||||
] = '{} {{!filterstatus!}}Current filter: {}'.format(
|
||||
self.statusbars.topbar,
|
||||
self.torrentview.curr_filter,
|
||||
statusbar_args['topbar'] = (
|
||||
'{} {{!filterstatus!}}Current filter: {}'.format(
|
||||
self.statusbars.topbar,
|
||||
self.torrentview.curr_filter,
|
||||
)
|
||||
)
|
||||
|
||||
if self.minor_mode:
|
||||
|
|
|
@ -49,7 +49,7 @@ class BaseInputPane(InputKeyHandler):
|
|||
border_off_east=0,
|
||||
border_off_south=0,
|
||||
active_wrap=False,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
InputKeyHandler.__init__(self)
|
||||
self.inputs = []
|
||||
|
@ -155,7 +155,7 @@ class BaseInputPane(InputKeyHandler):
|
|||
self.visible_content_pane_width,
|
||||
value,
|
||||
col=col,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class Popup(BaseWindow, InputKeyHandler):
|
|||
close_cb=None,
|
||||
encoding=None,
|
||||
base_popup=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Init a new popup. The default constructor will handle sizing and borders and the like.
|
||||
|
@ -212,7 +212,7 @@ class SelectablePopup(BaseInputPane, Popup):
|
|||
input_cb=None,
|
||||
allow_rearrange=False,
|
||||
immediate_action=False,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Args:
|
||||
|
@ -262,7 +262,7 @@ class SelectablePopup(BaseInputPane, Popup):
|
|||
foreground=None,
|
||||
selectable=True,
|
||||
selected=False,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
hotkey = None
|
||||
self.cb_arg[name] = cb_arg
|
||||
|
@ -335,7 +335,7 @@ class MessagePopup(Popup, BaseInputPane):
|
|||
align=ALIGN.DEFAULT,
|
||||
height_req=0.75,
|
||||
width_req=0.5,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
self.message = message
|
||||
Popup.__init__(
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# See LICENSE for more details.
|
||||
#
|
||||
"""Common functions for various parts of gtkui to use."""
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import os
|
||||
|
|
|
@ -322,20 +322,20 @@ class StoredValuesList(ValueList):
|
|||
self.paths_without_trailing_path_sep = False
|
||||
|
||||
# Add signal handlers
|
||||
self.signal_handlers[
|
||||
'on_stored_values_treeview_mouse_button_press_event'
|
||||
] = self.on_treeview_mouse_button_press_event
|
||||
self.signal_handlers['on_stored_values_treeview_mouse_button_press_event'] = (
|
||||
self.on_treeview_mouse_button_press_event
|
||||
)
|
||||
|
||||
self.signal_handlers[
|
||||
'on_stored_values_treeview_key_press_event'
|
||||
] = self.on_stored_values_treeview_key_press_event
|
||||
self.signal_handlers[
|
||||
'on_stored_values_treeview_key_release_event'
|
||||
] = self.on_stored_values_treeview_key_release_event
|
||||
self.signal_handlers['on_stored_values_treeview_key_press_event'] = (
|
||||
self.on_stored_values_treeview_key_press_event
|
||||
)
|
||||
self.signal_handlers['on_stored_values_treeview_key_release_event'] = (
|
||||
self.on_stored_values_treeview_key_release_event
|
||||
)
|
||||
|
||||
self.signal_handlers[
|
||||
'on_cellrenderertext_edited'
|
||||
] = self.on_cellrenderertext_edited
|
||||
self.signal_handlers['on_cellrenderertext_edited'] = (
|
||||
self.on_cellrenderertext_edited
|
||||
)
|
||||
|
||||
def on_cellrenderertext_edited(self, cellrenderertext, path, new_text):
|
||||
"""
|
||||
|
@ -447,9 +447,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() # pylint: disable=bad-super-call
|
||||
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'):
|
||||
|
@ -465,17 +463,17 @@ class CompletionList(ValueList):
|
|||
self.completion_scrolled_window = self.builder.get_object(
|
||||
'completion_scrolled_window'
|
||||
)
|
||||
self.signal_handlers[
|
||||
'on_completion_treeview_key_press_event'
|
||||
] = self.on_completion_treeview_key_press_event
|
||||
self.signal_handlers[
|
||||
'on_completion_treeview_motion_notify_event'
|
||||
] = self.on_completion_treeview_motion_notify_event
|
||||
self.signal_handlers['on_completion_treeview_key_press_event'] = (
|
||||
self.on_completion_treeview_key_press_event
|
||||
)
|
||||
self.signal_handlers['on_completion_treeview_motion_notify_event'] = (
|
||||
self.on_completion_treeview_motion_notify_event
|
||||
)
|
||||
|
||||
# Add super class signal handler
|
||||
self.signal_handlers[
|
||||
'on_completion_treeview_mouse_button_press_event'
|
||||
] = super().on_treeview_mouse_button_press_event
|
||||
self.signal_handlers['on_completion_treeview_mouse_button_press_event'] = (
|
||||
super().on_treeview_mouse_button_press_event
|
||||
)
|
||||
|
||||
def reduce_values(self, prefix):
|
||||
"""
|
||||
|
@ -756,23 +754,23 @@ class StoredValuesPopup(StoredValuesList, PathChooserPopup):
|
|||
self.popup_buttonbox = self.builder.get_object('buttonbox')
|
||||
|
||||
# Add signal handlers
|
||||
self.signal_handlers[
|
||||
'on_buttonbox_key_press_event'
|
||||
] = self.on_buttonbox_key_press_event
|
||||
self.signal_handlers[
|
||||
'on_stored_values_treeview_scroll_event'
|
||||
] = self.on_scroll_event
|
||||
self.signal_handlers[
|
||||
'on_button_toggle_dropdown_scroll_event'
|
||||
] = self.on_scroll_event
|
||||
self.signal_handlers['on_buttonbox_key_press_event'] = (
|
||||
self.on_buttonbox_key_press_event
|
||||
)
|
||||
self.signal_handlers['on_stored_values_treeview_scroll_event'] = (
|
||||
self.on_scroll_event
|
||||
)
|
||||
self.signal_handlers['on_button_toggle_dropdown_scroll_event'] = (
|
||||
self.on_scroll_event
|
||||
)
|
||||
self.signal_handlers['on_entry_text_scroll_event'] = self.on_scroll_event
|
||||
self.signal_handlers[
|
||||
'on_stored_values_popup_window_focus_out_event'
|
||||
] = self.on_stored_values_popup_window_focus_out_event
|
||||
self.signal_handlers['on_stored_values_popup_window_focus_out_event'] = (
|
||||
self.on_stored_values_popup_window_focus_out_event
|
||||
)
|
||||
# For when clicking outside the popup
|
||||
self.signal_handlers[
|
||||
'on_stored_values_popup_window_button_press_event'
|
||||
] = self.on_popup_window_button_press_event
|
||||
self.signal_handlers['on_stored_values_popup_window_button_press_event'] = (
|
||||
self.on_popup_window_button_press_event
|
||||
)
|
||||
|
||||
# Buttons for manipulating the list
|
||||
self.signal_handlers['on_button_add_clicked'] = self.on_button_add_clicked
|
||||
|
@ -780,12 +778,12 @@ class StoredValuesPopup(StoredValuesList, PathChooserPopup):
|
|||
self.signal_handlers['on_button_remove_clicked'] = self.on_button_remove_clicked
|
||||
self.signal_handlers['on_button_up_clicked'] = self.on_button_up_clicked
|
||||
self.signal_handlers['on_button_down_clicked'] = self.on_button_down_clicked
|
||||
self.signal_handlers[
|
||||
'on_button_default_clicked'
|
||||
] = self.on_button_default_clicked
|
||||
self.signal_handlers[
|
||||
'on_button_properties_clicked'
|
||||
] = self.path_entry._on_button_properties_clicked
|
||||
self.signal_handlers['on_button_default_clicked'] = (
|
||||
self.on_button_default_clicked
|
||||
)
|
||||
self.signal_handlers['on_button_properties_clicked'] = (
|
||||
self.path_entry._on_button_properties_clicked
|
||||
)
|
||||
|
||||
def popup(self):
|
||||
"""
|
||||
|
@ -911,17 +909,17 @@ class PathCompletionPopup(CompletionList, PathChooserPopup):
|
|||
CompletionList.__init__(self)
|
||||
|
||||
# Add signal handlers
|
||||
self.signal_handlers[
|
||||
'on_completion_treeview_scroll_event'
|
||||
] = self.on_scroll_event
|
||||
self.signal_handlers[
|
||||
'on_completion_popup_window_focus_out_event'
|
||||
] = self.on_completion_popup_window_focus_out_event
|
||||
self.signal_handlers['on_completion_treeview_scroll_event'] = (
|
||||
self.on_scroll_event
|
||||
)
|
||||
self.signal_handlers['on_completion_popup_window_focus_out_event'] = (
|
||||
self.on_completion_popup_window_focus_out_event
|
||||
)
|
||||
|
||||
# For when clicking outside the popup
|
||||
self.signal_handlers[
|
||||
'on_completion_popup_window_button_press_event'
|
||||
] = self.on_popup_window_button_press_event
|
||||
self.signal_handlers['on_completion_popup_window_button_press_event'] = (
|
||||
self.on_popup_window_button_press_event
|
||||
)
|
||||
|
||||
def popup(self):
|
||||
"""
|
||||
|
@ -986,15 +984,15 @@ class PathAutoCompleter:
|
|||
self.auto_complete_enabled = True
|
||||
self.signal_handlers = self.completion_popup.signal_handlers
|
||||
|
||||
self.signal_handlers[
|
||||
'on_completion_popup_window_key_press_event'
|
||||
] = self.on_completion_popup_window_key_press_event
|
||||
self.signal_handlers[
|
||||
'on_entry_text_delete_text'
|
||||
] = self.on_entry_text_delete_text
|
||||
self.signal_handlers[
|
||||
'on_entry_text_insert_text'
|
||||
] = self.on_entry_text_insert_text
|
||||
self.signal_handlers['on_completion_popup_window_key_press_event'] = (
|
||||
self.on_completion_popup_window_key_press_event
|
||||
)
|
||||
self.signal_handlers['on_entry_text_delete_text'] = (
|
||||
self.on_entry_text_delete_text
|
||||
)
|
||||
self.signal_handlers['on_entry_text_insert_text'] = (
|
||||
self.on_entry_text_insert_text
|
||||
)
|
||||
self.accelerator_string = Gtk.accelerator_name(Gdk.KEY_Tab, 0)
|
||||
|
||||
def on_entry_text_insert_text(self, entry, new_text, new_text_length, position):
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
|
||||
"""The torrent details component shows info about the selected torrent."""
|
||||
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
"""The torrent view component that lists all torrents in the session."""
|
||||
|
||||
import logging
|
||||
from locale import strcoll
|
||||
|
||||
|
@ -577,7 +578,7 @@ class TorrentView(ListView, component.Component):
|
|||
status_keys = self.set_columns_to_update(columns)
|
||||
|
||||
# If there is nothing in status_keys then we must not continue
|
||||
if status_keys is []:
|
||||
if status_keys == []:
|
||||
return
|
||||
|
||||
# Remove duplicates from status_key list
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
# user runs the command 'deluge'.
|
||||
|
||||
"""Main starting point for Deluge"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
|
|
|
@ -60,7 +60,7 @@ def check_missing_markup(js_dir):
|
|||
# Ignore string that contains only digits or specificied strings in skip.
|
||||
if (
|
||||
not string
|
||||
or string.split('\'')[1].isdigit()
|
||||
or string.split("'")[1].isdigit()
|
||||
or any(x in string for x in skip)
|
||||
):
|
||||
continue
|
||||
|
@ -82,7 +82,7 @@ GETTEXT_SUBST_TPL = "GetText.add('{key}','${{escape(_(\"{key}\"))}}')\n"
|
|||
|
||||
|
||||
def create_gettext_js(js_dir):
|
||||
string_re = re.compile('_\\(\'(.*?)\'\\)')
|
||||
string_re = re.compile("_\\('(.*?)'\\)")
|
||||
strings = {}
|
||||
for root, dnames, files in os.walk(js_dir):
|
||||
for filename in files:
|
||||
|
|
|
@ -24,6 +24,7 @@ Options:
|
|||
--version
|
||||
Display version information and exit.
|
||||
"""
|
||||
|
||||
import array
|
||||
import ast
|
||||
import getopt
|
||||
|
|
4
setup.py
4
setup.py
|
@ -323,7 +323,7 @@ class CleanPlugins(Command):
|
|||
self.set_undefined_options('clean', ('all', 'all'))
|
||||
|
||||
def run(self):
|
||||
print('Cleaning the plugin\'s folders...')
|
||||
print("Cleaning the plugin's folders...")
|
||||
|
||||
plugin_path = 'deluge/plugins/*'
|
||||
|
||||
|
@ -332,7 +332,7 @@ class CleanPlugins(Command):
|
|||
c = 'cd ' + path + ' && ' + sys.executable + ' setup.py clean'
|
||||
if self.all:
|
||||
c += ' -a'
|
||||
print('Calling \'%s\'' % c)
|
||||
print("Calling '%s'" % c)
|
||||
os.system(c)
|
||||
|
||||
# Delete the .eggs
|
||||
|
|
Loading…
Reference in New Issue