From e44c14c43abfdcb70ba67baf9688a00602d6e543 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Sat, 10 Sep 2022 22:49:54 +0100 Subject: [PATCH 1/4] Remove some stubtest allowlist entries for `pynput` --- stubs/pynput/@tests/stubtest_allowlist.txt | 8 +------- stubs/pynput/pynput/keyboard/_base.pyi | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt index 410c9faa2eb5..fa00f4c1be44 100644 --- a/stubs/pynput/@tests/stubtest_allowlist.txt +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -1,9 +1,3 @@ -# 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__ diff --git a/stubs/pynput/pynput/keyboard/_base.pyi b/stubs/pynput/pynput/keyboard/_base.pyi index 6c10ba3ceb33..d930c6654b29 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): ... From b7784c1da776a363feac05647a10fc7d45746461 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sat, 10 Sep 2022 22:52:56 +0100 Subject: [PATCH 2/4] Add back allowlist entries --- stubs/pynput/@tests/stubtest_allowlist.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt index fa00f4c1be44..c13a8eeda1ce 100644 --- a/stubs/pynput/@tests/stubtest_allowlist.txt +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -1,3 +1,7 @@ # These __init__ methods have *args, **kwargs arguments on some platforms, but not others pynput.keyboard.Controller.__init__ -pynput.mouse.Controller.__init__ +# stubtest issues with non-`type` metaclasses, see https://github.com/python/mypy/issues/13316 +pynput.keyboard._base.Controller._Key +pynput.keyboard._base.Controller._KeyCode +pynput.keyboard._dummy.Controller._Key +pynput.keyboard._dummy.Controller._KeyCode From 842551128f5ab09fe1006c26170cc145de9dd2fb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sat, 10 Sep 2022 22:53:49 +0100 Subject: [PATCH 3/4] Update stubs/pynput/@tests/stubtest_allowlist.txt --- stubs/pynput/@tests/stubtest_allowlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt index c13a8eeda1ce..870c9d5071b1 100644 --- a/stubs/pynput/@tests/stubtest_allowlist.txt +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -1,5 +1,6 @@ # These __init__ methods have *args, **kwargs arguments on some platforms, but not others pynput.keyboard.Controller.__init__ +pynput.mouse.Controller.__init__ # stubtest issues with non-`type` metaclasses, see https://github.com/python/mypy/issues/13316 pynput.keyboard._base.Controller._Key pynput.keyboard._base.Controller._KeyCode From 7b036052b58dda629841f48e1a25a1c8c2d1bc9b Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sat, 10 Sep 2022 22:56:30 +0100 Subject: [PATCH 4/4] Aaah --- stubs/pynput/@tests/stubtest_allowlist.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stubs/pynput/@tests/stubtest_allowlist.txt b/stubs/pynput/@tests/stubtest_allowlist.txt index 870c9d5071b1..b7f3db650225 100644 --- a/stubs/pynput/@tests/stubtest_allowlist.txt +++ b/stubs/pynput/@tests/stubtest_allowlist.txt @@ -2,7 +2,6 @@ pynput.keyboard.Controller.__init__ 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._base.Controller._KeyCode pynput.keyboard._dummy.Controller._Key -pynput.keyboard._dummy.Controller._KeyCode