mypy: Be more clever about Qt 6.8
This commit is contained in:
parent
4a5515666e
commit
c563e2d302
|
|
@ -357,13 +357,14 @@ class ProfileSetter:
|
|||
|
||||
def disable_persistent_permissions_policy(self):
|
||||
"""Disable webengine's permission persistence."""
|
||||
try:
|
||||
# New in WebEngine 6.8.0
|
||||
self._profile.setPersistentPermissionsPolicy(
|
||||
QWebEngineProfile.PersistentPermissionsPolicy.AskEveryTime
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
if machinery.IS_QT6: # for mypy
|
||||
try:
|
||||
# New in WebEngine 6.8.0
|
||||
self._profile.setPersistentPermissionsPolicy(
|
||||
QWebEngineProfile.PersistentPermissionsPolicy.AskEveryTime
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def _update_settings(option):
|
||||
|
|
|
|||
|
|
@ -11,12 +11,18 @@ import ipaddress
|
|||
import posixpath
|
||||
import urllib.parse
|
||||
import mimetypes
|
||||
from typing import Optional, Union, cast
|
||||
from typing import Optional, Union, cast, TYPE_CHECKING
|
||||
from collections.abc import Iterable
|
||||
|
||||
from qutebrowser.qt import machinery
|
||||
from qutebrowser.qt.core import QUrl, QUrlQuery
|
||||
from qutebrowser.qt.network import QHostInfo, QHostAddress, QNetworkProxy
|
||||
# WORKAROUND for
|
||||
# https://www.riverbankcomputing.com/pipermail/pyqt/2024-December/046096.html
|
||||
if TYPE_CHECKING and machinery.IS_QT6:
|
||||
from PyQt6.QtCore import QChar
|
||||
else:
|
||||
QChar = str
|
||||
|
||||
from qutebrowser.api import cmdutils
|
||||
from qutebrowser.config import config
|
||||
|
|
@ -698,9 +704,7 @@ def get_url_yank_text(url: QUrl, *, pretty: bool) -> str:
|
|||
url_query = QUrlQuery()
|
||||
url_query_str = url.query()
|
||||
if '&' not in url_query_str and ';' in url_query_str:
|
||||
# type ignore as WORKAROUND for
|
||||
# https://www.riverbankcomputing.com/pipermail/pyqt/2024-December/046096.html
|
||||
url_query.setQueryDelimiters('=', ';') # type: ignore[arg-type]
|
||||
url_query.setQueryDelimiters(cast(QChar, '='), cast(QChar, ';'))
|
||||
url_query.setQuery(url_query_str)
|
||||
for key in dict(url_query.queryItems()):
|
||||
if key in config.val.url.yank_ignored_parameters:
|
||||
|
|
|
|||
Loading…
Reference in New Issue