mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 12:21:27 +08:00
Add defaults for params and constants in PyAutoGUI (#9639)
This commit is contained in:
@@ -2,7 +2,7 @@ import contextlib
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from datetime import datetime
|
||||
from typing import NamedTuple, SupportsInt, TypeVar
|
||||
from typing_extensions import ParamSpec, SupportsIndex, TypeAlias
|
||||
from typing_extensions import Final, ParamSpec, SupportsIndex, TypeAlias
|
||||
|
||||
from pyscreeze import (
|
||||
center as center,
|
||||
@@ -18,39 +18,43 @@ from pyscreeze import (
|
||||
screenshot as screenshot,
|
||||
)
|
||||
|
||||
class PyAutoGUIException(Exception): ...
|
||||
class FailSafeException(PyAutoGUIException): ...
|
||||
class ImageNotFoundException(PyAutoGUIException): ...
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
_NormalizeableXArg: TypeAlias = str | SupportsInt | Sequence[SupportsInt]
|
||||
|
||||
def raisePyAutoGUIImageNotFoundException(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
|
||||
def mouseInfo() -> None: ...
|
||||
def useImageNotFoundException(value: bool | None = ...) -> None: ...
|
||||
|
||||
# Constants
|
||||
KEY_NAMES: list[str]
|
||||
KEYBOARD_KEYS: list[str]
|
||||
LEFT: str
|
||||
MIDDLE: str
|
||||
RIGHT: str
|
||||
PRIMARY: str
|
||||
SECONDARY: str
|
||||
QWERTY: str
|
||||
QWERTZ: str
|
||||
LEFT: Final = "left"
|
||||
MIDDLE: Final = "middle"
|
||||
RIGHT: Final = "right"
|
||||
PRIMARY: Final = "primary"
|
||||
SECONDARY: Final = "secondary"
|
||||
G_LOG_SCREENSHOTS_FILENAMES: list[str]
|
||||
# Implementation details
|
||||
QWERTY: Final[str]
|
||||
QWERTZ: Final[str]
|
||||
MINIMUM_SLEEP: Final[float]
|
||||
|
||||
def isShiftCharacter(character: str) -> bool: ...
|
||||
|
||||
MINIMUM_DURATION: float
|
||||
MINIMUM_SLEEP: float
|
||||
# These are meant to be overridable
|
||||
LOG_SCREENSHOTS: bool
|
||||
LOG_SCREENSHOTS_LIMIT: int | None
|
||||
# https://pyautogui.readthedocs.io/en/latest/index.html#fail-safes
|
||||
FAILSAFE: bool
|
||||
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]
|
||||
# https://pyautogui.readthedocs.io/en/latest/mouse.htmln#mouse-movement
|
||||
MINIMUM_DURATION: float
|
||||
|
||||
class PyAutoGUIException(Exception): ...
|
||||
class FailSafeException(PyAutoGUIException): ...
|
||||
class ImageNotFoundException(PyAutoGUIException): ...
|
||||
|
||||
def raisePyAutoGUIImageNotFoundException(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
|
||||
def mouseInfo() -> None: ...
|
||||
def useImageNotFoundException(value: bool | None = None) -> None: ...
|
||||
def isShiftCharacter(character: str) -> bool: ...
|
||||
|
||||
class Point(NamedTuple):
|
||||
x: float
|
||||
@@ -62,179 +66,179 @@ class Size(NamedTuple):
|
||||
|
||||
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 position(x: int | None = None, y: int | None = None) -> Point: ...
|
||||
def size() -> Size: ...
|
||||
def onScreen(x: _NormalizeableXArg | None, y: SupportsInt | None = ...) -> bool: ...
|
||||
def onScreen(x: _NormalizeableXArg | None, y: SupportsInt | None = None) -> bool: ...
|
||||
def mouseDown(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()`
|
||||
button: str = ...,
|
||||
duration: float = ...,
|
||||
button: str = "primary",
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def mouseUp(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()`
|
||||
button: str = ...,
|
||||
duration: float = ...,
|
||||
button: str = "primary",
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def click(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
clicks: SupportsIndex = ...,
|
||||
interval: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
clicks: SupportsIndex = 1,
|
||||
interval: float = 0.0,
|
||||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()`
|
||||
button: str = ...,
|
||||
duration: float = ...,
|
||||
button: str = "primary",
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def leftClick(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
interval: float = ...,
|
||||
duration: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
interval: float = 0.0,
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def rightClick(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
interval: float = ...,
|
||||
duration: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
interval: float = 0.0,
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def middleClick(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
interval: float = ...,
|
||||
duration: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
interval: float = 0.0,
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def doubleClick(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
interval: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
interval: float = 0.0,
|
||||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()`
|
||||
button: str = ...,
|
||||
duration: float = ...,
|
||||
button: str = "left",
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def tripleClick(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
interval: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
interval: float = 0.0,
|
||||
# Docstring says `button` can also be `int`, but `.lower()` is called unconditionally in `_normalizeButton()`
|
||||
button: str = ...,
|
||||
duration: float = ...,
|
||||
button: str = "left",
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def scroll(
|
||||
clicks: float,
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def hscroll(
|
||||
clicks: float,
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def vscroll(
|
||||
clicks: float,
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def moveTo(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
duration: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool = False,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def moveRel(
|
||||
xOffset: _NormalizeableXArg | None = ...,
|
||||
yOffset: SupportsInt | None = ...,
|
||||
duration: float = ...,
|
||||
xOffset: _NormalizeableXArg | None = None,
|
||||
yOffset: SupportsInt | None = None,
|
||||
duration: float = 0.0,
|
||||
tween: Callable[[float], float] = ...,
|
||||
logScreenshot: bool = ...,
|
||||
_pause: bool = ...,
|
||||
logScreenshot: bool = False,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
|
||||
move = moveRel
|
||||
|
||||
def dragTo(
|
||||
x: _NormalizeableXArg | None = ...,
|
||||
y: SupportsInt | None = ...,
|
||||
duration: float = ...,
|
||||
x: _NormalizeableXArg | None = None,
|
||||
y: SupportsInt | None = None,
|
||||
duration: float = 0.0,
|
||||
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 = ...,
|
||||
button: str = "primary",
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
mouseDownUp: bool = True,
|
||||
) -> None: ...
|
||||
def dragRel(
|
||||
xOffset: _NormalizeableXArg | None = ...,
|
||||
yOffset: SupportsInt | None = ...,
|
||||
duration: float = ...,
|
||||
xOffset: _NormalizeableXArg | None = 0,
|
||||
yOffset: SupportsInt | None = 0,
|
||||
duration: float = 0.0,
|
||||
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 = ...,
|
||||
button: str = "primary",
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
mouseDownUp: bool = True,
|
||||
) -> 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 keyDown(key: str, logScreenshot: bool | None = None, _pause: bool = True) -> None: ...
|
||||
def keyUp(key: str, logScreenshot: bool | None = None, _pause: bool = True) -> None: ...
|
||||
def press(
|
||||
keys: str | Iterable[str],
|
||||
presses: SupportsIndex = ...,
|
||||
interval: float = ...,
|
||||
logScreenshot: bool | None = ...,
|
||||
_pause: bool = ...,
|
||||
presses: SupportsIndex = 1,
|
||||
interval: float = 0.0,
|
||||
logScreenshot: bool | None = None,
|
||||
_pause: bool = True,
|
||||
) -> None: ...
|
||||
def hold(
|
||||
keys: str | Iterable[str], logScreenshot: bool | None = ..., _pause: bool = ...
|
||||
keys: str | Iterable[str], logScreenshot: bool | None = None, _pause: bool = True
|
||||
) -> contextlib._GeneratorContextManager[None]: ...
|
||||
def typewrite(
|
||||
message: str | Sequence[str], interval: float = ..., logScreenshot: bool | None = ..., _pause: bool = ...
|
||||
message: str | Sequence[str], interval: float = 0.0, logScreenshot: bool | None = None, _pause: bool = True
|
||||
) -> None: ...
|
||||
|
||||
write = typewrite
|
||||
|
||||
def hotkey(*args: str, logScreenshot: bool | None = ..., interval: float = ...) -> None: ...
|
||||
def hotkey(*args: str, logScreenshot: bool | None = None, interval: float = 0.0) -> None: ...
|
||||
def failSafeCheck() -> None: ...
|
||||
def displayMousePosition(xOffset: float = ..., yOffset: float = ...) -> None: ...
|
||||
def displayMousePosition(xOffset: float = 0, yOffset: float = 0) -> None: ...
|
||||
def sleep(seconds: float) -> None: ...
|
||||
def countdown(seconds: SupportsIndex) -> None: ...
|
||||
def run(commandStr: str, _ssCount: Sequence[int] | None = ...) -> None: ...
|
||||
def printInfo(dontPrint: bool = ...) -> str: ...
|
||||
def run(commandStr: str, _ssCount: Sequence[int] | None = None) -> None: ...
|
||||
def printInfo(dontPrint: bool = False) -> str: ...
|
||||
def getInfo() -> tuple[str, str, str, str, Size, datetime]: ...
|
||||
|
||||
Reference in New Issue
Block a user