From 34383fcab51e28a76a2698698fa45541ed3500cb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 12 Sep 2022 12:30:57 +0100 Subject: [PATCH] [pynput] Fix annotations of Controller.Key(Code) (#8722) Document stubtest entries --- stubs/pynput/@tests/stubtest_allowlist.txt | 12 +++++------- stubs/pynput/pynput/keyboard/_base.pyi | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt index 410c9faa2..b7f3db650 100644 --- a/stubs/pynput/@tests/stubtest_allowlist.txt +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -1,9 +1,7 @@ -# TODO: go through this allowlist, figure out which of them are false positives -pynput.keyboard.Controller._Key -pynput.keyboard.Controller._KeyCode +# These __init__ methods have *args, **kwargs arguments on some platforms, but not others pynput.keyboard.Controller.__init__ -pynput.keyboard._base.Controller._Key -pynput.keyboard._base.Controller._KeyCode -pynput.keyboard._dummy.Controller._Key -pynput.keyboard._dummy.Controller._KeyCode pynput.mouse.Controller.__init__ +# stubtest issues with non-`type` metaclasses, see https://github.com/python/mypy/issues/13316 +pynput.keyboard.Controller._Key +pynput.keyboard._base.Controller._Key +pynput.keyboard._dummy.Controller._Key diff --git a/stubs/pynput/pynput/keyboard/_base.pyi b/stubs/pynput/pynput/keyboard/_base.pyi index 6c10ba3ce..d930c6654 100644 --- a/stubs/pynput/pynput/keyboard/_base.pyi +++ b/stubs/pynput/pynput/keyboard/_base.pyi @@ -86,8 +86,8 @@ class Key(enum.Enum): scroll_lock: int class Controller: - _KeyCode: ClassVar[KeyCode] # undocumented - _Key: ClassVar[Key] # undocumented + _KeyCode: ClassVar[type[KeyCode]] # undocumented + _Key: ClassVar[type[Key]] # undocumented class InvalidKeyException(Exception): ... class InvalidCharacterException(Exception): ...