diff --git a/src/prompt_toolkit/input/win32.py b/src/prompt_toolkit/input/win32.py index 9ad72aee1..35e8948d2 100644 --- a/src/prompt_toolkit/input/win32.py +++ b/src/prompt_toolkit/input/win32.py @@ -314,10 +314,10 @@ def _get_keys( # Process if this is a key event. (We also have mouse, menu and # focus events.) - if type(ev) == KEY_EVENT_RECORD and ev.KeyDown: + if isinstance(ev, KEY_EVENT_RECORD) and ev.KeyDown: yield from self._event_to_key_presses(ev) - elif type(ev) == MOUSE_EVENT_RECORD: + elif isinstance(ev, MOUSE_EVENT_RECORD): yield from self._handle_mouse(ev) @staticmethod @@ -379,7 +379,7 @@ def _event_to_key_presses(self, ev: KEY_EVENT_RECORD) -> list[KeyPress]: """ For this `KEY_EVENT_RECORD`, return a list of `KeyPress` instances. """ - assert type(ev) == KEY_EVENT_RECORD and ev.KeyDown + assert isinstance(ev, KEY_EVENT_RECORD) and ev.KeyDown result: KeyPress | None = None