pylint: Re-enable bad-continuation
And lots and lots of whitespace changes.
This commit is contained in:
parent
93cd200bb7
commit
e65c0dd8a7
@ -16,7 +16,6 @@ enable=all
|
||||
disable=fixme,
|
||||
no-self-use,
|
||||
cyclic-import,
|
||||
bad-continuation,
|
||||
blacklisted-name,
|
||||
logging-format-interpolation,
|
||||
broad-except,
|
||||
|
@ -564,8 +564,8 @@ class Quitter:
|
||||
cwd = os.path.abspath(os.path.dirname(sys.executable))
|
||||
else:
|
||||
args = [sys.executable, '-m', 'qutebrowser']
|
||||
cwd = os.path.join(os.path.abspath(os.path.dirname(
|
||||
qutebrowser.__file__)), '..')
|
||||
cwd = os.path.join(
|
||||
os.path.abspath(os.path.dirname(qutebrowser.__file__)), '..')
|
||||
if not os.path.isdir(cwd):
|
||||
# Probably running from a python egg. Let's fallback to
|
||||
# cwd=None and see if that works out.
|
||||
|
@ -247,8 +247,8 @@ class Completer(QObject):
|
||||
if func != self._last_completion_func:
|
||||
self._last_completion_func = func
|
||||
args = (x for x in before_cursor[1:] if not x.startswith('-'))
|
||||
with debug.log_time(log.completion,
|
||||
'Starting {} completion'.format(func.__name__)):
|
||||
with debug.log_time(log.completion, 'Starting {} completion'
|
||||
.format(func.__name__)):
|
||||
info = CompletionInfo(config=config.instance,
|
||||
keyconf=config.key_instance,
|
||||
win_id=self._win_id)
|
||||
|
@ -60,7 +60,8 @@ def value(optname, *_values, info):
|
||||
|
||||
opt = info.config.get_opt(optname)
|
||||
default = opt.typ.to_str(opt.default)
|
||||
cur_cat = listcategory.ListCategory("Current/Default",
|
||||
cur_cat = listcategory.ListCategory(
|
||||
"Current/Default",
|
||||
[(current, "Current value"), (default, "Default value")])
|
||||
model.add_category(cur_cat)
|
||||
|
||||
|
@ -111,9 +111,11 @@ class ExternalEditor(QObject):
|
||||
# the file from the external editor, see
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/1767
|
||||
with tempfile.NamedTemporaryFile(
|
||||
# pylint: disable=bad-continuation
|
||||
mode='w', prefix='qutebrowser-editor-',
|
||||
encoding=config.val.editor.encoding,
|
||||
delete=False) as fobj:
|
||||
# pylint: enable=bad-continuation
|
||||
if text:
|
||||
fobj.write(text)
|
||||
self._filename = fobj.name
|
||||
|
@ -74,7 +74,8 @@ def get_argparser():
|
||||
"session even if one would be restored.",
|
||||
action='store_true')
|
||||
parser.add_argument('--target', choices=['auto', 'tab', 'tab-bg',
|
||||
'tab-silent', 'tab-bg-silent', 'window'],
|
||||
'tab-silent', 'tab-bg-silent',
|
||||
'window'],
|
||||
help="How URLs should be opened if there is already a "
|
||||
"qutebrowser instance running.")
|
||||
parser.add_argument('--backend', choices=['webkit', 'webengine'],
|
||||
|
@ -361,29 +361,29 @@ def qt_message_handler(msg_type, context, msg):
|
||||
suppressed_msgs = [
|
||||
# PNGs in Qt with broken color profile
|
||||
# https://bugreports.qt.io/browse/QTBUG-39788
|
||||
'libpng warning: iCCP: Not recognizing known sRGB profile that has '
|
||||
'been edited', # noqa: E131
|
||||
('libpng warning: iCCP: Not recognizing known sRGB profile that has '
|
||||
'been edited'),
|
||||
'libpng warning: iCCP: known incorrect sRGB profile',
|
||||
# Hopefully harmless warning
|
||||
'OpenType support missing for script ',
|
||||
# Error if a QNetworkReply gets two different errors set. Harmless Qt
|
||||
# bug on some pages.
|
||||
# https://bugreports.qt.io/browse/QTBUG-30298
|
||||
'QNetworkReplyImplPrivate::error: Internal problem, this method must '
|
||||
'only be called once.',
|
||||
('QNetworkReplyImplPrivate::error: Internal problem, this method must '
|
||||
'only be called once.'),
|
||||
# Sometimes indicates missing text, but most of the time harmless
|
||||
'load glyph failed ',
|
||||
# Harmless, see https://bugreports.qt.io/browse/QTBUG-42479
|
||||
'content-type missing in HTTP POST, defaulting to '
|
||||
('content-type missing in HTTP POST, defaulting to '
|
||||
'application/x-www-form-urlencoded. '
|
||||
'Use QNetworkRequest::setHeader() to fix this problem.',
|
||||
'Use QNetworkRequest::setHeader() to fix this problem.'),
|
||||
# https://bugreports.qt.io/browse/QTBUG-43118
|
||||
'Using blocking call!',
|
||||
# Hopefully harmless
|
||||
'"Method "GetAll" with signature "s" on interface '
|
||||
'"org.freedesktop.DBus.Properties" doesn\'t exist',
|
||||
'"Method \\"GetAll\\" with signature \\"s\\" on interface '
|
||||
'\\"org.freedesktop.DBus.Properties\\" doesn\'t exist\\n"',
|
||||
('"Method "GetAll" with signature "s" on interface '
|
||||
'"org.freedesktop.DBus.Properties" doesn\'t exist'),
|
||||
('"Method \\"GetAll\\" with signature \\"s\\" on interface '
|
||||
'\\"org.freedesktop.DBus.Properties\\" doesn\'t exist\\n"'),
|
||||
'WOFF support requires QtWebKit to be built with zlib support.',
|
||||
# Weird Enlightment/GTK X extensions
|
||||
'QXcbWindow: Unhandled client message: "_E_',
|
||||
@ -392,21 +392,21 @@ def qt_message_handler(msg_type, context, msg):
|
||||
# Happens on AppVeyor CI
|
||||
'SetProcessDpiAwareness failed:',
|
||||
# https://bugreports.qt.io/browse/QTBUG-49174
|
||||
'QObject::connect: Cannot connect (null)::stateChanged('
|
||||
('QObject::connect: Cannot connect (null)::stateChanged('
|
||||
'QNetworkSession::State) to '
|
||||
'QNetworkReplyHttpImpl::_q_networkSessionStateChanged('
|
||||
'QNetworkSession::State)',
|
||||
'QNetworkSession::State)'),
|
||||
# https://bugreports.qt.io/browse/QTBUG-53989
|
||||
"Image of format '' blocked because it is not considered safe. If you "
|
||||
"are sure it is safe to do so, you can white-list the format by "
|
||||
"setting the environment variable QTWEBKIT_IMAGEFORMAT_WHITELIST=",
|
||||
("Image of format '' blocked because it is not considered safe. If "
|
||||
"you are sure it is safe to do so, you can white-list the format by "
|
||||
"setting the environment variable QTWEBKIT_IMAGEFORMAT_WHITELIST="),
|
||||
# Installing Qt from the installer may cause it looking for SSL3 or
|
||||
# OpenSSL 1.0 which may not be available on the system
|
||||
"QSslSocket: cannot resolve ",
|
||||
"QSslSocket: cannot call unresolved function ",
|
||||
# When enabling debugging with QtWebEngine
|
||||
"Remote debugging server started successfully. Try pointing a "
|
||||
"Chromium-based browser to ",
|
||||
("Remote debugging server started successfully. Try pointing a "
|
||||
"Chromium-based browser to "),
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/1287
|
||||
"QXcbClipboard: SelectionRequest too old",
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/2071
|
||||
@ -420,8 +420,8 @@ def qt_message_handler(msg_type, context, msg):
|
||||
suppressed_msgs += [
|
||||
'libpng warning: iCCP: known incorrect sRGB profile',
|
||||
# https://bugreports.qt.io/browse/QTBUG-47154
|
||||
'virtual void QSslSocketBackendPrivate::transmit() SSLRead failed '
|
||||
'with: -9805', # noqa: E131
|
||||
('virtual void QSslSocketBackendPrivate::transmit() SSLRead '
|
||||
'failed with: -9805'),
|
||||
]
|
||||
|
||||
if not msg:
|
||||
|
@ -212,8 +212,7 @@ class AsciiDoc:
|
||||
|
||||
for dst, link_name in [
|
||||
('README.html', 'index.html'),
|
||||
(os.path.join('doc', 'quickstart.html'), 'quickstart.html'),
|
||||
]:
|
||||
(os.path.join('doc', 'quickstart.html'), 'quickstart.html')]:
|
||||
try:
|
||||
os.symlink(dst, os.path.join(outdir, link_name))
|
||||
except FileExistsError:
|
||||
|
@ -118,9 +118,9 @@ def main():
|
||||
pip_bin = os.path.join(tmpdir, 'bin', 'pip')
|
||||
subprocess.run(['virtualenv', tmpdir], check=True)
|
||||
subprocess.run([pip_bin, 'install', '-r', filename], check=True)
|
||||
reqs = subprocess.run([pip_bin, 'freeze'], check=True,
|
||||
stdout=subprocess.PIPE
|
||||
).stdout.decode('utf-8')
|
||||
proc = subprocess.run([pip_bin, 'freeze'], check=True,
|
||||
stdout=subprocess.PIPE)
|
||||
reqs = proc.stdout.decode('utf-8')
|
||||
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
comments = read_comments(f)
|
||||
|
@ -108,7 +108,8 @@ def get_argparser():
|
||||
install_parser = subparsers.add_parser('install',
|
||||
help='Install dictionaries')
|
||||
install_parser.add_argument('language',
|
||||
nargs='*', help="A list of languages to install.")
|
||||
nargs='*',
|
||||
help="A list of languages to install.")
|
||||
|
||||
return parser
|
||||
|
||||
|
@ -246,22 +246,22 @@ def import_netscape_bookmarks(bookmarks_file, bookmark_types, output_format):
|
||||
def import_moz_places(profile, bookmark_types, output_format):
|
||||
"""Import bookmarks from a Mozilla profile's places.sqlite database."""
|
||||
place_query = {
|
||||
'bookmark':
|
||||
("SELECT DISTINCT moz_bookmarks.title,moz_places.url "
|
||||
'bookmark': (
|
||||
"SELECT DISTINCT moz_bookmarks.title,moz_places.url "
|
||||
"FROM moz_bookmarks,moz_places "
|
||||
"WHERE moz_places.id=moz_bookmarks.fk "
|
||||
"AND moz_places.id NOT IN (SELECT place_id FROM moz_keywords) "
|
||||
"AND moz_places.url NOT LIKE 'place:%';"
|
||||
), # Bookmarks with no keywords assigned
|
||||
'keyword':
|
||||
("SELECT moz_keywords.keyword,moz_places.url "
|
||||
'keyword': (
|
||||
"SELECT moz_keywords.keyword,moz_places.url "
|
||||
"FROM moz_keywords,moz_places,moz_bookmarks "
|
||||
"WHERE moz_places.id=moz_bookmarks.fk "
|
||||
"AND moz_places.id=moz_keywords.place_id "
|
||||
"AND moz_places.url NOT LIKE '%!%s%' ESCAPE '!';"
|
||||
), # Bookmarks with keywords assigned but no %s substitution
|
||||
'search':
|
||||
("SELECT moz_keywords.keyword, "
|
||||
'search': (
|
||||
"SELECT moz_keywords.keyword, "
|
||||
" moz_bookmarks.title, "
|
||||
" search_conv(moz_places.url) AS url "
|
||||
"FROM moz_keywords,moz_places,moz_bookmarks "
|
||||
|
@ -357,9 +357,10 @@ class QuteProc(testprocess.Process):
|
||||
if not self._load_ready:
|
||||
log_line.waited_for = True
|
||||
self._is_ready('load')
|
||||
elif log_line.category == 'misc' and any(testutils.pattern_match(
|
||||
pattern=pattern, value=log_line.message) for pattern in
|
||||
start_okay_messages_focus):
|
||||
elif (log_line.category == 'misc' and any(
|
||||
testutils.pattern_match(pattern=pattern,
|
||||
value=log_line.message)
|
||||
for pattern in start_okay_messages_focus)):
|
||||
self._is_ready('focus')
|
||||
elif (log_line.category == 'init' and
|
||||
log_line.module == 'standarddir' and
|
||||
|
@ -241,8 +241,8 @@ def test_log_line_parse(data, attrs):
|
||||
pytest.param(
|
||||
{'created': 86400, 'msecs': 0, 'levelname': 'DEBUG', 'name': 'foo',
|
||||
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 10,
|
||||
'message': 'quux', 'traceback': 'Traceback (most recent call '
|
||||
'last):\n here be dragons'},
|
||||
'message': 'quux', 'traceback': ('Traceback (most recent call '
|
||||
'last):\n here be dragons')},
|
||||
False, False,
|
||||
'{timestamp} DEBUG foo bar:qux:10 quux\n'
|
||||
'Traceback (most recent call last):\n'
|
||||
|
@ -31,7 +31,8 @@ from qutebrowser.utils import qtutils
|
||||
from qutebrowser.commands import cmdexc
|
||||
|
||||
|
||||
@hypothesis.given(strategies.lists(min_size=0, max_size=3,
|
||||
@hypothesis.given(strategies.lists(
|
||||
min_size=0, max_size=3,
|
||||
elements=strategies.integers(min_value=0, max_value=2**31)))
|
||||
def test_first_last_item(counts):
|
||||
"""Test that first() and last() index to the first and last items."""
|
||||
|
@ -170,8 +170,9 @@ def test_completion_item_focus_fetch(completionview, qtbot):
|
||||
emitted.
|
||||
"""
|
||||
model = completionmodel.CompletionModel()
|
||||
cat = mock.Mock(spec=['layoutChanged', 'layoutAboutToBeChanged',
|
||||
'canFetchMore', 'fetchMore', 'rowCount', 'index', 'data'])
|
||||
cat = mock.Mock(spec=[
|
||||
'layoutChanged', 'layoutAboutToBeChanged', 'canFetchMore',
|
||||
'fetchMore', 'rowCount', 'index', 'data'])
|
||||
cat.canFetchMore = lambda *_: True
|
||||
cat.rowCount = lambda *_: 2
|
||||
cat.fetchMore = mock.Mock()
|
||||
|
@ -642,9 +642,9 @@ def test_setting_option_completion(qtmodeltester, config_stub,
|
||||
_check_completions(model, {
|
||||
"Options": [
|
||||
('aliases', 'Aliases for commands.', '{"q": "quit"}'),
|
||||
('bindings.commands', 'Default keybindings',
|
||||
('bindings.commands', 'Default keybindings', (
|
||||
'{"normal": {"<ctrl+q>": "quit", "ZQ": "quit", '
|
||||
'"I": "invalid", "d": "scroll down"}}'),
|
||||
'"I": "invalid", "d": "scroll down"}}')),
|
||||
('bindings.default', 'Default keybindings',
|
||||
'{"normal": {"<ctrl+q>": "quit", "d": "tab-close"}}'),
|
||||
]
|
||||
|
@ -318,7 +318,8 @@ class TestConfigPyModules:
|
||||
sys.path = old_path
|
||||
|
||||
def test_bind_in_module(self, confpy, qbmodulepy, tmpdir):
|
||||
qbmodulepy.write('def run(config):',
|
||||
qbmodulepy.write(
|
||||
'def run(config):',
|
||||
' config.bind(",a", "message-info foo", mode="normal")')
|
||||
confpy.write_qbmodule()
|
||||
confpy.read()
|
||||
|
@ -27,28 +27,22 @@ _samples = 'tests/unit/scripts/importer_sample'
|
||||
|
||||
def qm_expected(input_format):
|
||||
"""Read expected quickmark-formatted output."""
|
||||
with open(
|
||||
os.path.join(_samples, input_format, 'quickmarks'),
|
||||
'r',
|
||||
encoding='utf-8') as f:
|
||||
with open(os.path.join(_samples, input_format, 'quickmarks'),
|
||||
'r', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def bm_expected(input_format):
|
||||
"""Read expected bookmark-formatted output."""
|
||||
with open(
|
||||
os.path.join(_samples, input_format, 'bookmarks'),
|
||||
'r',
|
||||
encoding='utf-8') as f:
|
||||
with open(os.path.join(_samples, input_format, 'bookmarks'),
|
||||
'r', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def search_expected(input_format):
|
||||
"""Read expected search-formatted (config.py) output."""
|
||||
with open(
|
||||
os.path.join(_samples, input_format, 'config_py'),
|
||||
'r',
|
||||
encoding='utf-8') as f:
|
||||
with open(os.path.join(_samples, input_format, 'config_py'),
|
||||
'r', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
"""Tests for qutebrowser.utils.qtutils."""
|
||||
|
||||
import io
|
||||
@ -40,6 +41,7 @@ from qutebrowser.utils import qtutils, utils
|
||||
import overflow_test_cases
|
||||
|
||||
|
||||
# pylint: disable=bad-continuation
|
||||
@pytest.mark.parametrize(['qversion', 'compiled', 'pyqt', 'version', 'exact',
|
||||
'expected'], [
|
||||
# equal versions
|
||||
@ -61,6 +63,7 @@ import overflow_test_cases
|
||||
# all up-to-date
|
||||
('5.4.0', '5.4.0', '5.4.0', '5.4.0', False, True),
|
||||
])
|
||||
# pylint: enable=bad-continuation
|
||||
def test_version_check(monkeypatch, qversion, compiled, pyqt, version, exact,
|
||||
expected):
|
||||
"""Test for version_check().
|
||||
|
@ -492,16 +492,12 @@ def test_filename_from_url(qurl, output):
|
||||
(QUrl('qute://'), None),
|
||||
(QUrl('qute://foobar'), None),
|
||||
(QUrl('mailto:nobody'), None),
|
||||
(QUrl('ftp://example.com/'),
|
||||
('ftp', 'example.com', 21)),
|
||||
(QUrl('ftp://example.com:2121/'),
|
||||
('ftp', 'example.com', 2121)),
|
||||
(QUrl('ftp://example.com/'), ('ftp', 'example.com', 21)),
|
||||
(QUrl('ftp://example.com:2121/'), ('ftp', 'example.com', 2121)),
|
||||
(QUrl('http://qutebrowser.org:8010/waterfall'),
|
||||
('http', 'qutebrowser.org', 8010)),
|
||||
(QUrl('https://example.com/'),
|
||||
('https', 'example.com', 443)),
|
||||
(QUrl('https://example.com:4343/'),
|
||||
('https', 'example.com', 4343)),
|
||||
(QUrl('https://example.com/'), ('https', 'example.com', 443)),
|
||||
(QUrl('https://example.com:4343/'), ('https', 'example.com', 4343)),
|
||||
(QUrl('http://user:password@qutebrowser.org/foo?bar=baz#fish'),
|
||||
('http', 'qutebrowser.org', 80)),
|
||||
])
|
||||
|
@ -467,12 +467,12 @@ def test_path_info(monkeypatch, equal):
|
||||
equal: Whether system data / data and system config / config are equal.
|
||||
"""
|
||||
patches = {
|
||||
'config': lambda auto=False:
|
||||
'config': lambda auto=False: (
|
||||
'AUTO CONFIG PATH' if auto and not equal
|
||||
else 'CONFIG PATH',
|
||||
'data': lambda system=False:
|
||||
else 'CONFIG PATH'),
|
||||
'data': lambda system=False: (
|
||||
'SYSTEM DATA PATH' if system and not equal
|
||||
else 'DATA PATH',
|
||||
else 'DATA PATH'),
|
||||
'cache': lambda: 'CACHE PATH',
|
||||
'runtime': lambda: 'RUNTIME PATH',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user