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 min-version = 3.4.0
max-complexity = 12 max-complexity = 12
per-file-ignores = per-file-ignores =
/qutebrowser/api/hook.py : N801
/tests/**/*.py : D100,D101,D401 /tests/**/*.py : D100,D101,D401
/tests/unit/browser/test_history.py : N806 /tests/unit/browser/test_history.py : N806
/tests/helpers/fixtures.py : N806 /tests/helpers/fixtures.py : N806

View File

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

View File

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

View File

@ -19,11 +19,6 @@
"""APIs related to intercepting/blocking requests.""" """APIs related to intercepting/blocking requests."""
import typing
import attr
from PyQt5.QtCore import QUrl
from qutebrowser.extensions import requests from qutebrowser.extensions import requests
# pylint: disable=unused-import # pylint: disable=unused-import
from qutebrowser.extensions.requests import Request 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.""" """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.fileobj = fileobj
self.successful = True self.successful = True
@ -337,6 +338,7 @@ def on_config_changed() -> None:
@hook.init() @hook.init()
def init(context: apitypes.InitContext) -> None: def init(context: apitypes.InitContext) -> None:
"""Initialize the host blocker."""
global _host_blocker global _host_blocker
_host_blocker = HostBlocker(data_dir=context.data_dir, _host_blocker = HostBlocker(data_dir=context.data_dir,
config_dir=context.config_dir, config_dir=context.config_dir,

View File

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

View File

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