[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
This commit is contained in:
parent
ed4bc5fa17
commit
bde4e4443e
|
@ -6,20 +6,20 @@ exclude: >
|
||||||
)$
|
)$
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/ambv/black
|
- repo: https://github.com/ambv/black
|
||||||
rev: 19.3b0
|
rev: 19.10b0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
name: Fmt Black
|
name: Fmt Black
|
||||||
language_version: python3.6
|
language_version: python3.6
|
||||||
- repo: https://github.com/prettier/prettier
|
- repo: https://github.com/prettier/prettier
|
||||||
rev: 1.17.0
|
rev: 1.19.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
name: Fmt Prettier
|
name: Fmt Prettier
|
||||||
# Workaround to list modified files only.
|
# Workaround to list modified files only.
|
||||||
args: [--list-different]
|
args: [--list-different]
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.7.7
|
rev: 3.7.9
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
name: Chk Flake8
|
name: Chk Flake8
|
||||||
|
@ -27,7 +27,7 @@ repos:
|
||||||
- flake8-isort==2.7
|
- flake8-isort==2.7
|
||||||
- pep8-naming==0.8.2
|
- pep8-naming==0.8.2
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v2.2.1
|
rev: v2.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: double-quote-string-fixer
|
- id: double-quote-string-fixer
|
||||||
name: Fix Double-quotes
|
name: Fix Double-quotes
|
||||||
|
|
|
@ -122,7 +122,7 @@ class DelugeTextHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not action.option_strings:
|
if not action.option_strings:
|
||||||
metavar, = self._metavar_formatter(action, action.dest)(1)
|
(metavar,) = self._metavar_formatter(action, action.dest)(1)
|
||||||
return metavar
|
return metavar
|
||||||
else:
|
else:
|
||||||
parts = []
|
parts = []
|
||||||
|
|
|
@ -28,11 +28,11 @@ SECURITY_TESTS = bool(os.getenv('SECURITY_TESTS', False))
|
||||||
|
|
||||||
class SecurityBaseTestCase(object):
|
class SecurityBaseTestCase(object):
|
||||||
if windows_check():
|
if windows_check():
|
||||||
skip = 'windows can`t run .sh files'
|
skip = 'windows cannot run .sh files'
|
||||||
elif not SECURITY_TESTS:
|
elif not SECURITY_TESTS:
|
||||||
skip = 'Skipping 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):
|
def __init__(self):
|
||||||
self.home_dir = os.path.expanduser('~')
|
self.home_dir = os.path.expanduser('~')
|
||||||
|
@ -132,7 +132,7 @@ class SecurityBaseTestCase(object):
|
||||||
class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase):
|
class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase):
|
||||||
|
|
||||||
if windows_check():
|
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):
|
def __init__(self, testname):
|
||||||
super(DaemonSecurityTestCase, self).__init__(testname)
|
super(DaemonSecurityTestCase, self).__init__(testname)
|
||||||
|
|
|
@ -82,7 +82,7 @@ class TorrentmanagerTestCase(BaseTestCase):
|
||||||
b'name': b'azcvsupdater_2.6.2.jar',
|
b'name': b'azcvsupdater_2.6.2.jar',
|
||||||
b'private': 0,
|
b'private': 0,
|
||||||
b'pieces': (
|
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'\xca<w\\\x1ef\xd4\x9b\x16\xa9}\xc0\x9f:\xfd'
|
||||||
b'\x97qv\x83\xa2"\xef\x9d7\x0by!\rl\xe5v\xb7'
|
b'\x97qv\x83\xa2"\xef\x9d7\x0by!\rl\xe5v\xb7'
|
||||||
b'\x18{\xf7/"P\xe9\x8d\x01D\x9e8\xbd\x16\xe3'
|
b'\x18{\xf7/"P\xe9\x8d\x01D\x9e8\xbd\x16\xe3'
|
||||||
|
|
|
@ -16,7 +16,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
|
|
||||||
from six import unichr as chr
|
from six import unichr as chr # noqa: A001 shadowing
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
|
|
@ -60,7 +60,7 @@ COUNTRIES = {
|
||||||
'CD': _('Congo, The Democratic Republic of the'),
|
'CD': _('Congo, The Democratic Republic of the'),
|
||||||
'CK': _('Cook Islands'),
|
'CK': _('Cook Islands'),
|
||||||
'CR': _('Costa Rica'),
|
'CR': _('Costa Rica'),
|
||||||
'CI': _('Cote d\'Ivoire'),
|
'CI': _("Cote d'Ivoire"),
|
||||||
'HR': _('Croatia'),
|
'HR': _('Croatia'),
|
||||||
'CU': _('Cuba'),
|
'CU': _('Cuba'),
|
||||||
'CY': _('Cyprus'),
|
'CY': _('Cyprus'),
|
||||||
|
@ -122,11 +122,11 @@ COUNTRIES = {
|
||||||
'KZ': _('Kazakhstan'),
|
'KZ': _('Kazakhstan'),
|
||||||
'KE': _('Kenya'),
|
'KE': _('Kenya'),
|
||||||
'KI': _('Kiribati'),
|
'KI': _('Kiribati'),
|
||||||
'KP': _('Korea, Democratic People\'s Republic of'),
|
'KP': _("Korea, Democratic People's Republic of"),
|
||||||
'KR': _('Korea, Republic of'),
|
'KR': _('Korea, Republic of'),
|
||||||
'KW': _('Kuwait'),
|
'KW': _('Kuwait'),
|
||||||
'KG': _('Kyrgyzstan'),
|
'KG': _('Kyrgyzstan'),
|
||||||
'LA': _('Lao People\'s Democratic Republic'),
|
'LA': _("Lao People's Democratic Republic"),
|
||||||
'LV': _('Latvia'),
|
'LV': _('Latvia'),
|
||||||
'LB': _('Lebanon'),
|
'LB': _('Lebanon'),
|
||||||
'LS': _('Lesotho'),
|
'LS': _('Lesotho'),
|
||||||
|
|
|
@ -277,12 +277,14 @@ class MainWindow(component.Component):
|
||||||
def save_position(self):
|
def save_position(self):
|
||||||
self.config['window_maximized'] = self.window.props.is_maximized
|
self.config['window_maximized'] = self.window.props.is_maximized
|
||||||
if not self.config['window_maximized'] and self.visible():
|
if not self.config['window_maximized'] and self.visible():
|
||||||
self.config['window_x_pos'], self.config[
|
(
|
||||||
'window_y_pos'
|
self.config['window_x_pos'],
|
||||||
] = self.window.get_position()
|
self.config['window_y_pos'],
|
||||||
self.config['window_width'], self.config[
|
) = self.window.get_position()
|
||||||
'window_height'
|
(
|
||||||
] = self.window.get_size()
|
self.config['window_width'],
|
||||||
|
self.config['window_height'],
|
||||||
|
) = self.window.get_size()
|
||||||
|
|
||||||
def on_window_configure_event(self, widget, event):
|
def on_window_configure_event(self, widget, event):
|
||||||
self.save_position()
|
self.save_position()
|
||||||
|
|
|
@ -538,9 +538,8 @@ class PathChooserPopup(object):
|
||||||
self.set_max_popup_rows(max_visible_rows)
|
self.set_max_popup_rows(max_visible_rows)
|
||||||
self.popup_window.realize()
|
self.popup_window.realize()
|
||||||
self.alignment_widget = popup_alignment_widget
|
self.alignment_widget = popup_alignment_widget
|
||||||
self.popup_buttonbox = (
|
# If set, the height of this widget is the minimum height
|
||||||
None
|
self.popup_buttonbox = None
|
||||||
) # If set, the height of this widget is the minimum height
|
|
||||||
|
|
||||||
def popup(self):
|
def popup(self):
|
||||||
"""Make the popup visible."""
|
"""Make the popup visible."""
|
||||||
|
|
Loading…
Reference in New Issue