summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-09-16 14:53:12 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-09-16 15:00:19 +0200
commitfc4fd5f6b0d9ff206a26526730bb07710dc63715 (patch)
tree10d5ef0253718dd30511935bd393d08373a60df7
parent77facc80013b942cc80fd6525268792809ccb1fa (diff)
downloadqutebrowser-fc4fd5f6b0d9ff206a26526730bb07710dc63715.tar.gz
qutebrowser-fc4fd5f6b0d9ff206a26526730bb07710dc63715.zip
mypy: Use cast instead of ignore for QKeySequence
Follow-up to 3d93e1537836e91580eae32714f440626a2a1e15
-rw-r--r--qutebrowser/keyinput/keyutils.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/qutebrowser/keyinput/keyutils.py b/qutebrowser/keyinput/keyutils.py
index 87a9d7ae9..9a0deffc5 100644
--- a/qutebrowser/keyinput/keyutils.py
+++ b/qutebrowser/keyinput/keyutils.py
@@ -33,7 +33,7 @@ handle what we actually think we do.
import itertools
import dataclasses
-from typing import Iterator, List, Mapping, Optional, Union, overload, cast
+from typing import Iterator, Iterable, List, Mapping, Optional, Union, overload, cast
from qutebrowser.qt import machinery
from qutebrowser.qt.core import Qt, QEvent
@@ -549,10 +549,10 @@ class KeySequence:
def __iter__(self) -> Iterator[KeyInfo]:
"""Iterate over KeyInfo objects."""
- combination: QKeySequence
- for combination in itertools.chain.from_iterable(
- self._sequences # type: ignore[arg-type]
- ):
+ # FIXME:mypy Stubs seem to be unaware that iterating a QKeySequence produces
+ # _KeyInfoType
+ sequences = cast(List[Iterable[_KeyInfoType]], self._sequences)
+ for combination in itertools.chain.from_iterable(sequences):
yield KeyInfo.from_qt(combination)
def __repr__(self) -> str: