MaaFw 2.2.2__py3-none-win_arm64.whl → 2.3.0__py3-none-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of MaaFw might be problematic. Click here for more details.
- {MaaFw-2.2.2.dist-info → MaaFw-2.3.0.dist-info}/METADATA +11 -6
- MaaFw-2.3.0.dist-info/RECORD +28 -0
- MaaFw-2.3.0.dist-info/WHEEL +4 -0
- maa/__init__.py +7 -5
- maa/bin/DirectML.dll +0 -0
- maa/bin/MaaAdbControlUnit.dll +0 -0
- maa/bin/MaaDbgControlUnit.dll +0 -0
- maa/bin/MaaFramework.dll +0 -0
- maa/bin/MaaToolkit.dll +0 -0
- maa/bin/MaaUtils.dll +0 -0
- maa/bin/MaaWin32ControlUnit.dll +0 -0
- maa/bin/fastdeploy_ppocr_maa.dll +0 -0
- maa/bin/onnxruntime_maa.dll +0 -0
- maa/bin/opencv_world4_maa.dll +0 -0
- maa/buffer.py +0 -22
- maa/controller.py +1 -6
- maa/define.py +34 -9
- maa/library.py +8 -32
- maa/resource.py +44 -15
- maa/tasker.py +6 -19
- maa/toolkit.py +0 -5
- MaaFw-2.2.2.dist-info/RECORD +0 -28
- MaaFw-2.2.2.dist-info/WHEEL +0 -4
- {MaaFw-2.2.2.dist-info → MaaFw-2.3.0.dist-info}/LICENSE.md +0 -0
- {MaaFw-2.2.2.dist-info → MaaFw-2.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MaaFw
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0
|
|
4
4
|
Summary: An automation black-box testing framework based on image recognition
|
|
5
5
|
Author: MaaXYZ
|
|
6
6
|
Project-URL: Homepage, https://github.com/MaaXYZ/MaaFramework
|
|
@@ -87,7 +87,7 @@ _✨ 基于图像识别的自动化黑盒测试框架 ✨_
|
|
|
87
87
|
- [maa-whmx](https://github.com/MAWHA/maa-whmx) 物华弥新 小助手  
|
|
88
88
|
基于全新架构的 物华弥新 小助手。图像技术 + 模拟控制,解放双手!由 MaaFramework 强力驱动!
|
|
89
89
|
|
|
90
|
-
- [MAA-for-Millennium-Tour](https://github.com/Ostwind23/MAA-for-Millennium-Tour) 千年之旅 小助手  
|
|
90
|
+
- [MAA-for-Millennium-Tour](https://github.com/Ostwind23/MAA-for-Millennium-Tour) 千年之旅 小助手  
|
|
91
91
|
基于全新架构的 千年之旅 小助手。图像技术 + 模拟控制,解放侍主的大手!由 MaaFramework 强力驱动!
|
|
92
92
|
|
|
93
93
|
- [MFAWPF](https://github.com/SweetSmellFox/MFAWPF) MFA 任务管理器 
|
|
@@ -104,7 +104,13 @@ _✨ 基于图像识别的自动化黑盒测试框架 ✨_
|
|
|
104
104
|
|
|
105
105
|
- [MPA](https://github.com/overflow65537/MAA_Punish) 战双 小助手 
|
|
106
106
|
基于全新架构的 战双帕弥什 小助手。图像技术 + 模拟控制,解放双手!由 玛丽的黑咖啡 2.0 强力驱动!
|
|
107
|
-
|
|
107
|
+
|
|
108
|
+
- [MaaYuan](https://github.com/syoius/MaaYuan) 代号鸢/如鸢 一键长草小助手 
|
|
109
|
+
基于全新架构的 代号鸢/如鸢 小助手。图像技术 + 模拟控制,解放双手!由 MaaFramework 强力驱动!
|
|
110
|
+
|
|
111
|
+
- [MFW-ELE-GUI](https://github.com/Night-stars-1/maa-gui) MFW-ELE-GUI  
|
|
112
|
+
基于全新架构的 MFW-ELE-GUI。由 MaaFramework 强力驱动!
|
|
113
|
+
|
|
108
114
|
## 生态共建
|
|
109
115
|
|
|
110
116
|
MAA 正计划建设为一类项目,而非舟的单一软件。
|
|
@@ -159,9 +165,7 @@ _请留意,仅当您准备开发 MaaFramework 本身时,才需要阅读本
|
|
|
159
165
|
|
|
160
166
|
感谢以下开发者对 MaaFramework 作出的贡献:
|
|
161
167
|
|
|
162
|
-
|
|
163
|
-
<img src="https://contrib.rocks/image?repo=MaaXYZ/MaaFramework&max=1000" />
|
|
164
|
-
</a>
|
|
168
|
+
[](https://github.com/MaaXYZ/MaaFramework/graphs/contributors)
|
|
165
169
|
|
|
166
170
|
## 讨论
|
|
167
171
|
|
|
@@ -169,6 +173,7 @@ _请留意,仅当您准备开发 MaaFramework 本身时,才需要阅读本
|
|
|
169
173
|
|
|
170
174
|
## 赞助
|
|
171
175
|
|
|
176
|
+
<!-- markdownlint-disable MD045 -->
|
|
172
177
|
<a href="https://afdian.com/a/misteo">
|
|
173
178
|
<img width="200" src="https://pic1.afdiancdn.com/static/img/welcome/button-sponsorme.png">
|
|
174
179
|
</a>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
maa/__init__.py,sha256=JkhLdjqr1X69SYY2O3qoPhdYImQC_91XS5_eY1vbtEo,230
|
|
2
|
+
maa/buffer.py,sha256=JLxAF8esnAN4SlkZf2OMMlpv0SV3WK7OyMF8w7sTaC8,16617
|
|
3
|
+
maa/context.py,sha256=Y71T92tIAGq6x8bJfYX8emUPEmPUA7nhnWgqOHh390E,5722
|
|
4
|
+
maa/controller.py,sha256=61R4asxDLChiZBSD1hEdGdbpoyOxHttOeflNuJ7DmqM,22381
|
|
5
|
+
maa/custom_action.py,sha256=pqPjDK7nVkGL8fceJadwb7IkeGjYc2X8RaXZOnVZXQs,2527
|
|
6
|
+
maa/custom_recognition.py,sha256=Y3Asdgb19YZioOVZZVs_hLSW6uBg7WDZDQPR2XfZpFU,3087
|
|
7
|
+
maa/define.py,sha256=uvqM04p6NLfju1Zz-EMR-8Af8MZGpEImMAt3QdcYvIA,13114
|
|
8
|
+
maa/job.py,sha256=jXGQ4YV_G8sAi-B7OmUrbPCEIf4xZjWqCSr36LT6Qt0,1153
|
|
9
|
+
maa/library.py,sha256=AwdFx_zWHEah81NwOmD-SDzysSuVbsreDLIaxpWsXvY,1267
|
|
10
|
+
maa/notification_handler.py,sha256=KjQlu66fNVwGGli8kuhNdSZPj2vO_oXjaNt_B1i_5wA,5251
|
|
11
|
+
maa/resource.py,sha256=TAULVwajpPThbLreB0JbhMWTv82r8Y3fFLM2b2VC91Y,9349
|
|
12
|
+
maa/tasker.py,sha256=tYD-YvqRPwMzt-h8UToJ01CsN4mO2mJHEnjsj5tTkSU,14425
|
|
13
|
+
maa/toolkit.py,sha256=BE_o8XgznuW1d_7YairYHOrqOp5Ha9GYMcinsYYBgVM,11163
|
|
14
|
+
maa/bin/DirectML.dll,sha256=d7Dbg_-QPyMj9cr1OEmdda9gOLvqI7eVn30jLZpKudQ,18444832
|
|
15
|
+
maa/bin/MaaAdbControlUnit.dll,sha256=K-7s92J0j-t0XbBKbbp8mBntCsRIyx8dJ0l_By0MX3c,854528
|
|
16
|
+
maa/bin/MaaDbgControlUnit.dll,sha256=bsbzxH9p3YtXaCTHZIrUsV13eMEALwGzlTAZndq69sM,396800
|
|
17
|
+
maa/bin/MaaFramework.dll,sha256=1uzGgXUDYFKm7nCGtDyo8wwjLL5FsqrGeKSZbnrgVbE,1726976
|
|
18
|
+
maa/bin/MaaToolkit.dll,sha256=g9wn4zZpBIz4mGhpoIWB-4m-9PHMpTTswTRFqGkAjeY,710656
|
|
19
|
+
maa/bin/MaaUtils.dll,sha256=N4TYu_ryTgwhm7HY6rnez-rY-wzPfzsKq21lFpMOIzg,572416
|
|
20
|
+
maa/bin/MaaWin32ControlUnit.dll,sha256=NMMjBcwO3F11zE8A0ZvARkBB90aB23hDoIigabHoank,352768
|
|
21
|
+
maa/bin/fastdeploy_ppocr_maa.dll,sha256=lidtCQOzeYsOBcEJzcuhynypH1fkibZa-uBlcO0hx6g,1097728
|
|
22
|
+
maa/bin/onnxruntime_maa.dll,sha256=76uDwY3lectM4kzFxzK8qKL9cOsUrV5QsuNgh8Q74jo,19155456
|
|
23
|
+
maa/bin/opencv_world4_maa.dll,sha256=zmZOpjQHQ4y24pbPJvQjQcfMM5paGKzkYf1GB3TWTj0,15078400
|
|
24
|
+
MaaFw-2.3.0.dist-info/LICENSE.md,sha256=RG51X65V_wNLuyG-RGcLXxFsKyZnlH5wNvK_5mMlOag,7560
|
|
25
|
+
MaaFw-2.3.0.dist-info/METADATA,sha256=YmMDFPFPV3HXlxHGp3sXtS990kjVpGLcFjMJ2c5Orag,11039
|
|
26
|
+
MaaFw-2.3.0.dist-info/WHEEL,sha256=PhpqtLE2cPvexGD-EPObNI73ls8xo2gX9HjYnFs2vUQ,95
|
|
27
|
+
MaaFw-2.3.0.dist-info/top_level.txt,sha256=G8r2L__aYaMq4S3R70G6NsfEROiVp08kUcWvATzk2J8,4
|
|
28
|
+
MaaFw-2.3.0.dist-info/RECORD,,
|
maa/__init__.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import os
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
|
|
3
4
|
from .library import Library
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
env_path = os.environ.get("MAAFW_BINARY_PATH")
|
|
7
|
+
if env_path:
|
|
8
|
+
__PATH = Path(env_path)
|
|
9
|
+
else:
|
|
10
|
+
__PATH = Path(Path(__file__).parent, "bin")
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
ver = Library.open(__PATH)
|
|
9
|
-
if ver:
|
|
10
|
-
print(f"MaaFw version: {ver}")
|
|
12
|
+
Library.open(__PATH)
|
maa/bin/DirectML.dll
CHANGED
|
Binary file
|
maa/bin/MaaAdbControlUnit.dll
CHANGED
|
Binary file
|
maa/bin/MaaDbgControlUnit.dll
CHANGED
|
Binary file
|
maa/bin/MaaFramework.dll
CHANGED
|
Binary file
|
maa/bin/MaaToolkit.dll
CHANGED
|
Binary file
|
maa/bin/MaaUtils.dll
CHANGED
|
Binary file
|
maa/bin/MaaWin32ControlUnit.dll
CHANGED
|
Binary file
|
maa/bin/fastdeploy_ppocr_maa.dll
CHANGED
|
Binary file
|
maa/bin/onnxruntime_maa.dll
CHANGED
|
Binary file
|
maa/bin/opencv_world4_maa.dll
CHANGED
|
Binary file
|
maa/buffer.py
CHANGED
|
@@ -13,10 +13,6 @@ class StringBuffer:
|
|
|
13
13
|
_own: bool
|
|
14
14
|
|
|
15
15
|
def __init__(self, handle: Optional[MaaStringBufferHandle] = None):
|
|
16
|
-
if not Library.initialized:
|
|
17
|
-
raise RuntimeError(
|
|
18
|
-
"Library not initialized, please call `library.open()` first."
|
|
19
|
-
)
|
|
20
16
|
self._set_api_properties()
|
|
21
17
|
|
|
22
18
|
if handle:
|
|
@@ -97,10 +93,6 @@ class StringListBuffer:
|
|
|
97
93
|
_own: bool
|
|
98
94
|
|
|
99
95
|
def __init__(self, handle: Optional[MaaStringListBufferHandle] = None):
|
|
100
|
-
if not Library.initialized:
|
|
101
|
-
raise RuntimeError(
|
|
102
|
-
"Library not initialized, please call `library.open()` first."
|
|
103
|
-
)
|
|
104
96
|
self._set_api_properties()
|
|
105
97
|
|
|
106
98
|
if handle:
|
|
@@ -203,11 +195,6 @@ class ImageBuffer:
|
|
|
203
195
|
_own: bool
|
|
204
196
|
|
|
205
197
|
def __init__(self, c_handle: Optional[MaaImageBufferHandle] = None):
|
|
206
|
-
if not Library.initialized:
|
|
207
|
-
raise RuntimeError(
|
|
208
|
-
"Library not initialized, please call `library.open()` first."
|
|
209
|
-
)
|
|
210
|
-
|
|
211
198
|
self._set_api_properties()
|
|
212
199
|
|
|
213
200
|
if c_handle:
|
|
@@ -309,10 +296,6 @@ class ImageListBuffer:
|
|
|
309
296
|
_own: bool
|
|
310
297
|
|
|
311
298
|
def __init__(self, c_handle: Optional[MaaImageListBufferHandle] = None):
|
|
312
|
-
if not Library.initialized:
|
|
313
|
-
raise RuntimeError(
|
|
314
|
-
"Library not initialized, please call `library.open()` first."
|
|
315
|
-
)
|
|
316
299
|
self._set_api_properties()
|
|
317
300
|
|
|
318
301
|
if c_handle:
|
|
@@ -413,11 +396,6 @@ class RectBuffer:
|
|
|
413
396
|
_own: bool
|
|
414
397
|
|
|
415
398
|
def __init__(self, c_handle: Optional[MaaRectHandle] = None):
|
|
416
|
-
if not Library.initialized:
|
|
417
|
-
raise RuntimeError(
|
|
418
|
-
"Library not initialized, please call `library.open()` first."
|
|
419
|
-
)
|
|
420
|
-
|
|
421
399
|
self._set_api_properties()
|
|
422
400
|
|
|
423
401
|
if c_handle:
|
maa/controller.py
CHANGED
|
@@ -28,11 +28,6 @@ class Controller:
|
|
|
28
28
|
self,
|
|
29
29
|
handle: Optional[MaaControllerHandle] = None,
|
|
30
30
|
):
|
|
31
|
-
if not Library.initialized:
|
|
32
|
-
raise RuntimeError(
|
|
33
|
-
"Library not initialized, please call `library.open()` first."
|
|
34
|
-
)
|
|
35
|
-
|
|
36
31
|
self._set_api_properties()
|
|
37
32
|
|
|
38
33
|
if handle:
|
|
@@ -152,7 +147,7 @@ class Controller:
|
|
|
152
147
|
ctypes.sizeof(ctypes.c_int32),
|
|
153
148
|
)
|
|
154
149
|
)
|
|
155
|
-
|
|
150
|
+
|
|
156
151
|
def set_screenshot_use_raw_size(self, enable: bool) -> bool:
|
|
157
152
|
cbool = MaaBool(enable)
|
|
158
153
|
return bool(
|
maa/define.py
CHANGED
|
@@ -110,15 +110,33 @@ class MaaCtrlOptionEnum:
|
|
|
110
110
|
Recording = 5
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
|
|
113
|
+
class MaaInferenceDeviceEnum:
|
|
114
|
+
CPU = -2
|
|
115
|
+
Auto = -1
|
|
116
|
+
# and more gpu id or flag...
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class MaaInferenceExecutionProviderEnum:
|
|
120
|
+
# I don't recommend setting up MaaResOption_InferenceDevice in this case,
|
|
121
|
+
# because you don't know which EP will be used on different user devices.
|
|
122
|
+
Auto = 0
|
|
123
|
+
|
|
124
|
+
# MaaResOption_InferenceDevice will not work.
|
|
125
|
+
CPU = 1
|
|
126
|
+
|
|
127
|
+
# MaaResOption_InferenceDevice will be used to set adapter id,
|
|
128
|
+
# It's from Win32 API `EnumAdapters1`.
|
|
129
|
+
DirectML = 2
|
|
130
|
+
|
|
131
|
+
# MaaResOption_InferenceDevice will be used to set coreml_flag,
|
|
132
|
+
# Reference to
|
|
133
|
+
# https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/providers/coreml/coreml_provider_factory.h
|
|
134
|
+
# But you need to pay attention to the onnxruntime version we use, the latest flag may not be supported.
|
|
135
|
+
CoreML = 3
|
|
136
|
+
|
|
137
|
+
# MaaResOption_InferenceDevice will be used to set NVIDIA GPU ID
|
|
138
|
+
# TODO!
|
|
139
|
+
CUDA = 4
|
|
122
140
|
|
|
123
141
|
|
|
124
142
|
class MaaResOptionEnum:
|
|
@@ -131,6 +149,13 @@ class MaaResOptionEnum:
|
|
|
131
149
|
# default value is MaaInferenceDevice_Auto
|
|
132
150
|
InferenceDevice = 1
|
|
133
151
|
|
|
152
|
+
# Use the specified inference execution provider
|
|
153
|
+
# Please set this option before loading the model.
|
|
154
|
+
#
|
|
155
|
+
# value: MaaInferenceExecutionProvider, eg: 0; val_size: sizeof(MaaInferenceExecutionProvider)
|
|
156
|
+
# default value is MaaInferenceExecutionProvider_Auto
|
|
157
|
+
InferenceExecutionProvider = 2
|
|
158
|
+
|
|
134
159
|
|
|
135
160
|
MaaAdbScreencapMethod = ctypes.c_uint64
|
|
136
161
|
|
maa/library.py
CHANGED
|
@@ -2,17 +2,17 @@ import ctypes
|
|
|
2
2
|
import ctypes.util
|
|
3
3
|
import pathlib
|
|
4
4
|
import platform
|
|
5
|
-
from typing import Optional, Union
|
|
6
5
|
|
|
7
6
|
from .define import *
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class Library:
|
|
11
10
|
|
|
12
|
-
initialized = False
|
|
13
|
-
|
|
14
11
|
@staticmethod
|
|
15
|
-
def open(path:
|
|
12
|
+
def open(path: pathlib.Path):
|
|
13
|
+
if not path.exists():
|
|
14
|
+
raise FileNotFoundError(f"`{path}` does not exist.")
|
|
15
|
+
|
|
16
16
|
platform_values = {
|
|
17
17
|
"windows": ("MaaFramework.dll", "MaaToolkit.dll"),
|
|
18
18
|
"darwin": ("libMaaFramework.dylib", "libMaaToolkit.dylib"),
|
|
@@ -26,40 +26,16 @@ class Library:
|
|
|
26
26
|
else:
|
|
27
27
|
lib_import = ctypes.CDLL
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
pathlib.Path(path) / platform_values[platform_type][0]
|
|
32
|
-
)
|
|
33
|
-
Library.framework = lib_import(str(Library.framework_libpath))
|
|
34
|
-
except OSError:
|
|
35
|
-
Library.framework_libpath = ctypes.util.find_library("MaaFramework")
|
|
36
|
-
Library.framework = lib_import(str(Library.framework_libpath))
|
|
37
|
-
|
|
38
|
-
try:
|
|
39
|
-
Library.toolkit_libpath = (
|
|
40
|
-
pathlib.Path(path) / platform_values[platform_type][1]
|
|
41
|
-
)
|
|
42
|
-
Library.toolkit = lib_import(str(Library.toolkit_libpath))
|
|
43
|
-
except OSError:
|
|
44
|
-
Library.toolkit_libpath = ctypes.util.find_library("MaaToolkit")
|
|
45
|
-
Library.toolkit = lib_import(str(Library.toolkit_libpath))
|
|
29
|
+
Library.framework_libpath = path / platform_values[platform_type][0]
|
|
30
|
+
Library.framework = lib_import(str(Library.framework_libpath))
|
|
46
31
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return None
|
|
32
|
+
Library.toolkit_libpath = path / platform_values[platform_type][1]
|
|
33
|
+
Library.toolkit = lib_import(str(Library.toolkit_libpath))
|
|
50
34
|
|
|
51
35
|
Library._set_api_properties()
|
|
52
|
-
Library.initialized = True
|
|
53
|
-
|
|
54
|
-
return Library.version()
|
|
55
36
|
|
|
56
37
|
@staticmethod
|
|
57
38
|
def version() -> str:
|
|
58
|
-
if not Library.initialized:
|
|
59
|
-
raise RuntimeError(
|
|
60
|
-
"Library not initialized, please call `library.open()` first."
|
|
61
|
-
)
|
|
62
|
-
|
|
63
39
|
return Library.framework.MaaVersion().decode()
|
|
64
40
|
|
|
65
41
|
@staticmethod
|
maa/resource.py
CHANGED
|
@@ -21,12 +21,6 @@ class Resource:
|
|
|
21
21
|
notification_handler: Optional[NotificationHandler] = None,
|
|
22
22
|
handle: Optional[MaaResourceHandle] = None,
|
|
23
23
|
):
|
|
24
|
-
|
|
25
|
-
if not Library.initialized:
|
|
26
|
-
raise RuntimeError(
|
|
27
|
-
"Library not initialized, please call `library.open()` first."
|
|
28
|
-
)
|
|
29
|
-
|
|
30
24
|
self._set_api_properties()
|
|
31
25
|
|
|
32
26
|
if handle:
|
|
@@ -60,18 +54,45 @@ class Resource:
|
|
|
60
54
|
def clear(self) -> bool:
|
|
61
55
|
return bool(Library.framework.MaaResourceClear(self._handle))
|
|
62
56
|
|
|
57
|
+
def use_cpu(self) -> bool:
|
|
58
|
+
return self.set_inference(
|
|
59
|
+
MaaInferenceExecutionProviderEnum.CPU, MaaInferenceDeviceEnum.CPU
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def use_directml(self, device_id: int = MaaInferenceDeviceEnum.Auto) -> bool:
|
|
63
|
+
return self.set_inference(MaaInferenceExecutionProviderEnum.DirectML, device_id)
|
|
64
|
+
|
|
65
|
+
def use_coreml(self, coreml_flag: int = MaaInferenceDeviceEnum.Auto) -> bool:
|
|
66
|
+
return self.set_inference(MaaInferenceExecutionProviderEnum.CoreML, coreml_flag)
|
|
67
|
+
|
|
68
|
+
def use_auto_ep(self) -> bool:
|
|
69
|
+
return self.set_inference(
|
|
70
|
+
MaaInferenceExecutionProviderEnum.Auto, MaaInferenceDeviceEnum.Auto
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# not implemented
|
|
74
|
+
# def use_cuda(self, nvidia_gpu_id: int) -> bool:
|
|
75
|
+
# return self.set_inference(MaaInferenceExecutionProviderEnum.CUDA, nvidia_gpu_id)
|
|
76
|
+
|
|
63
77
|
def set_gpu(self, gpu_id: int) -> bool:
|
|
78
|
+
"""
|
|
79
|
+
Deprecated, please use `use_directml`, `use_coreml` or `use_cuda` instead.
|
|
80
|
+
"""
|
|
64
81
|
if gpu_id < 0:
|
|
65
82
|
return False
|
|
66
|
-
return self.
|
|
83
|
+
return self.use_directml(gpu_id)
|
|
67
84
|
|
|
68
85
|
def set_cpu(self) -> bool:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
86
|
+
"""
|
|
87
|
+
Deprecated, please use `use_cpu` instead.
|
|
88
|
+
"""
|
|
89
|
+
return self.use_cpu()
|
|
90
|
+
|
|
72
91
|
def set_auto_device(self) -> bool:
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
"""
|
|
93
|
+
Deprecated, please use `use_auto_ep` instead.
|
|
94
|
+
"""
|
|
95
|
+
return self.use_auto_ep()
|
|
75
96
|
|
|
76
97
|
def register_custom_recognition(
|
|
77
98
|
self, name: str, recognition: "CustomRecognition" # type: ignore
|
|
@@ -149,13 +170,21 @@ class Resource:
|
|
|
149
170
|
|
|
150
171
|
### private ###
|
|
151
172
|
|
|
152
|
-
def
|
|
153
|
-
|
|
173
|
+
def set_inference(self, execution_provider: int, device_id: int) -> bool:
|
|
174
|
+
cep = ctypes.c_int32(execution_provider)
|
|
175
|
+
cdevice = ctypes.c_int32(device_id)
|
|
154
176
|
return bool(
|
|
177
|
+
Library.framework.MaaResourceSetOption(
|
|
178
|
+
self._handle,
|
|
179
|
+
MaaResOptionEnum.InferenceExecutionProvider,
|
|
180
|
+
ctypes.pointer(cep),
|
|
181
|
+
ctypes.sizeof(ctypes.c_int32),
|
|
182
|
+
)
|
|
183
|
+
) and bool(
|
|
155
184
|
Library.framework.MaaResourceSetOption(
|
|
156
185
|
self._handle,
|
|
157
186
|
MaaResOptionEnum.InferenceDevice,
|
|
158
|
-
ctypes.pointer(
|
|
187
|
+
ctypes.pointer(cdevice),
|
|
159
188
|
ctypes.sizeof(ctypes.c_int32),
|
|
160
189
|
)
|
|
161
190
|
)
|
maa/tasker.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ctypes
|
|
2
2
|
import json
|
|
3
|
-
import time
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
from typing import Any, Dict, Optional, Union
|
|
6
5
|
|
|
@@ -25,11 +24,6 @@ class Tasker:
|
|
|
25
24
|
notification_handler: Optional[NotificationHandler] = None,
|
|
26
25
|
handle: Optional[MaaTaskerHandle] = None,
|
|
27
26
|
):
|
|
28
|
-
if not Library.initialized:
|
|
29
|
-
raise RuntimeError(
|
|
30
|
-
"Library not initialized, please call `library.open()` first."
|
|
31
|
-
)
|
|
32
|
-
|
|
33
27
|
self._set_api_properties()
|
|
34
28
|
|
|
35
29
|
if handle:
|
|
@@ -92,8 +86,8 @@ class Tasker:
|
|
|
92
86
|
return bool(Library.framework.MaaTaskerRunning(self._handle))
|
|
93
87
|
|
|
94
88
|
def post_stop(self) -> Job:
|
|
95
|
-
Library.framework.MaaTaskerPostStop(self._handle)
|
|
96
|
-
return
|
|
89
|
+
taskid = Library.framework.MaaTaskerPostStop(self._handle)
|
|
90
|
+
return self._gen_task_job(taskid)
|
|
97
91
|
|
|
98
92
|
def get_latest_node(self, name: str) -> Optional[NodeDetail]:
|
|
99
93
|
c_node_id = MaaNodeId()
|
|
@@ -201,15 +195,6 @@ class Tasker:
|
|
|
201
195
|
def _task_wait(self, id: int) -> ctypes.c_int32:
|
|
202
196
|
return Library.framework.MaaTaskerWait(self._handle, id)
|
|
203
197
|
|
|
204
|
-
def _stop_status(self, id: int) -> MaaStatusEnum:
|
|
205
|
-
return MaaStatusEnum.succeeded if not self.running else MaaStatusEnum.running
|
|
206
|
-
|
|
207
|
-
def _stop_wait(self, id: int) -> MaaStatusEnum:
|
|
208
|
-
# TODO: 这个应该由 callback 来处理
|
|
209
|
-
while self.running:
|
|
210
|
-
time.sleep(0.1)
|
|
211
|
-
return MaaStatusEnum.succeeded
|
|
212
|
-
|
|
213
198
|
def get_recognition_detail(self, reco_id: int) -> Optional[RecognitionDetail]:
|
|
214
199
|
name = StringBuffer()
|
|
215
200
|
algorithm = StringBuffer()
|
|
@@ -316,7 +301,9 @@ class Tasker:
|
|
|
316
301
|
detail = self.get_node_detail(int(c_node_id_list[i]))
|
|
317
302
|
nodes.append(detail)
|
|
318
303
|
|
|
319
|
-
return TaskDetail(
|
|
304
|
+
return TaskDetail(
|
|
305
|
+
task_id=task_id, entry=entry.get(), nodes=nodes, status=Status(status)
|
|
306
|
+
)
|
|
320
307
|
|
|
321
308
|
_api_properties_initialized: bool = False
|
|
322
309
|
|
|
@@ -398,7 +385,7 @@ class Tasker:
|
|
|
398
385
|
Library.framework.MaaTaskerRunning.restype = MaaBool
|
|
399
386
|
Library.framework.MaaTaskerRunning.argtypes = [MaaTaskerHandle]
|
|
400
387
|
|
|
401
|
-
Library.framework.MaaTaskerPostStop.restype =
|
|
388
|
+
Library.framework.MaaTaskerPostStop.restype = MaaTaskId
|
|
402
389
|
Library.framework.MaaTaskerPostStop.argtypes = [MaaTaskerHandle]
|
|
403
390
|
|
|
404
391
|
Library.framework.MaaTaskerGetResource.restype = MaaResourceHandle
|
maa/toolkit.py
CHANGED
|
@@ -189,11 +189,6 @@ class Toolkit:
|
|
|
189
189
|
return
|
|
190
190
|
Toolkit._api_properties_initialized = True
|
|
191
191
|
|
|
192
|
-
if not Library.initialized:
|
|
193
|
-
raise RuntimeError(
|
|
194
|
-
"Library not initialized, please call `library.open()` first."
|
|
195
|
-
)
|
|
196
|
-
|
|
197
192
|
Library.toolkit.MaaToolkitConfigInitOption.restype = MaaBool
|
|
198
193
|
Library.toolkit.MaaToolkitConfigInitOption.argtypes = [
|
|
199
194
|
ctypes.c_char_p,
|
MaaFw-2.2.2.dist-info/RECORD
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
maa/__init__.py,sha256=rBIC5X_VsfFXOMJRdKjgDyO428XHgeWAT3t6ZYmqO1M,207
|
|
2
|
-
maa/buffer.py,sha256=E0tuasXPm6A_4r22PGSwObgGXb2qCMJrT5yrAvcgk6I,17424
|
|
3
|
-
maa/context.py,sha256=Y71T92tIAGq6x8bJfYX8emUPEmPUA7nhnWgqOHh390E,5722
|
|
4
|
-
maa/controller.py,sha256=VOz4Und15toq6oehHR0BHC10LMhFVqKAcImQNXCqHxQ,22547
|
|
5
|
-
maa/custom_action.py,sha256=pqPjDK7nVkGL8fceJadwb7IkeGjYc2X8RaXZOnVZXQs,2527
|
|
6
|
-
maa/custom_recognition.py,sha256=Y3Asdgb19YZioOVZZVs_hLSW6uBg7WDZDQPR2XfZpFU,3087
|
|
7
|
-
maa/define.py,sha256=klaIWvNS5DDgKo6EC330EqqWlKQ4JLCOHZ8d7Ifaoqo,12126
|
|
8
|
-
maa/job.py,sha256=jXGQ4YV_G8sAi-B7OmUrbPCEIf4xZjWqCSr36LT6Qt0,1153
|
|
9
|
-
maa/library.py,sha256=nDTBUFC6_91gmyy8SfkTTccMZET9XGU8IxvuVUEwQ6E,2099
|
|
10
|
-
maa/notification_handler.py,sha256=KjQlu66fNVwGGli8kuhNdSZPj2vO_oXjaNt_B1i_5wA,5251
|
|
11
|
-
maa/resource.py,sha256=bvS02sCCS9DRw_zJZeyCk8_DrZry6KBlUIvcfpKoUIg,8243
|
|
12
|
-
maa/tasker.py,sha256=0hALFCHKHuOBQMSqyG4BYi1idJLy64UZMpqL4GQVZKs,14929
|
|
13
|
-
maa/toolkit.py,sha256=TlF8MoaGcWLklpISIlQNvc_rpTFBFrpDbLgctfQ_zqo,11325
|
|
14
|
-
maa/bin/DirectML.dll,sha256=kKkjnHnpdU1DaqjDsmzb0kvkcQapZyWbPOlVnUesdm0,18444832
|
|
15
|
-
maa/bin/MaaAdbControlUnit.dll,sha256=Xj6dr5CXq1wCSOUCaSgbDX3xk94yDnZq8LalZ7jmSA4,873984
|
|
16
|
-
maa/bin/MaaDbgControlUnit.dll,sha256=3UpE9bwiagC8WWE5H8rW_kTKLCAkilAY3FyzSWwX5Fc,444416
|
|
17
|
-
maa/bin/MaaFramework.dll,sha256=UlJSWmoyFa2DZxMDxCBxgUUd5zdEFZitIOJAzYVMuNY,1631744
|
|
18
|
-
maa/bin/MaaToolkit.dll,sha256=WB71L0UmpDAJzr-cr_wT-08iHhDm4VLTlew60l97DIM,737792
|
|
19
|
-
maa/bin/MaaUtils.dll,sha256=NZhGA01sVLBK0YIGgnrm0racpMBW6RgQNEw-quBDCOI,615936
|
|
20
|
-
maa/bin/MaaWin32ControlUnit.dll,sha256=c9jprCAEpgyVIvfpD3tvfdmCVy8GvdJ89W-Nrcutw2w,405504
|
|
21
|
-
maa/bin/fastdeploy_ppocr_maa.dll,sha256=jvgWCaYUa3WuQrgv1hdwXDw1RzUDqoBgeHOrhQqREUY,554496
|
|
22
|
-
maa/bin/onnxruntime_maa.dll,sha256=vPdKG3NKeQqiEiMlPT1ySp2Bc0xwtL8EBriPkTaQEbs,14471680
|
|
23
|
-
maa/bin/opencv_world4_maa.dll,sha256=FudjT3gIzkZNBAMFd-YxtM3D8PgHPqXnHRvgH5iRImw,14958592
|
|
24
|
-
MaaFw-2.2.2.dist-info/LICENSE.md,sha256=RG51X65V_wNLuyG-RGcLXxFsKyZnlH5wNvK_5mMlOag,7560
|
|
25
|
-
MaaFw-2.2.2.dist-info/METADATA,sha256=-Jr7OovF3t1PTdM7qWd5yvWkG7pGBXz5xfJEQjW7K88,10390
|
|
26
|
-
MaaFw-2.2.2.dist-info/WHEEL,sha256=56dCSEt9kxiG1BpXg6NxqPFNanuqDWBpqzKbo9FEums,95
|
|
27
|
-
MaaFw-2.2.2.dist-info/top_level.txt,sha256=G8r2L__aYaMq4S3R70G6NsfEROiVp08kUcWvATzk2J8,4
|
|
28
|
-
MaaFw-2.2.2.dist-info/RECORD,,
|
MaaFw-2.2.2.dist-info/WHEEL
DELETED
|
File without changes
|
|
File without changes
|