From fc6c6d4998051e6d68f830f39a83778703900af1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 1 Nov 2016 23:09:54 +0100 Subject: [PATCH] Fix lint --- qutebrowser/browser/downloads.py | 3 ++- qutebrowser/browser/webengine/webenginedownloads.py | 10 ++++++---- tests/end2end/features/test_downloads_bdd.py | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 0a7396292..afb9bb62b 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -559,7 +559,8 @@ class AbstractDownloadItem(QObject): target: The usertypes.DownloadTarget for this download. """ if isinstance(target, usertypes.FileObjDownloadTarget): - raise UnsupportedAttribute("FileObjDownloadTarget is unsupported") + raise UnsupportedOperationError("FileObjDownloadTarget is " + "unsupported") elif isinstance(target, usertypes.FileDownloadTarget): self._set_filename(target.filename) elif isinstance(target, usertypes.OpenFileDownloadTarget): diff --git a/qutebrowser/browser/webengine/webenginedownloads.py b/qutebrowser/browser/webengine/webenginedownloads.py index 77f970e88..ebe4686b4 100644 --- a/qutebrowser/browser/webengine/webenginedownloads.py +++ b/qutebrowser/browser/webengine/webenginedownloads.py @@ -22,8 +22,9 @@ import functools from PyQt5.QtCore import pyqtSlot, Qt +# pylint: disable=no-name-in-module,import-error,useless-suppression from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem -from PyQt5.QtWidgets import QApplication +# pylint: enable=no-name-in-module,import-error,useless-suppression from qutebrowser.browser import downloads from qutebrowser.utils import debug, usertypes, message, log @@ -80,7 +81,7 @@ class DownloadItem(downloads.AbstractDownloadItem): # https://bugreports.qt.io/browse/QTBUG-56840 raise downloads.UnsupportedOperationError - def get_open_filename(self): + def _get_open_filename(self): return self._filename def _set_fileobj(self, fileobj): @@ -90,8 +91,8 @@ class DownloadItem(downloads.AbstractDownloadItem): state = self._qt_item.state() if state != QWebEngineDownloadItem.DownloadRequested: state_name = debug.qenum_key(QWebEngineDownloadItem, state) - raise ValueError("Trying to set filename {} on {!r} which is state " - "{} (not in requested state)!".format( + raise ValueError("Trying to set filename {} on {!r} which is " + "state {} (not in requested state)!".format( filename, self, state_name)) def _ask_confirm_question(self, title, msg): @@ -123,6 +124,7 @@ class DownloadManager(downloads.AbstractDownloadManager): @pyqtSlot(QWebEngineDownloadItem) def handle_download(self, qt_item): + """Start a download coming from a QWebEngineProfile.""" download = DownloadItem(qt_item) self._init_item(download, auto_remove=False, suggested_filename=qt_item.path()) diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py index ac82aa04f..4b9476f04 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -21,7 +21,6 @@ import os import sys import shlex -import pytest import pytest_bdd as bdd bdd.scenarios('downloads.feature')