summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2019-11-13 15:43:44 +0000
committerCalum Lind <calumlind+deluge@gmail.com>2019-11-13 15:44:46 +0000
commitbde4e4443efb32ae63e3ee62817dbefcc1790eaf (patch)
tree404e1b4c94799b2d5298bfaad74258942d72d70a
parented4bc5fa17ec50069c9173fda6efdc801c8b14a6 (diff)
downloaddeluge-bde4e4443efb32ae63e3ee62817dbefcc1790eaf.tar.gz
deluge-bde4e4443efb32ae63e3ee62817dbefcc1790eaf.tar.bz2
deluge-bde4e4443efb32ae63e3ee62817dbefcc1790eaf.zip
[Lint] Fix Black and Flake8 issues
For a single element unpack black now also encloses with parentheses to make it clearer: https://github.com/psf/black/issues/1108 Fix flake8 warnings
-rw-r--r--.pre-commit-config.yaml8
-rw-r--r--deluge/argparserbase.py2
-rw-r--r--deluge/tests/test_security.py6
-rw-r--r--deluge/tests/test_torrentmanager.py2
-rw-r--r--deluge/ui/console/modes/add_util.py2
-rw-r--r--deluge/ui/countries.py6
-rw-r--r--deluge/ui/gtk3/mainwindow.py14
-rwxr-xr-xdeluge/ui/gtk3/path_combo_chooser.py5
8 files changed, 23 insertions, 22 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a76391756..c80703764 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -6,20 +6,20 @@ exclude: >
)$
repos:
- repo: https://github.com/ambv/black
- rev: 19.3b0
+ rev: 19.10b0
hooks:
- id: black
name: Fmt Black
language_version: python3.6
- repo: https://github.com/prettier/prettier
- rev: 1.17.0
+ rev: 1.19.1
hooks:
- id: prettier
name: Fmt Prettier
# Workaround to list modified files only.
args: [--list-different]
- repo: https://gitlab.com/pycqa/flake8
- rev: 3.7.7
+ rev: 3.7.9
hooks:
- id: flake8
name: Chk Flake8
@@ -27,7 +27,7 @@ repos:
- flake8-isort==2.7
- pep8-naming==0.8.2
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v2.2.1
+ rev: v2.4.0
hooks:
- id: double-quote-string-fixer
name: Fix Double-quotes
diff --git a/deluge/argparserbase.py b/deluge/argparserbase.py
index 77866a3ed..5eec1228f 100644
--- a/deluge/argparserbase.py
+++ b/deluge/argparserbase.py
@@ -122,7 +122,7 @@ class DelugeTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
"""
if not action.option_strings:
- metavar, = self._metavar_formatter(action, action.dest)(1)
+ (metavar,) = self._metavar_formatter(action, action.dest)(1)
return metavar
else:
parts = []
diff --git a/deluge/tests/test_security.py b/deluge/tests/test_security.py
index 379404906..700fc9967 100644
--- a/deluge/tests/test_security.py
+++ b/deluge/tests/test_security.py
@@ -28,11 +28,11 @@ SECURITY_TESTS = bool(os.getenv('SECURITY_TESTS', False))
class SecurityBaseTestCase(object):
if windows_check():
- skip = 'windows can`t run .sh files'
+ skip = 'windows cannot run .sh files'
elif not SECURITY_TESTS:
skip = 'Skipping security tests'
- http_err = 'can\'t run http tests on daemon'
+ http_err = 'cannot run http tests on daemon'
def __init__(self):
self.home_dir = os.path.expanduser('~')
@@ -132,7 +132,7 @@ class SecurityBaseTestCase(object):
class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase):
if windows_check():
- skip = 'windows can\'t start_core not enough arguments for format string'
+ skip = 'windows cannot start_core not enough arguments for format string'
def __init__(self, testname):
super(DaemonSecurityTestCase, self).__init__(testname)
diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py
index 74d37bdeb..5cb201984 100644
--- a/deluge/tests/test_torrentmanager.py
+++ b/deluge/tests/test_torrentmanager.py
@@ -82,7 +82,7 @@ class TorrentmanagerTestCase(BaseTestCase):
b'name': b'azcvsupdater_2.6.2.jar',
b'private': 0,
b'pieces': (
- b'\xdb\x04B\x05\xc3\'\xdab\xb8su97\xa9u'
+ b"\xdb\x04B\x05\xc3'\xdab\xb8su97\xa9u"
b'\xca<w\\\x1ef\xd4\x9b\x16\xa9}\xc0\x9f:\xfd'
b'\x97qv\x83\xa2"\xef\x9d7\x0by!\rl\xe5v\xb7'
b'\x18{\xf7/"P\xe9\x8d\x01D\x9e8\xbd\x16\xe3'
diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py
index 88a24d0d9..ac60b8974 100644
--- a/deluge/ui/console/modes/add_util.py
+++ b/deluge/ui/console/modes/add_util.py
@@ -16,7 +16,7 @@ import logging
import os
from base64 import b64encode
-from six import unichr as chr
+from six import unichr as chr # noqa: A001 shadowing
import deluge.common
from deluge.ui.client import client
diff --git a/deluge/ui/countries.py b/deluge/ui/countries.py
index fe17da1a2..af390853e 100644
--- a/deluge/ui/countries.py
+++ b/deluge/ui/countries.py
@@ -60,7 +60,7 @@ COUNTRIES = {
'CD': _('Congo, The Democratic Republic of the'),
'CK': _('Cook Islands'),
'CR': _('Costa Rica'),
- 'CI': _('Cote d\'Ivoire'),
+ 'CI': _("Cote d'Ivoire"),
'HR': _('Croatia'),
'CU': _('Cuba'),
'CY': _('Cyprus'),
@@ -122,11 +122,11 @@ COUNTRIES = {
'KZ': _('Kazakhstan'),
'KE': _('Kenya'),
'KI': _('Kiribati'),
- 'KP': _('Korea, Democratic People\'s Republic of'),
+ 'KP': _("Korea, Democratic People's Republic of"),
'KR': _('Korea, Republic of'),
'KW': _('Kuwait'),
'KG': _('Kyrgyzstan'),
- 'LA': _('Lao People\'s Democratic Republic'),
+ 'LA': _("Lao People's Democratic Republic"),
'LV': _('Latvia'),
'LB': _('Lebanon'),
'LS': _('Lesotho'),
diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py
index 5b4240c6a..daed58910 100644
--- a/deluge/ui/gtk3/mainwindow.py
+++ b/deluge/ui/gtk3/mainwindow.py
@@ -277,12 +277,14 @@ class MainWindow(component.Component):
def save_position(self):
self.config['window_maximized'] = self.window.props.is_maximized
if not self.config['window_maximized'] and self.visible():
- self.config['window_x_pos'], self.config[
- 'window_y_pos'
- ] = self.window.get_position()
- self.config['window_width'], self.config[
- 'window_height'
- ] = self.window.get_size()
+ (
+ self.config['window_x_pos'],
+ self.config['window_y_pos'],
+ ) = self.window.get_position()
+ (
+ self.config['window_width'],
+ self.config['window_height'],
+ ) = self.window.get_size()
def on_window_configure_event(self, widget, event):
self.save_position()
diff --git a/deluge/ui/gtk3/path_combo_chooser.py b/deluge/ui/gtk3/path_combo_chooser.py
index c4458a9ea..72e98e497 100755
--- a/deluge/ui/gtk3/path_combo_chooser.py
+++ b/deluge/ui/gtk3/path_combo_chooser.py
@@ -538,9 +538,8 @@ class PathChooserPopup(object):
self.set_max_popup_rows(max_visible_rows)
self.popup_window.realize()
self.alignment_widget = popup_alignment_widget
- self.popup_buttonbox = (
- None
- ) # If set, the height of this widget is the minimum height
+ # If set, the height of this widget is the minimum height
+ self.popup_buttonbox = None
def popup(self):
"""Make the popup visible."""