More refactoring of forwarding widget syntax to appease linters

This commit is contained in:
brightonanc 2025-12-21 07:56:53 -05:00
parent db2ec8af46
commit c94f70206a
6 changed files with 12 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import string
import types
import dataclasses
import traceback
from typing import Optional, List
from typing import Optional
from collections.abc import Mapping, MutableMapping, Sequence
from qutebrowser.qt.core import QObject, pyqtSignal
@ -198,7 +198,7 @@ class BaseKeyParser(QObject):
self._pure_sequence = keyutils.KeySequence()
self._sequence = keyutils.KeySequence()
self._count = ''
self._count_keyposs: List[int] = []
self._count_keyposs: list[int] = []
self._mode = mode
self._do_log = do_log
self.passthrough = passthrough

View File

@ -18,7 +18,7 @@ handle what we actually think we do.
import itertools
import dataclasses
from typing import Optional, Union, overload, cast, Tuple
from typing import Optional, Union, overload, cast
from collections.abc import Iterator, Iterable, Mapping, Sequence
from qutebrowser.qt import machinery

View File

@ -7,8 +7,7 @@
from qutebrowser.qt.widgets import QApplication
import functools
import dataclasses
from typing import Union, cast, List
from typing import Union, cast
from collections.abc import Mapping, MutableMapping, Callable
from qutebrowser.qt import machinery
@ -256,7 +255,7 @@ class ModeManager(QObject):
self._releaseevents_to_pass: set[keyutils.KeyEvent] = set()
# Set after __init__
self.hintmanager = cast(hints.HintManager, None)
self._partial_match_events: List[keyutils.QueuedKeyEventPair] = []
self._partial_match_events: list[keyutils.QueuedKeyEventPair] = []
self.forward_partial_key.connect(self.forward_partial_match_event)
self._partial_timer = usertypes.Timer(self, 'partial-match')
self._partial_timer.setSingleShot(True)

View File

@ -11,7 +11,7 @@ Module attributes:
import traceback
import enum
import functools
from typing import TYPE_CHECKING, List
from typing import TYPE_CHECKING
from collections.abc import Sequence
from qutebrowser.qt.core import pyqtSlot, Qt, QObject
@ -145,7 +145,7 @@ class HintKeyParser(basekeyparser.BaseKeyParser):
self._hintmanager = hintmanager
self._filtertext = ''
self._last_press = LastPress.none
self._partial_match_events: List[keyutils.QueuedKeyEventPair] = []
self._partial_match_events: list[keyutils.QueuedKeyEventPair] = []
self.keystring_updated.connect(self._hintmanager.handle_partial_key)
self._command_parser.forward_partial_key.connect(
self.forward_partial_match_event)

View File

@ -4,7 +4,7 @@
import pytest
from qutebrowser.qt.core import Qt, QObject, pyqtSignal, QTimer, QEvent
from qutebrowser.qt.core import Qt, QObject, pyqtSignal, QEvent
from qutebrowser.qt.gui import QKeyEvent, QKeySequence
from qutebrowser.utils import usertypes, objreg
@ -140,7 +140,7 @@ def test_partial_keychain_timeout(modeman_with_timeout, config_stub, qtbot, data
assert not parser.fake_clear_keystring_called
elif behavior == 'timer_reset':
# Timer should be reset after handling the key
half_timer = QTimer()
half_timer = usertypes.Timer()
half_timer.setSingleShot(True)
half_timer.setInterval(timeout//2)
half_timer.start()

View File

@ -6,11 +6,12 @@
from unittest import mock
from qutebrowser.qt.core import Qt, QTimer
from qutebrowser.qt.core import Qt
from qutebrowser.qt.gui import QKeySequence
import pytest
from qutebrowser.utils import usertypes
from qutebrowser.keyinput import modeparsers, keyutils
from qutebrowser.config import configexc
@ -307,7 +308,7 @@ class TestHintKeyParser:
assert not timer.isActive()
elif behavior == 'timer_reset':
# Timer should be reset after handling the key
half_timer = QTimer()
half_timer = usertypes.Timer()
half_timer.setSingleShot(True)
half_timer.setInterval(timeout//2)
half_timer.start()