summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-27 15:46:07 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-03-27 15:50:50 +0100
commite41e4e66295442e05426223791f46398251f75f2 (patch)
tree18c05cd453ee380776b05a33541c0bffc7b081ee
parentf1f0dc73df4f51822ac6207356e7928e68627ced (diff)
downloadqutebrowser-e41e4e66295442e05426223791f46398251f75f2.tar.gz
qutebrowser-e41e4e66295442e05426223791f46398251f75f2.zip
notifications: Fix lint
-rw-r--r--.mypy.ini3
-rw-r--r--qutebrowser/browser/webengine/notification.py21
-rw-r--r--qutebrowser/config/configdata.yml4
3 files changed, 17 insertions, 11 deletions
diff --git a/.mypy.ini b/.mypy.ini
index 5b29efaac..b1cd8967c 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -53,6 +53,9 @@ disallow_untyped_defs = True
[mypy-qutebrowser.browser.webengine.webengineinspector]
disallow_untyped_defs = True
+[mypy-qutebrowser.browser.webengine.notification]
+disallow_untyped_defs = True
+
[mypy-qutebrowser.misc.guiprocess]
disallow_untyped_defs = True
diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py
index 2d24597aa..6a555bb13 100644
--- a/qutebrowser/browser/webengine/notification.py
+++ b/qutebrowser/browser/webengine/notification.py
@@ -167,7 +167,7 @@ class NotificationBridgePresenter(QObject):
config.instance.changed.connect(self._init_adapter)
@config.change_filter('content.notifications.presenter')
- def _init_adapter(self):
+ def _init_adapter(self) -> None:
"""Initialize the adapter to use based on the config."""
setting = config.val.content.notifications.presenter
log.misc.debug(f"Setting up notification adapter ({setting})...")
@@ -260,8 +260,8 @@ class NotificationBridgePresenter(QObject):
if self._adapter is None:
# If a fatal error occurred, we replace the adapter via its "error" signal.
- log.misc.debug("Adapter vanished, bailing out")
- return # type: ignore[unreachable]
+ log.misc.debug("Adapter vanished, bailing out") # type: ignore[unreachable]
+ return
if notification_id <= 0:
raise Error(f"Got invalid notification id {notification_id}")
@@ -319,7 +319,7 @@ class NotificationBridgePresenter(QObject):
try:
notification = self._active_notifications.pop(notification_id)
except KeyError:
- log.misc.debug(f"Did not find matching notification, ignoring")
+ log.misc.debug("Did not find matching notification, ignoring")
# Notification from a different application
return
@@ -344,7 +344,7 @@ class NotificationBridgePresenter(QObject):
notification = self._active_notifications[notification_id]
except KeyError:
# Notification from a different application
- log.misc.debug(f"Did not find matching notification, ignoring")
+ log.misc.debug("Did not find matching notification, ignoring")
return
try:
@@ -355,7 +355,7 @@ class NotificationBridgePresenter(QObject):
log.misc.debug(f"Ignoring click request for notification {notification_id} "
"due to PyQt bug")
- def _drop_adapter(self):
+ def _drop_adapter(self) -> None:
"""Drop the currently active adapter (if any).
This means we'll reinitialize a new one (including re-testing available options)
@@ -637,7 +637,7 @@ class _ServerCapabilities:
kde_origin_name: bool
@classmethod
- def from_list(cls, capabilities):
+ def from_list(cls, capabilities: List[str]) -> "_ServerCapabilities":
return cls(
actions='actions' in capabilities,
body_markup='body-markup' in capabilities,
@@ -979,7 +979,8 @@ class DBusNotificationAdapter(AbstractNotificationAdapter):
)
self._verify_message(reply, "as", QDBusMessage.ReplyMessage)
- self._capabilities = _ServerCapabilities.from_list(reply.arguments()[0])
+ caplist = reply.arguments()[0]
+ self._capabilities: _ServerCapabilities = _ServerCapabilities.from_list(caplist)
if self._quirks.avoid_actions and self._capabilities.actions:
self._capabilities.actions = False
@@ -1000,7 +1001,9 @@ class DBusNotificationAdapter(AbstractNotificationAdapter):
if self._capabilities.kde_origin_name or not is_useful_origin:
prefix = None
elif self._capabilities.body_markup and self._capabilities.body_hyperlinks:
- href = html.escape(origin_url.toString(QUrl.FullyEncoded))
+ href = html.escape(
+ origin_url.toString(QUrl.FullyEncoded) # type: ignore[arg-type]
+ )
text = html.escape(urlstr, quote=False)
prefix = f'<a href="{href}">{text}</a>'
elif self._capabilities.body_markup:
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index c417ffdd4..8b076f1fd 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -931,8 +931,8 @@ content.notifications.presenter:
switch to it at runtime.
- messages: Show notifications as qutebrowser messages. Most notification features
aren't available.
- - herbe: (experimental!) Show notifications using herbe (github.com/dudik/herbe). Most
- notification features aren't available.
+ - herbe: (experimental!) Show notifications using herbe (github.com/dudik/herbe).
+ Most notification features aren't available.
backend:
QtWebEngine: Qt 5.14
QtWebKit: false