From bde4e4443efb32ae63e3ee62817dbefcc1790eaf Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 13 Nov 2019 15:43:44 +0000 Subject: [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 --- .pre-commit-config.yaml | 8 ++++---- deluge/argparserbase.py | 2 +- deluge/tests/test_security.py | 6 +++--- deluge/tests/test_torrentmanager.py | 2 +- deluge/ui/console/modes/add_util.py | 2 +- deluge/ui/countries.py | 6 +++--- deluge/ui/gtk3/mainwindow.py | 14 ++++++++------ deluge/ui/gtk3/path_combo_chooser.py | 5 ++--- 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