-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added pyautogui stubs #8654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Added pyautogui stubs #8654
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
808249e
Added pyautogui stubs
Avasam 54b67a2
Added stubtest_allowlist.txt
Avasam 8a0e10e
Completed ctypes.Structure classes
Avasam 498e837
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] df1f303
Unused allowlist
Avasam 4088555
Merge branch 'pyautogui' of https://github.com/Avasam/typeshed into p…
Avasam 63fd405
ctypes.wintypes.PULONG
Avasam ebf4071
PR comments
Avasam 033af67
Remove private stubs
Avasam 677bb85
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 354da3a
typewrite and run check for length
Avasam 64ced77
Merge branch 'pyautogui' of https://github.com/Avasam/typeshed into p…
Avasam 69c05a7
unused allowlist
Avasam 6bd00d0
Merge branch 'pyautogui' of https://github.com/Avasam/typeshed into p…
Avasam 94711a0
Fix signature of `hold()`
AlexWaygood 303b474
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# pyautogui requires a display, resulting in the following error on the CI: | ||
# failed to import, KeyError: 'DISPLAY' | ||
pyautogui |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version = "0.9.*" | ||
|
||
[tool.stubtest] | ||
ignore_missing_stub = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
import contextlib | ||
from collections.abc import Callable, Generator, Iterable, Sequence | ||
from datetime import datetime | ||
from typing import NamedTuple, TypeVar, overload | ||
from typing_extensions import ParamSpec | ||
|
||
# from pyscreeze import Box | ||
|
||
class PyAutoGUIException(Exception): ... | ||
class FailSafeException(PyAutoGUIException): ... | ||
class ImageNotFoundException(PyAutoGUIException): ... | ||
|
||
_P = ParamSpec("_P") | ||
_R = TypeVar("_R") | ||
|
||
# TODO: Complete types with pyscreeze once we can import it as a type dependency | ||
# Actually `pyscreeze.Box`, but typeshed doesn't currently have stubs for pyscreeze | ||
# (and the library doesn't have type annotations either) | ||
|
||
class _Box(NamedTuple): | ||
AlexWaygood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
left: int | ||
top: int | ||
width: int | ||
height: int | ||
|
||
def raisePyAutoGUIImageNotFoundException(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ... | ||
|
||
# These functions reuse pyscreeze functions directly. See above TODO. | ||
def locate(*args, **kwargs) -> _Box | None: ... | ||
def locateAll(*args, **kwargs) -> Generator[_Box, None, None]: ... | ||
def locateAllOnScreen(*args, **kwargs) -> Generator[_Box, None, None]: ... | ||
def locateCenterOnScreen(*args, **kwargs) -> Point | None: ... | ||
def locateOnScreen(*args, **kwargs) -> _Box | None: ... | ||
def locateOnWindow(*args, **kwargs) -> _Box | None: ... | ||
def mouseInfo() -> None: ... | ||
def useImageNotFoundException(value: bool | None = ...) -> None: ... | ||
|
||
KEY_NAMES: list[str] | ||
KEYBOARD_KEYS: list[str] | ||
LEFT: str | ||
MIDDLE: str | ||
RIGHT: str | ||
PRIMARY: str | ||
SECONDARY: str | ||
QWERTY: str | ||
QWERTZ: str | ||
|
||
def isShiftCharacter(character: str) -> bool: ... | ||
|
||
MINIMUM_DURATION: float | ||
MINIMUM_SLEEP: float | ||
PAUSE: float | ||
DARWIN_CATCH_UP_TIME: float | ||
FAILSAFE: bool | ||
FAILSAFE_POINTS: list[tuple[int, int]] | ||
LOG_SCREENSHOTS: bool | ||
LOG_SCREENSHOTS_LIMIT: int | ||
G_LOG_SCREENSHOTS_FILENAMES: list[str] | ||
|
||
class Point(NamedTuple): | ||
x: float | ||
y: float | ||
|
||
class Size(NamedTuple): | ||
width: int | ||
height: int | ||
|
||
def getPointOnLine(x1: float, y1: float, x2: float, y2: float, n: float) -> tuple[float, float]: ... | ||
def linear(n: float) -> float: ... | ||
def position(x: int | None = ..., y: int | None = ...) -> Point: ... | ||
def size() -> Size: ... | ||
@overload | ||
def onScreen(x: tuple[float, float], y: None = ...) -> bool: ... | ||
@overload | ||
def onScreen(x: float, y: float) -> bool: ... | ||
def mouseDown( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
AlexWaygood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def mouseUp( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def click( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
clicks: int = ..., | ||
interval: float = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def leftClick( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
interval: float = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def rightClick( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
interval: float = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def middleClick( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
interval: float = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def doubleClick( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
interval: float = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def tripleClick( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
interval: float = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def scroll( | ||
clicks: float, | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def hscroll( | ||
clicks: float, | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def vscroll( | ||
clicks: float, | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def moveTo( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
def moveRel( | ||
xOffset: float | Sequence[float] | str | None = ..., | ||
yOffset: float | None = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
logScreenshot: bool = ..., | ||
_pause: bool = ..., | ||
) -> None: ... | ||
|
||
move = moveRel | ||
|
||
def dragTo( | ||
x: float | Sequence[float] | str | None = ..., | ||
y: float | None = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
mouseDownUp: bool = ..., | ||
) -> None: ... | ||
def dragRel( | ||
xOffset: float | Sequence[float] | str = ..., | ||
yOffset: float = ..., | ||
duration: float = ..., | ||
tween: Callable[[float], float] = ..., | ||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()` | ||
button: str = ..., | ||
logScreenshot: bool | None = ..., | ||
_pause: bool = ..., | ||
mouseDownUp: bool = ..., | ||
) -> None: ... | ||
|
||
drag = dragRel | ||
|
||
def isValidKey(key: str) -> bool: ... | ||
def keyDown(key: str, logScreenshot: bool | None = ..., _pause: bool = ...) -> None: ... | ||
def keyUp(key: str, logScreenshot: bool | None = ..., _pause: bool = ...) -> None: ... | ||
def press( | ||
keys: str | Iterable[str], presses: int = ..., interval: float = ..., logScreenshot: bool | None = ..., _pause: bool = ... | ||
) -> None: ... | ||
def hold( | ||
keys: str | Iterable[str], logScreenshot: bool | None = ..., _pause: bool = ... | ||
) -> contextlib._GeneratorContextManager[None]: ... | ||
def typewrite( | ||
message: str | Sequence[str], interval: float = ..., logScreenshot: bool | None = ..., _pause: bool = ... | ||
) -> None: ... | ||
|
||
write = typewrite | ||
|
||
def hotkey(*args: str, logScreenshot: bool | None = ..., interval: float = ...) -> None: ... | ||
def failSafeCheck() -> None: ... | ||
def displayMousePosition(xOffset: float = ..., yOffset: float = ...) -> None: ... | ||
def sleep(seconds: float) -> None: ... | ||
def countdown(seconds: int) -> None: ... | ||
def run(commandStr: str, _ssCount: Sequence[int] | None = ...) -> None: ... | ||
def printInfo(dontPrint: bool = ...) -> str: ... | ||
def getInfo() -> tuple[str, str, str, str, Size, datetime]: ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.