MaaFw 4.5.1__py3-none-manylinux2014_x86_64.whl → 5.4.0b1__py3-none-manylinux2014_x86_64.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.
@@ -1,199 +0,0 @@
1
- import ctypes
2
- import json
3
- from abc import ABC
4
- from typing import Optional, Tuple, Any
5
- from enum import IntEnum
6
- from dataclasses import dataclass
7
-
8
- from .define import MaaNotificationCallback
9
-
10
-
11
- # class NotificationEvent(IntEnum):
12
- # ResourceLoading = 1
13
- # ControllerAction = 2
14
- # TaskerTask = 3
15
- # TaskNextList = 4
16
- # TaskRecognition = 5
17
- # TaskAction = 6
18
-
19
-
20
- class NotificationType(IntEnum):
21
- Unknown = 0
22
- Starting = 1
23
- Succeeded = 2
24
- Failed = 3
25
-
26
-
27
- class NotificationHandler(ABC):
28
-
29
- @dataclass
30
- class ResourceLoadingDetail:
31
- res_id: int
32
- hash: str
33
- path: str
34
-
35
- def on_resource_loading(
36
- self, noti_type: NotificationType, detail: ResourceLoadingDetail
37
- ):
38
- pass
39
-
40
- @dataclass
41
- class ControllerActionDetail:
42
- ctrl_id: int
43
- uuid: str
44
- action: str
45
- param: dict
46
-
47
- def on_controller_action(
48
- self, noti_type: NotificationType, detail: ControllerActionDetail
49
- ):
50
- pass
51
-
52
- @dataclass
53
- class TaskerTaskDetail:
54
- task_id: int
55
- entry: str
56
- uuid: str
57
- hash: str
58
-
59
- def on_tasker_task(self, noti_type: NotificationType, detail: TaskerTaskDetail):
60
- pass
61
-
62
- @dataclass
63
- class NodeNextListDetail:
64
- task_id: int
65
- name: str
66
- next_list: list[str]
67
- focus: Any
68
-
69
- def on_node_next_list(
70
- self, noti_type: NotificationType, detail: NodeNextListDetail
71
- ):
72
- pass
73
-
74
- @dataclass
75
- class NodeRecognitionDetail:
76
- task_id: int
77
- reco_id: int
78
- name: str
79
- focus: Any
80
-
81
- def on_node_recognition(
82
- self, noti_type: NotificationType, detail: NodeRecognitionDetail
83
- ):
84
- pass
85
-
86
- @dataclass
87
- class NodeActionDetail:
88
- task_id: int
89
- node_id: int
90
- name: str
91
- focus: Any
92
-
93
- def on_node_action(self, noti_type: NotificationType, detail: NodeActionDetail):
94
- pass
95
-
96
- def on_unknown_notification(self, msg: str, details: dict):
97
- pass
98
-
99
- def on_raw_notification(self, msg: str, details: dict):
100
-
101
- noti_type = NotificationHandler._notification_type(msg)
102
-
103
- if msg.startswith("Resource.Loading"):
104
- detail = self.ResourceLoadingDetail(
105
- res_id=details["res_id"],
106
- hash=details["hash"],
107
- path=details["path"],
108
- )
109
- self.on_resource_loading(noti_type, detail)
110
-
111
- elif msg.startswith("Controller.Action"):
112
- detail = self.ControllerActionDetail(
113
- ctrl_id=details["ctrl_id"],
114
- uuid=details["uuid"],
115
- action=details["action"],
116
- param=details["param"],
117
- )
118
- self.on_controller_action(noti_type, detail)
119
-
120
- elif msg.startswith("Tasker.Task"):
121
- detail = self.TaskerTaskDetail(
122
- task_id=details["task_id"],
123
- entry=details["entry"],
124
- uuid=details["uuid"],
125
- hash=details["hash"],
126
- )
127
- self.on_tasker_task(noti_type, detail)
128
-
129
- elif msg.startswith("Node.NextList"):
130
- detail = self.NodeNextListDetail(
131
- task_id=details["task_id"],
132
- name=details["name"],
133
- next_list=details["list"],
134
- focus=details["focus"],
135
- )
136
- self.on_node_next_list(noti_type, detail)
137
-
138
- elif msg.startswith("Node.Recognition"):
139
- detail = self.NodeRecognitionDetail(
140
- task_id=details["task_id"],
141
- reco_id=details["reco_id"],
142
- name=details["name"],
143
- focus=details["focus"],
144
- )
145
- self.on_node_recognition(noti_type, detail)
146
-
147
- elif msg.startswith("Node.Action"):
148
- detail = self.NodeActionDetail(
149
- task_id=details["task_id"],
150
- node_id=details["node_id"],
151
- name=details["name"],
152
- focus=details["focus"],
153
- )
154
- self.on_node_action(noti_type, detail)
155
-
156
- else:
157
- self.on_unknown_notification(msg, details)
158
-
159
- @property
160
- def c_callback(self) -> MaaNotificationCallback:
161
- return self._c_notification_agent
162
-
163
- @property
164
- def c_callback_arg(self) -> ctypes.c_void_p:
165
- return ctypes.c_void_p.from_buffer(ctypes.py_object(self))
166
-
167
- @staticmethod
168
- def _gen_c_param(
169
- handler: Optional["NotificationHandler"],
170
- ) -> Tuple[MaaNotificationCallback, ctypes.c_void_p]:
171
- if handler:
172
- return handler.c_callback, handler.c_callback_arg
173
- else:
174
- return NotificationHandler._c_notification_agent, ctypes.c_void_p()
175
-
176
- @staticmethod
177
- def _notification_type(message: str) -> NotificationType:
178
- if message.endswith(".Starting"):
179
- return NotificationType.Starting
180
- elif message.endswith(".Succeeded"):
181
- return NotificationType.Succeeded
182
- elif message.endswith(".Failed"):
183
- return NotificationType.Failed
184
- else:
185
- return NotificationType.Unknown
186
-
187
- @staticmethod
188
- @MaaNotificationCallback
189
- def _c_notification_agent(
190
- msg: ctypes.c_char_p,
191
- details_json: ctypes.c_char_p,
192
- callback_arg: ctypes.c_void_p,
193
- ):
194
- if not callback_arg:
195
- return
196
-
197
- self: NotificationHandler = ctypes.cast(callback_arg, ctypes.py_object).value
198
-
199
- self.on_raw_notification(msg.decode(), json.loads(details_json.decode()))
@@ -1,34 +0,0 @@
1
- maa/__init__.py,sha256=t2Z9yJWrSZfH16xYN67bKpiPEHDf7iaiw4wi0PjmU8U,250
2
- maa/agent_client.py,sha256=qx1-3VGp97JB_UMlbkvK-O_GTigbdqD6U4gGKi2yQW4,4049
3
- maa/buffer.py,sha256=XFr1MnWt-xmZkhQ_2ZzGfiqSJJwmphY4U07EEzMNYQc,16544
4
- maa/context.py,sha256=dYCvRNqq2iCL8lIyp2TkZorGB5KNI34L3pGzlpdL7co,6454
5
- maa/controller.py,sha256=pyVPwRnpGcGCoWAa2FOPBvwIY5jY2kqmRtd-V16bPyU,24507
6
- maa/custom_action.py,sha256=honGd28UaKWzApYBHO9_Cka8hPfzZUy6HBUfIdfQiaU,2554
7
- maa/custom_recognition.py,sha256=nfNgPKq9a6t2eoXwKMJRvZMXTh31Jn0JfxUMsfGI33Y,3384
8
- maa/define.py,sha256=EHTbELEAf4vXuCLyNM6Xhp9MM6iigSA6b9QE3m-B3DE,13643
9
- maa/job.py,sha256=MUI5T2X9ON9c7Dl6yo_0pp8Ulpn25XOD_uEdGm2k-TA,1231
10
- maa/library.py,sha256=u6gbEHDV3I0y69-ZoBo1p6-bAtP4jqSQa4FICuzaw3U,3961
11
- maa/notification_handler.py,sha256=dpbIEKTqCvW9mj6am49Fd9ntoM39OCadhOGrvkmhyyI,5502
12
- maa/resource.py,sha256=sCGAK1FFjZCaf01t_FPdtl4pMDQsybhEjmafp9XfITA,12222
13
- maa/tasker.py,sha256=8eGK83RhsVXh1Px2_eHhUBd6epaubIGDN0FG4soi4xM,14232
14
- maa/toolkit.py,sha256=H7P58dPLKzEm_aZMsDJ98IaMZnTE-hcFgK8MKnN0F6g,11381
15
- maa/agent/__init__.py,sha256=K4vyyD6YgLR6PEQl86t4oKP4eViCdNr3Br94dNk8YjM,257
16
- maa/agent/agent_server.py,sha256=e0yE_ffWJlTPydJbYLK9OhCM5fVVlZQIcvEQMjB5V68,3636
17
- maa/bin/libMaaAdbControlUnit.so,sha256=ZvlOMVeXUzR90t-IPZtZugNQsd5b42biU3nB0z6dZjo,807656
18
- maa/bin/libMaaAgentClient.so,sha256=dUKNSR2TvkOsfMeGMbHx6Kv1T16sqqDCgRndtbDqVPQ,1963144
19
- maa/bin/libMaaAgentServer.so,sha256=0592H3Cr_QMsA5vUnP-TT4NSJX6Kh3m3jjgIZNulRAo,1996976
20
- maa/bin/libMaaCustomControlUnit.so,sha256=KW_ssjQVp9A1SX4QHA6GU2R4tG1AbUuVguSG2ayYBjc,196544
21
- maa/bin/libMaaDbgControlUnit.so,sha256=DULsqjRP3OTDQhDke74y6GFol2JhhCLrGieM90BfPGw,387496
22
- maa/bin/libMaaFramework.so,sha256=nPzY2mmaBWQrBN30y31D40_ptVG5Kko52gZVttpCct4,3261936
23
- maa/bin/libMaaToolkit.so,sha256=zw4hr0sVVC66EhpbP5c6imS0im1WLhV4SOstv2QdLSw,1253456
24
- maa/bin/libMaaUtils.so,sha256=9pCs5ITCUfkaEhgimsX7WGGTkfIdD2_Btev-huBuaOg,700600
25
- maa/bin/libc++.so.1,sha256=VBRNSEJEpV1qPB25f6tMuCVbxhVZ-38YF8jU3xX5KXQ,1324528
26
- maa/bin/libc++abi.so.1,sha256=Ftv8RvYQzF7Xo9j6S_CqmKxJ6I7LxdVxCh3lBV1Waig,401640
27
- maa/bin/libfastdeploy_ppocr.so,sha256=4m9RJYuJrRzHy3ALpiErEmzyHH-5RMm2rO-ZgTbK5bk,7008200
28
- maa/bin/libonnxruntime.so.1,sha256=CoPWtCF9IZal-QRfNDZ2_lKp6FZJPHBoqcyQlJDPo8M,19104744
29
- maa/bin/libopencv_world4.so.411,sha256=d3ywKXBS0QlRwjvh_21S_Ldea1GpEjNtp7F0dMGFCis,14752048
30
- maa/bin/libunwind.so.1,sha256=m_I4uMxz9WBbggB5eCvZPJO63vim2MWFhw9nYG7vdgI,60040
31
- maafw-4.5.1.dist-info/licenses/LICENSE.md,sha256=RG51X65V_wNLuyG-RGcLXxFsKyZnlH5wNvK_5mMlOag,7560
32
- maafw-4.5.1.dist-info/METADATA,sha256=AGznJH5vrI0ORaRDX8h5v_On-kbG4BsmkwL-lZFxznM,24481
33
- maafw-4.5.1.dist-info/WHEEL,sha256=ElIck4UKS1gfqi_USxboIISULsrnySUDnW4muwHK3us,104
34
- maafw-4.5.1.dist-info/RECORD,,