keyboard : Update stubtest_allowlist and add comments for missing defaults (#9965)

This commit is contained in:
Avasam
2023-04-17 07:26:01 -04:00
committed by GitHub
parent f39ffea00f
commit fd188fa67e
4 changed files with 9 additions and 3 deletions

View File

@@ -1,7 +1,5 @@
# scan_code *should* never be None in real use. This is also according to docs.
keyboard.KeyboardEvent.scan_code
keyboard._keyboard_event.KeyboardEvent.scan_code
# Defaults don't align with possible values
keyboard.mouse.wait
# TODO: Should this be allowlisted?
keyboard.__main__

View File

@@ -1,2 +1,3 @@
# Defaults don't align with possible values
keyboard.mouse.on_button
keyboard.mouse.wait

View File

@@ -1,2 +1,3 @@
# Defaults don't align with possible values
keyboard.mouse.on_button
keyboard.mouse.wait

View File

@@ -47,14 +47,20 @@ def drag(start_x: int, start_y: int, end_x: int, end_y: int, absolute: bool = Tr
def on_button(
callback: Callable[..., None],
args: _Ts = (),
# Omitting default: Darwin has no x and x2
buttons: list[_MouseButton] | tuple[_MouseButton, ...] | _MouseButton = ...,
# Omitting default: Darwin and Linux don't have "double", yet the defaults includes it
types: list[_MouseEventType] | tuple[_MouseEventType, ...] | _MouseEventType = ...,
) -> _Callback: ...
def on_click(callback: Callable[..., None], args: _Ts = ()) -> _Callback: ...
def on_double_click(callback: Callable[..., None], args: _Ts = ()) -> _Callback: ...
def on_right_click(callback: Callable[..., None], args: _Ts = ()) -> _Callback: ...
def on_middle_click(callback: Callable[..., None], args: _Ts = ()) -> _Callback: ...
def wait(button: _MouseButton = "left", target_types: tuple[_MouseEventType] = ...) -> None: ...
def wait(
button: _MouseButton = "left",
# Omitting default: Darwin and Linux don't have "double", yet the defaults includes it
target_types: tuple[_MouseEventType, ...] = ...,
) -> None: ...
if sys.platform == "win32":
def get_position() -> tuple[c_long, c_long]: ...