11import contextlib
2- from _typeshed import Incomplete
3- from collections .abc import Callable , Generator , Iterable , Sequence
2+ from collections .abc import Callable , Iterable , Sequence
43from datetime import datetime
5- from typing import NamedTuple , SupportsFloat , SupportsInt , TypeVar , overload
4+ from typing import NamedTuple , SupportsInt , TypeVar
65from typing_extensions import ParamSpec , SupportsIndex , TypeAlias
76
8- from PIL import Image
7+ from pyscreeze import (
8+ locate as locate ,
9+ locateAll as locateAll ,
10+ locateAllOnScreen as locateAllOnScreen ,
11+ locateCenterOnScreen as locateCenterOnScreen ,
12+ locateOnScreen as locateOnScreen ,
13+ locateOnWindow as locateOnWindow ,
14+ )
915
1016class PyAutoGUIException (Exception ): ...
1117class FailSafeException (PyAutoGUIException ): ...
@@ -14,164 +20,8 @@ class ImageNotFoundException(PyAutoGUIException): ...
1420_P = ParamSpec ("_P" )
1521_R = TypeVar ("_R" )
1622_NormalizeableXArg : TypeAlias = str | SupportsInt | Sequence [SupportsInt ]
17- _Unused : TypeAlias = object
18-
19- # TODO: cv2.Mat is not available as a type yet: https://github.com/microsoft/python-type-stubs/issues/211
20- # cv2.Mat is just an alias for a numpy NDArray, but can't import that either.
21- _Mat : TypeAlias = Incomplete
22-
23- class _Box (NamedTuple ): # Same as pyscreeze.Box
24- left : int
25- top : int
26- width : int
27- height : int
2823
2924def raisePyAutoGUIImageNotFoundException (wrappedFunction : Callable [_P , _R ]) -> Callable [_P , _R ]: ...
30-
31- # These functions reuse pyscreeze functions directly.
32- # TODO: Once pyscreeze is typed, we can alias them to simplify this stub
33-
34- # _locateAll_opencv
35- @overload
36- def locate (
37- needleImage : str | Image .Image | _Mat ,
38- haystackImage : str | Image .Image | _Mat ,
39- grayscale : bool | None = ...,
40- limit : _Unused = ...,
41- region : _Box | None = ...,
42- step : int = ...,
43- confidence : SupportsFloat = ...,
44- ) -> _Box | None : ...
45-
46- # _locateAll_python / _locateAll_pillow
47- @overload
48- def locate (
49- needleImage : str | Image .Image ,
50- haystackImage : str | Image .Image ,
51- grayscale : bool | None = ...,
52- limit : _Unused = ...,
53- region : _Box | None = ...,
54- step : int = ...,
55- confidence : None = ...,
56- ) -> _Box | None : ...
57-
58- # _locateAll_opencv
59- @overload
60- def locateAll (
61- needleImage : str | Image .Image | _Mat ,
62- haystackImage : str | Image .Image | _Mat ,
63- grayscale : bool | None = ...,
64- limit : int = ...,
65- region : _Box | None = ...,
66- step : int = ...,
67- confidence : SupportsFloat = ...,
68- ) -> Generator [_Box , None , None ]: ...
69-
70- # _locateAll_python / _locateAll_pillow
71- @overload
72- def locateAll (
73- needleImage : str | Image .Image ,
74- haystackImage : str | Image .Image ,
75- grayscale : bool | None = ...,
76- limit : int | None = ...,
77- region : _Box | None = ...,
78- step : int = ...,
79- confidence : None = ...,
80- ) -> Generator [_Box , None , None ]: ...
81-
82- # _locateAll_opencv
83- @overload
84- def locateAllOnScreen (
85- image : str | Image .Image | _Mat ,
86- grayscale : bool | None = ...,
87- limit : int = ...,
88- region : _Box | None = ...,
89- step : int = ...,
90- confidence : SupportsFloat = ...,
91- ) -> Generator [_Box , None , None ]: ...
92-
93- # _locateAll_python / _locateAll_pillow
94- @overload
95- def locateAllOnScreen (
96- image : str | Image .Image ,
97- grayscale : bool | None = ...,
98- limit : int | None = ...,
99- region : _Box | None = ...,
100- step : int = ...,
101- confidence : None = ...,
102- ) -> Generator [_Box , None , None ]: ...
103-
104- # _locateAll_opencv
105- @overload
106- def locateCenterOnScreen (
107- image : str | Image .Image | _Mat ,
108- minSearchTime : float ,
109- grayscale : bool | None = ...,
110- limit : _Unused = ...,
111- region : _Box | None = ...,
112- step : int = ...,
113- confidence : SupportsFloat = ...,
114- ) -> Point | None : ...
115-
116- # _locateAll_python / _locateAll_pillow
117- @overload
118- def locateCenterOnScreen (
119- image : str | Image .Image ,
120- minSearchTime : float ,
121- grayscale : bool | None = ...,
122- limit : _Unused = ...,
123- region : _Box | None = ...,
124- step : int = ...,
125- confidence : None = ...,
126- ) -> Point | None : ...
127-
128- # _locateAll_opencv
129- @overload
130- def locateOnScreen (
131- image : str | Image .Image | _Mat ,
132- minSearchTime : float ,
133- grayscale : bool | None = ...,
134- limit : _Unused = ...,
135- region : _Box | None = ...,
136- step : int = ...,
137- confidence : SupportsFloat = ...,
138- ) -> _Box | None : ...
139-
140- # _locateAll_python / _locateAll_pillow
141- @overload
142- def locateOnScreen (
143- image : str | Image .Image ,
144- minSearchTime : float ,
145- grayscale : bool | None = ...,
146- limit : _Unused = ...,
147- region : _Box | None = ...,
148- step : int = ...,
149- confidence : None = ...,
150- ) -> _Box | None : ...
151-
152- # _locateAll_opencv
153- @overload
154- def locateOnWindow (
155- image : str | Image .Image | _Mat ,
156- title : str ,
157- grayscale : bool | None = ...,
158- limit : _Unused = ...,
159- step : int = ...,
160- confidence : SupportsFloat = ...,
161- ) -> _Box | None : ...
162-
163- # _locateAll_python / _locateAll_pillow
164- @overload
165- def locateOnWindow (
166- image : str | Image .Image ,
167- title : str ,
168- grayscale : bool | None = ...,
169- limit : _Unused = ...,
170- step : int = ...,
171- confidence : None = ...,
172- ) -> _Box | None : ...
173-
174- # end of reused pyscreeze functions
17525def mouseInfo () -> None : ...
17626def useImageNotFoundException (value : bool | None = ...) -> None : ...
17727
0 commit comments