Merge branch 'pyup-scheduled-update-2019-02-11'

This commit is contained in:
Florian Bruhin 2019-02-16 21:02:39 +01:00
commit 2214fd63b5
29 changed files with 110 additions and 113 deletions

11
.flake8
View File

@ -46,12 +46,11 @@ ignore =
min-version = 3.4.0 min-version = 3.4.0
max-complexity = 12 max-complexity = 12
per-file-ignores = per-file-ignores =
/qutebrowser/api/hook.py : N801 qutebrowser/api/hook.py : N801
/tests/**/*.py : D100,D101,D401 tests/* : D100,D101
/tests/unit/browser/test_history.py : N806 tests/unit/browser/test_history.py : D100,D101,N806
/tests/helpers/fixtures.py : N806 tests/helpers/fixtures.py : D100,D101,N806
/tests/unit/browser/webkit/http/test_content_disposition.py : D400 tests/unit/browser/webkit/http/test_content_disposition.py : D100,D101,D400
/scripts/dev/ci/appveyor_install.py : FI53
copyright-check = True copyright-check = True
copyright-regexp = # Copyright [\d-]+ .* copyright-regexp = # Copyright [\d-]+ .*
copyright-min-file-size = 110 copyright-min-file-size = 110

View File

@ -1,27 +1,25 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
attrs==18.2.0 attrs==18.2.0
flake8==3.6.0 entrypoints==0.3
flake8==3.7.5
flake8-bugbear==18.8.0 flake8-bugbear==18.8.0
flake8-builtins==1.4.1 flake8-builtins==1.4.1
flake8-comprehensions==1.4.1 flake8-comprehensions==2.0.0
flake8-copyright==0.2.2 flake8-copyright==0.2.2
flake8-debugger==3.1.0 flake8-debugger==3.1.0
flake8-deprecated==1.3 flake8-deprecated==1.3
flake8-docstrings==1.3.0 flake8-docstrings==1.3.0
flake8-future-import==0.4.5 flake8-future-import==0.4.5
flake8-mock==0.3 flake8-mock==0.3
flake8-per-file-ignores==0.7
flake8-polyfill==1.0.2 flake8-polyfill==1.0.2
flake8-string-format==0.2.3 flake8-string-format==0.2.3
flake8-tidy-imports==1.1.0 flake8-tidy-imports==2.0.0
flake8-tuple==0.2.13 flake8-tuple==0.2.13
mccabe==0.6.1 mccabe==0.6.1
pathmatch==0.2.1 pep8-naming==0.8.2
pep8-naming==0.7.0 pycodestyle==2.5.0
pycodestyle==2.4.0
pydocstyle==3.0.0 pydocstyle==3.0.0
pyflakes==2.0.0 pyflakes==2.1.0
six==1.12.0 six==1.12.0
snowballstemmer==1.2.1 snowballstemmer==1.2.1
typing==3.6.6

View File

@ -8,7 +8,6 @@ flake8-deprecated
flake8-docstrings flake8-docstrings
flake8-future-import flake8-future-import
flake8-mock flake8-mock
flake8-per-file-ignores
flake8-string-format flake8-string-format
flake8-tidy-imports flake8-tidy-imports
flake8-tuple flake8-tuple

View File

@ -1,8 +1,8 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
mypy==0.650 mypy==0.670
mypy-extensions==0.4.1 mypy-extensions==0.4.1
PyQt5==5.11.3 # PyQt5==5.11.3
PyQt5-sip==4.19.13 # PyQt5-sip==4.19.14
-e git+https://github.com/qutebrowser/PyQt5-stubs.git@wip#egg=PyQt5_stubs -e git+https://github.com/qutebrowser/PyQt5-stubs.git@wip#egg=PyQt5_stubs
typed-ast==1.1.1 typed-ast==1.3.1

View File

@ -3,3 +3,4 @@ mypy
# remove @commit-id for scm installs # remove @commit-id for scm installs
#@ replace: @.*# @wip# #@ replace: @.*# @wip#
#@ ignore: PyQt5, PyQt5-sip

View File

@ -2,6 +2,5 @@
colorama==0.4.1 colorama==0.4.1
cssutils==1.0.2 cssutils==1.0.2
hunter==2.1.0 hunter==2.2.1
Pympler==0.6 Pympler==0.6
six==1.12.0

View File

@ -1,8 +1,8 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
appdirs==1.4.3 appdirs==1.4.3
packaging==18.0 packaging==19.0
pyparsing==2.3.0 pyparsing==2.3.1
setuptools==40.6.3 setuptools==40.8.0
six==1.12.0 six==1.12.0
wheel==0.32.3 wheel==0.32.3

View File

@ -5,8 +5,8 @@ astroid==2.1.0
certifi==2018.11.29 certifi==2018.11.29
cffi==1.11.5 cffi==1.11.5
chardet==3.0.4 chardet==3.0.4
cryptography==2.4.2 cryptography==2.5
github3.py==1.2.0 github3.py==1.3.0
idna==2.8 idna==2.8
isort==4.3.4 isort==4.3.4
jwcrypto==0.6.0 jwcrypto==0.6.0
@ -14,10 +14,10 @@ lazy-object-proxy==1.3.1
mccabe==0.6.1 mccabe==0.6.1
pycparser==2.19 pycparser==2.19
pylint==2.2.2 pylint==2.2.2
python-dateutil==2.7.5 python-dateutil==2.8.0
./scripts/dev/pylint_checkers ./scripts/dev/pylint_checkers
requests==2.21.0 requests==2.21.0
six==1.12.0 six==1.12.0
uritemplate==3.0.0 uritemplate==3.0.0
urllib3==1.24.1 urllib3==1.24.1
wrapt==1.10.11 wrapt==1.11.1

View File

@ -1,4 +1,5 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
PyQt5==5.11.3 PyQt5==5.12
PyQt5-sip==4.19.13 PyQt5-sip==4.19.14
PyQtWebEngine==5.12

View File

@ -1 +1,2 @@
PyQt5 PyQt5
PyQtWebEngine

View File

@ -9,13 +9,13 @@ idna==2.8
imagesize==1.1.0 imagesize==1.1.0
Jinja2==2.10 Jinja2==2.10
MarkupSafe==1.1.0 MarkupSafe==1.1.0
packaging==18.0 packaging==19.0
Pygments==2.3.1 Pygments==2.3.1
pyparsing==2.3.0 pyparsing==2.3.1
pytz==2018.7 pytz==2018.9
requests==2.21.0 requests==2.21.0
six==1.12.0 six==1.12.0
snowballstemmer==1.2.1 snowballstemmer==1.2.1
Sphinx==1.8.3 Sphinx==1.8.4
sphinxcontrib-websupport==1.1.0 sphinxcontrib-websupport==1.1.0
urllib3==1.24.1 urllib3==1.24.1

View File

@ -1,41 +1,42 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
atomicwrites==1.2.1 atomicwrites==1.3.0
attrs==18.2.0 attrs==18.2.0
backports.functools-lru-cache==1.5 backports.functools-lru-cache==1.5
beautifulsoup4==4.7.0 beautifulsoup4==4.7.1
cheroot==6.5.3 cheroot==6.5.4
Click==7.0 Click==7.0
# colorama==0.4.1 # colorama==0.4.1
coverage==4.5.2 coverage==4.5.2
EasyProcess==0.2.5 EasyProcess==0.2.5
Flask==1.0.2 Flask==1.0.2
glob2==0.6 glob2==0.6
hunter==2.1.0 hunter==2.2.1
hypothesis==3.85.2 hypothesis==4.5.6
itsdangerous==1.1.0 itsdangerous==1.1.0
# Jinja2==2.10 # Jinja2==2.10
Mako==1.0.7 Mako==1.0.7
# MarkupSafe==1.1.0 # MarkupSafe==1.1.0
more-itertools==5.0.0 more-itertools==5.0.0
parse==1.9.0 parse==1.11.1
parse-type==0.4.2 parse-type==0.4.2
pluggy==0.8.0 pluggy==0.8.1
py==1.7.0 py==1.7.0
py-cpuinfo==4.0.0 py-cpuinfo==4.0.0
pytest==4.0.2 pytest==4.2.0
pytest-bdd==3.0.1 pytest-bdd==3.0.1
pytest-benchmark==3.1.1 pytest-benchmark==3.2.2
pytest-cov==2.6.0 pytest-cov==2.6.1
pytest-faulthandler==1.5.0 pytest-faulthandler==1.5.0
pytest-instafail==0.4.0 pytest-instafail==0.4.0
pytest-mock==1.10.0 pytest-mock==1.10.1
pytest-qt==3.2.2 pytest-qt==3.2.2
pytest-repeat==0.7.0 pytest-repeat==0.7.0
pytest-rerunfailures==5.0 pytest-rerunfailures==6.0
pytest-travis-fold==1.3.0 pytest-travis-fold==1.3.0
pytest-xvfb==1.1.0 pytest-xvfb==1.2.0
PyVirtualDisplay==0.2.1 PyVirtualDisplay==0.2.1
six==1.12.0 six==1.12.0
soupsieve==1.7.3
vulture==1.0 vulture==1.0
Werkzeug==0.14.1 Werkzeug==0.14.1

View File

@ -1,9 +1,9 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py # This file is automatically generated by scripts/dev/recompile_requirements.py
filelock==3.0.10 filelock==3.0.10
pluggy==0.8.0 pluggy==0.8.1
py==1.7.0 py==1.7.0
six==1.12.0 six==1.12.0
toml==0.10.0 toml==0.10.0
tox==3.6.1 tox==3.7.0
virtualenv==16.1.0 virtualenv==16.4.0

View File

@ -68,7 +68,5 @@ qt_log_ignore =
xfail_strict = true xfail_strict = true
filterwarnings = filterwarnings =
error error
# This happens in many qutebrowser dependencies... # WORKAROUND for https://github.com/pytest-dev/pytest-bdd/pull/288
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working:DeprecationWarning ignore:the `pytest\.config` global is deprecated\. Please use `request.config` or `pytest_configure` \(if you're a pytest plugin\) instead\.
# WORKAROUND for https://github.com/ionelmc/pytest-benchmark/issues/124
ignore:Node\.warn\(code, message\) form has been deprecated, use Node\.warn\(warning_instance\) instead:pytest.PytestDeprecationWarning

View File

@ -83,7 +83,7 @@ from qutebrowser.misc import utilcmds
# pylint: enable=unused-import # pylint: enable=unused-import
qApp = None q_app = None
def run(args): def run(args):
@ -101,25 +101,25 @@ def run(args):
log.init.debug("Initializing config...") log.init.debug("Initializing config...")
configinit.early_init(args) configinit.early_init(args)
global qApp global q_app
qApp = Application(args) q_app = Application(args)
qApp.setOrganizationName("qutebrowser") q_app.setOrganizationName("qutebrowser")
qApp.setApplicationName("qutebrowser") q_app.setApplicationName("qutebrowser")
qApp.setDesktopFileName("qutebrowser") q_app.setDesktopFileName("qutebrowser")
qApp.setApplicationVersion(qutebrowser.__version__) q_app.setApplicationVersion(qutebrowser.__version__)
qApp.lastWindowClosed.connect(quitter.on_last_window_closed) q_app.lastWindowClosed.connect(quitter.on_last_window_closed)
if args.version: if args.version:
print(version.version()) print(version.version())
sys.exit(usertypes.Exit.ok) sys.exit(usertypes.Exit.ok)
crash_handler = crashsignal.CrashHandler( crash_handler = crashsignal.CrashHandler(
app=qApp, quitter=quitter, args=args, parent=qApp) app=q_app, quitter=quitter, args=args, parent=q_app)
crash_handler.activate() crash_handler.activate()
objreg.register('crash-handler', crash_handler) objreg.register('crash-handler', crash_handler)
signal_handler = crashsignal.SignalHandler(app=qApp, quitter=quitter, signal_handler = crashsignal.SignalHandler(app=q_app, quitter=quitter,
parent=qApp) parent=q_app)
signal_handler.activate() signal_handler.activate()
objreg.register('signal-handler', signal_handler) objreg.register('signal-handler', signal_handler)
@ -151,7 +151,7 @@ def qt_mainloop():
WARNING: misc/crashdialog.py checks the stacktrace for this function WARNING: misc/crashdialog.py checks the stacktrace for this function
name, so if this is changed, it should be changed there as well! name, so if this is changed, it should be changed there as well!
""" """
return qApp.exec_() return q_app.exec_()
def init(args, crash_handler): def init(args, crash_handler):
@ -162,7 +162,7 @@ def init(args, crash_handler):
crash_handler: The CrashHandler instance. crash_handler: The CrashHandler instance.
""" """
log.init.debug("Starting init...") log.init.debug("Starting init...")
qApp.setQuitOnLastWindowClosed(False) q_app.setQuitOnLastWindowClosed(False)
_init_icon() _init_icon()
loader.init() loader.init()
@ -175,12 +175,12 @@ def init(args, crash_handler):
sys.exit(usertypes.Exit.err_init) sys.exit(usertypes.Exit.err_init)
log.init.debug("Initializing eventfilter...") log.init.debug("Initializing eventfilter...")
event_filter = EventFilter(qApp) event_filter = EventFilter(q_app)
qApp.installEventFilter(event_filter) q_app.installEventFilter(event_filter)
objreg.register('event-filter', event_filter) objreg.register('event-filter', event_filter)
log.init.debug("Connecting signals...") log.init.debug("Connecting signals...")
qApp.focusChanged.connect(on_focus_changed) q_app.focusChanged.connect(on_focus_changed)
_process_args(args) _process_args(args)
@ -207,7 +207,7 @@ def _init_icon():
if icon.isNull(): if icon.isNull():
log.init.warning("Failed to load icon") log.init.warning("Failed to load icon")
else: else:
qApp.setWindowIcon(icon) q_app.setWindowIcon(icon)
def _process_args(args): def _process_args(args):
@ -220,7 +220,7 @@ def _process_args(args):
window = mainwindow.MainWindow(private=None) window = mainwindow.MainWindow(private=None)
if not args.nowindow: if not args.nowindow:
window.show() window.show()
qApp.setActiveWindow(window) q_app.setActiveWindow(window)
process_pos_args(args.command) process_pos_args(args.command)
_open_startpage() _open_startpage()
@ -425,7 +425,7 @@ def _init_modules(args, crash_handler):
crash_handler: The CrashHandler instance. crash_handler: The CrashHandler instance.
""" """
log.init.debug("Initializing save manager...") log.init.debug("Initializing save manager...")
save_manager = savemanager.SaveManager(qApp) save_manager = savemanager.SaveManager(q_app)
objreg.register('save-manager', save_manager) objreg.register('save-manager', save_manager)
configinit.late_init(save_manager) configinit.late_init(save_manager)
@ -450,7 +450,7 @@ def _init_modules(args, crash_handler):
sql.init(os.path.join(standarddir.data(), 'history.sqlite')) sql.init(os.path.join(standarddir.data(), 'history.sqlite'))
log.init.debug("Initializing web history...") log.init.debug("Initializing web history...")
history.init(qApp) history.init(q_app)
except sql.SqlEnvironmentError as e: except sql.SqlEnvironmentError as e:
error.handle_fatal_exc(e, args, 'Error initializing SQL', error.handle_fatal_exc(e, args, 'Error initializing SQL',
pre_text='Error initializing SQL') pre_text='Error initializing SQL')
@ -464,31 +464,31 @@ def _init_modules(args, crash_handler):
crash_handler.handle_segfault() crash_handler.handle_segfault()
log.init.debug("Initializing sessions...") log.init.debug("Initializing sessions...")
sessions.init(qApp) sessions.init(q_app)
log.init.debug("Initializing websettings...") log.init.debug("Initializing websettings...")
websettings.init(args) websettings.init(args)
log.init.debug("Initializing quickmarks...") log.init.debug("Initializing quickmarks...")
quickmark_manager = urlmarks.QuickmarkManager(qApp) quickmark_manager = urlmarks.QuickmarkManager(q_app)
objreg.register('quickmark-manager', quickmark_manager) objreg.register('quickmark-manager', quickmark_manager)
log.init.debug("Initializing bookmarks...") log.init.debug("Initializing bookmarks...")
bookmark_manager = urlmarks.BookmarkManager(qApp) bookmark_manager = urlmarks.BookmarkManager(q_app)
objreg.register('bookmark-manager', bookmark_manager) objreg.register('bookmark-manager', bookmark_manager)
log.init.debug("Initializing cookies...") log.init.debug("Initializing cookies...")
cookie_jar = cookies.CookieJar(qApp) cookie_jar = cookies.CookieJar(q_app)
ram_cookie_jar = cookies.RAMCookieJar(qApp) ram_cookie_jar = cookies.RAMCookieJar(q_app)
objreg.register('cookie-jar', cookie_jar) objreg.register('cookie-jar', cookie_jar)
objreg.register('ram-cookie-jar', ram_cookie_jar) objreg.register('ram-cookie-jar', ram_cookie_jar)
log.init.debug("Initializing cache...") log.init.debug("Initializing cache...")
diskcache = cache.DiskCache(standarddir.cache(), parent=qApp) diskcache = cache.DiskCache(standarddir.cache(), parent=q_app)
objreg.register('cache', diskcache) objreg.register('cache', diskcache)
log.init.debug("Initializing downloads...") log.init.debug("Initializing downloads...")
download_manager = qtnetworkdownloads.DownloadManager(parent=qApp) download_manager = qtnetworkdownloads.DownloadManager(parent=q_app)
objreg.register('qtnetwork-download-manager', download_manager) objreg.register('qtnetwork-download-manager', download_manager)
log.init.debug("Initializing Greasemonkey...") log.init.debug("Initializing Greasemonkey...")
@ -735,7 +735,7 @@ class Quitter:
def _shutdown(self, status, restart): # noqa def _shutdown(self, status, restart): # noqa
"""Second stage of shutdown.""" """Second stage of shutdown."""
log.destroy.debug("Stage 2 of shutting down...") log.destroy.debug("Stage 2 of shutting down...")
if qApp is None: if q_app is None:
# No QApplication exists yet, so quit hard. # No QApplication exists yet, so quit hard.
sys.exit(status) sys.exit(status)
# Remove eventfilter # Remove eventfilter
@ -743,7 +743,7 @@ class Quitter:
log.destroy.debug("Removing eventfilter...") log.destroy.debug("Removing eventfilter...")
event_filter = objreg.get('event-filter', None) event_filter = objreg.get('event-filter', None)
if event_filter is not None: if event_filter is not None:
qApp.removeEventFilter(event_filter) q_app.removeEventFilter(event_filter)
except AttributeError: except AttributeError:
pass pass
# Close all windows # Close all windows
@ -792,7 +792,7 @@ class Quitter:
session_manager.delete_autosave() session_manager.delete_autosave()
# We use a singleshot timer to exit here to minimize the likelihood of # We use a singleshot timer to exit here to minimize the likelihood of
# segfaults. # segfaults.
QTimer.singleShot(0, functools.partial(qApp.exit, status)) QTimer.singleShot(0, functools.partial(q_app.exit, status))
class Application(QApplication): class Application(QApplication):
@ -893,7 +893,7 @@ class EventFilter(QObject):
Return: Return:
True if the event should be filtered, False if it's passed through. True if the event should be filtered, False if it's passed through.
""" """
if qApp.activeWindow() not in objreg.window_registry.values(): if q_app.activeWindow() not in objreg.window_registry.values():
# Some other window (print dialog, etc.) is focused so we pass the # Some other window (print dialog, etc.) is focused so we pass the
# event through. # event through.
return False return False

View File

@ -34,8 +34,8 @@ class FixedDataNetworkReply(QNetworkReply):
"""QNetworkReply subclass for fixed data.""" """QNetworkReply subclass for fixed data."""
def __init__(self, request, fileData, mimeType, # noqa: N803 def __init__(self, request, # pylint: disable=invalid-name
parent=None): fileData, mimeType, parent=None): # noqa: N803
"""Constructor. """Constructor.
Args: Args:

View File

@ -91,15 +91,15 @@ def _parse_yaml_type(
) -> configtypes.BaseType: ) -> configtypes.BaseType:
if isinstance(node, str): if isinstance(node, str):
# e.g: # e.g:
# type: Bool # > type: Bool
# -> create the type object without any arguments # -> create the type object without any arguments
type_name = node type_name = node
kwargs = {} # type: typing.MutableMapping[str, typing.Any] kwargs = {} # type: typing.MutableMapping[str, typing.Any]
elif isinstance(node, dict): elif isinstance(node, dict):
# e.g: # e.g:
# type: # > type:
# name: String # > name: String
# none_ok: true # > none_ok: true
# -> create the type object and pass arguments # -> create the type object and pass arguments
type_name = node.pop('name') type_name = node.pop('name')
kwargs = node kwargs = node

View File

@ -31,7 +31,7 @@ except ImportError: # pragma: no cover
try: try:
# Python2 # Python2
from Tkinter import Tk # type: ignore from Tkinter import Tk # type: ignore
import tkMessageBox as messagebox # type: ignore import tkMessageBox as messagebox # type: ignore # noqa: N813
except ImportError: except ImportError:
# Some Python without Tk # Some Python without Tk
Tk = None # type: ignore Tk = None # type: ignore

View File

@ -162,7 +162,7 @@ class ConsoleWidget(QWidget):
namespace = { namespace = {
'__name__': '__console__', '__name__': '__console__',
'__doc__': None, '__doc__': None,
'qApp': QApplication.instance(), 'q_app': QApplication.instance(),
# We use parent as self here because the user "feels" the whole # We use parent as self here because the user "feels" the whole
# console, not just the line edit. # console, not just the line edit.
'self': parent, 'self': parent,

View File

@ -199,19 +199,11 @@ def _check_modules(modules):
for name, text in modules.items(): for name, text in modules.items():
try: try:
# https://github.com/pallets/jinja/pull/628
# https://bitbucket.org/birkenfeld/pygments-main/issues/1314/
# https://github.com/pallets/jinja/issues/646
# https://bitbucket.org/fdik/pypeg/commits/dd15ca462b532019c0a3be1d39b8ee2f3fa32f4e # https://bitbucket.org/fdik/pypeg/commits/dd15ca462b532019c0a3be1d39b8ee2f3fa32f4e
messages = ['invalid escape sequence',
'Flags not at the start of the expression']
# pylint: disable=bad-continuation # pylint: disable=bad-continuation
with log.ignore_py_warnings( with log.ignore_py_warnings(
category=DeprecationWarning, category=DeprecationWarning,
message=r'({})'.format('|'.join(messages)) message=r'invalid escape sequence'
), log.ignore_py_warnings(
category=PendingDeprecationWarning,
module='imp'
), log.ignore_py_warnings( ), log.ignore_py_warnings(
category=ImportWarning, category=ImportWarning,
message=r'Not importing directory .*: missing __init__' message=r'Not importing directory .*: missing __init__'

View File

@ -40,7 +40,7 @@ from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray,
try: try:
from PyQt5.QtWebKit import qWebKitVersion from PyQt5.QtWebKit import qWebKitVersion
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
qWebKitVersion = None # type: ignore qWebKitVersion = None # type: ignore # noqa: N816
MAXVALS = { MAXVALS = {

View File

@ -659,7 +659,15 @@ def expand_windows_drive(path):
def yaml_load(f): def yaml_load(f):
"""Wrapper over yaml.load using the C loader if possible.""" """Wrapper over yaml.load using the C loader if possible."""
start = datetime.datetime.now() start = datetime.datetime.now()
data = yaml.load(f, Loader=YamlLoader)
# WORKAROUND for https://github.com/yaml/pyyaml/pull/181
with log.ignore_py_warnings(
category=DeprecationWarning,
message=r"Using or importing the ABCs from 'collections' instead "
r"of from 'collections\.abc' is deprecated, and in 3\.8 it will "
r"stop working"):
data = yaml.load(f, Loader=YamlLoader)
end = datetime.datetime.now() end = datetime.datetime.now()
delta = (end - start).total_seconds() delta = (end - start).total_seconds()

View File

@ -42,7 +42,7 @@ from PyQt5.QtWidgets import QApplication
try: try:
from PyQt5.QtWebKit import qWebKitVersion from PyQt5.QtWebKit import qWebKitVersion
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
qWebKitVersion = None # type: ignore qWebKitVersion = None # type: ignore # noqa: N816
try: try:
from PyQt5.QtWebEngineWidgets import QWebEngineProfile from PyQt5.QtWebEngineWidgets import QWebEngineProfile

View File

@ -41,7 +41,7 @@ def test_first_last_item(counts):
cat = mock.Mock(spec=['layoutChanged', 'layoutAboutToBeChanged']) cat = mock.Mock(spec=['layoutChanged', 'layoutAboutToBeChanged'])
cat.rowCount = mock.Mock(return_value=c, spec=[]) cat.rowCount = mock.Mock(return_value=c, spec=[])
model.add_category(cat) model.add_category(cat)
data = [i for i, rowCount in enumerate(counts) if rowCount > 0] data = [i for i, row_count in enumerate(counts) if row_count > 0]
if not data: if not data:
# with no items, first and last should be an invalid index # with no items, first and last should be an invalid index
assert not model.first_item().isValid() assert not model.first_item().isValid()

View File

@ -30,7 +30,7 @@ from PyQt5.QtCore import QUrl
from qutebrowser.components import adblock from qutebrowser.components import adblock
from qutebrowser.utils import urlmatch from qutebrowser.utils import urlmatch
from tests.helpers import utils from helpers import utils
pytestmark = pytest.mark.usefixtures('qapp') pytestmark = pytest.mark.usefixtures('qapp')

View File

@ -38,7 +38,7 @@ from qutebrowser.config import configtypes, configexc, configutils
from qutebrowser.utils import debug, utils, qtutils, urlmatch from qutebrowser.utils import debug, utils, qtutils, urlmatch
from qutebrowser.browser.network import pac from qutebrowser.browser.network import pac
from qutebrowser.keyinput import keyutils from qutebrowser.keyinput import keyutils
from tests.helpers import utils as testutils from helpers import utils as testutils
class Font(QFont): class Font(QFont):

View File

@ -26,7 +26,7 @@ from PyQt5.QtCore import Qt, QEvent, pyqtSignal
from PyQt5.QtGui import QKeyEvent, QKeySequence from PyQt5.QtGui import QKeyEvent, QKeySequence
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
from tests.unit.keyinput import key_data from unit.keyinput import key_data
from qutebrowser.keyinput import keyutils from qutebrowser.keyinput import keyutils
from qutebrowser.utils import utils from qutebrowser.utils import utils

View File

@ -98,7 +98,7 @@ class FakeSocket(QObject):
_connect_successful: The value returned for waitForConnected(). _connect_successful: The value returned for waitForConnected().
""" """
readyRead = pyqtSignal() readyRead = pyqtSignal() # noqa: N815
disconnected = pyqtSignal() disconnected = pyqtSignal()
def __init__(self, *, error=QLocalSocket.UnknownSocketError, state=None, def __init__(self, *, error=QLocalSocket.UnknownSocketError, state=None,

View File

@ -30,7 +30,7 @@ def test_on_focus_changed_issue1484(monkeypatch, qapp, caplog):
For some reason, Qt sometimes calls on_focus_changed() with a QBuffer as For some reason, Qt sometimes calls on_focus_changed() with a QBuffer as
argument. Let's make sure we handle that gracefully. argument. Let's make sure we handle that gracefully.
""" """
monkeypatch.setattr(app, 'qApp', qapp) monkeypatch.setattr(app, 'q_app', qapp)
buf = QBuffer() buf = QBuffer()
app.on_focus_changed(buf, buf) app.on_focus_changed(buf, buf)