This commit is contained in:
Florian Bruhin 2018-12-10 16:05:17 +01:00
parent 4e99caafb9
commit 35a3fe029d
7 changed files with 15 additions and 8 deletions

View File

@ -46,6 +46,7 @@ ignore =
min-version = 3.4.0
max-complexity = 12
per-file-ignores =
/qutebrowser/api/hook.py : N801
/tests/**/*.py : D100,D101,D401
/tests/unit/browser/test_history.py : N806
/tests/helpers/fixtures.py : N806

View File

@ -18,6 +18,9 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""APIs related to downloading files."""
import io
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QUrl
@ -33,6 +36,7 @@ class TempDownload(QObject):
finished = pyqtSignal()
def __init__(self, item: qtnetworkdownloads.DownloadItem) -> None:
super().__init__()
self._item = item
self._item.finished.connect(self._on_download_finished)
self.successful = False

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=invalid-name
"""Hooks for extensions."""
import importlib
@ -32,7 +34,7 @@ def _add_module_info(func: typing.Callable) -> loader.ModuleInfo:
return loader.add_module_info(module)
class init: # noqa: N801,N806 pylint: disable=invalid-name
class init:
"""Decorator to mark a function to run when initializing."""

View File

@ -19,11 +19,6 @@
"""APIs related to intercepting/blocking requests."""
import typing
import attr
from PyQt5.QtCore import QUrl
from qutebrowser.extensions import requests
# pylint: disable=unused-import
from qutebrowser.extensions.requests import Request

View File

@ -76,7 +76,8 @@ class _FakeDownload(downloads.TempDownload):
"""A download stub to use on_download_finished with local files."""
def __init__(self, fileobj: typing.IO[bytes]) -> None:
def __init__(self, # pylint: disable=super-init-not-called
fileobj: typing.IO[bytes]) -> None:
self.fileobj = fileobj
self.successful = True
@ -337,6 +338,7 @@ def on_config_changed() -> None:
@hook.init()
def init(context: apitypes.InitContext) -> None:
"""Initialize the host blocker."""
global _host_blocker
_host_blocker = HostBlocker(data_dir=context.data_dir,
config_dir=context.config_dir,

View File

@ -28,7 +28,7 @@ import pathlib
import attr
from PyQt5.QtCore import pyqtSlot, QObject
from PyQt5.QtCore import pyqtSlot
from qutebrowser import components
from qutebrowser.config import config

View File

@ -130,6 +130,9 @@ def whitelist_generator(): # noqa
yield 'scripts.get_coredumpctl_traces.Line.gid'
yield 'scripts.importer.import_moz_places.places.row_factory'
# component hooks
yield 'qutebrowser.components.adblock.on_config_changed'
def filter_func(item):
"""Check if a missing function should be filtered or not.