kuaijs-ios 0.2.11__py3-none-any.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.
kuaijs/__init__.py ADDED
@@ -0,0 +1,25 @@
1
+ __all__ = [
2
+ "system",
3
+ "g",
4
+ "device",
5
+ "config",
6
+ "action",
7
+ "appleocr",
8
+ "file",
9
+ "hid",
10
+ "hotupdate",
11
+ "image",
12
+ "ime",
13
+ "media",
14
+ "mysql",
15
+ "netcard",
16
+ "node",
17
+ "paddleocr",
18
+ "tomatoocr",
19
+ "tts",
20
+ "ui",
21
+ "utils",
22
+ "yolo",
23
+ "pip",
24
+ "logger",
25
+ ]
kuaijs/action.pyi ADDED
@@ -0,0 +1,239 @@
1
+ from typing import List, Literal, Protocol
2
+
3
+ class TapPoint(Protocol):
4
+ x: int
5
+ y: int
6
+
7
+ # 设置动作抖动值(像素,随屏幕 scale 适配)
8
+ def set_jitter_value(value: int) -> bool:
9
+ """设置动作抖动值(像素,随屏幕 scale 适配)
10
+
11
+ 参数:
12
+ value: 抖动像素值
13
+ 返回:
14
+ bool: 是否设置成功
15
+ """
16
+ ...
17
+
18
+ # 点击
19
+ # 参数:x/y 坐标;duration 持续时间(ms);jitter 是否启用抖动
20
+ def click(x: int, y: int, duration: int = ..., jitter: bool = ...) -> bool:
21
+ """点击指定坐标
22
+
23
+ 参数:
24
+ x: 坐标 X
25
+ y: 坐标 Y
26
+ duration: 按下持续时间(毫秒,默认 20ms)
27
+ jitter: 是否启用抖动(默认 False)
28
+ 返回:
29
+ bool: 是否点击成功
30
+ """
31
+ ...
32
+
33
+ # 随机点击指定矩形区域
34
+ def click_random(x1: int, y1: int, x2: int, y2: int, duration: int = ...) -> bool:
35
+ """随机点击矩形区域
36
+
37
+ 参数:
38
+ x1: 左上角 X
39
+ y1: 左上角 Y
40
+ x2: 右下角 X
41
+ y2: 右下角 Y
42
+ duration: 按下持续时间(毫秒,默认 20ms)
43
+ 返回:
44
+ bool: 是否点击成功
45
+ """
46
+ ...
47
+
48
+ # 双击
49
+ # 参数:duration 持续时间;interval 间隔时间(ms);jitter 是否抖动
50
+ def double_click(
51
+ x: int, y: int, duration: int = ..., interval: int = ..., jitter: bool = ...
52
+ ) -> bool:
53
+ """双击
54
+
55
+ 参数:
56
+ x: 坐标 X
57
+ y: 坐标 Y
58
+ duration: 每次按下持续时间(毫秒,默认 20ms)
59
+ interval: 两次点击间隔(毫秒,默认 20ms)
60
+ jitter: 是否启用抖动(默认 False)
61
+ 返回:
62
+ bool: 是否双击成功
63
+ """
64
+ ...
65
+
66
+ # 随机双击指定区域
67
+ def double_click_random(
68
+ x1: int, y1: int, x2: int, y2: int, duration: int = ..., interval: int = ...
69
+ ) -> bool:
70
+ """随机双击矩形区域
71
+
72
+ 参数:
73
+ x1: 左上角 X
74
+ y1: 左上角 Y
75
+ x2: 右下角 X
76
+ y2: 右下角 Y
77
+ duration: 每次按下持续时间(毫秒,默认 20ms)
78
+ interval: 两次点击间隔(毫秒,默认 20ms)
79
+ 返回:
80
+ bool: 是否双击成功
81
+ """
82
+ ...
83
+
84
+ # 直线滑动
85
+ # 参数:起点 x/y;终点 ex/ey;duration 总时长;jitter 抖动;steps 轨迹点数
86
+ def swipe(
87
+ startX: int,
88
+ startY: int,
89
+ endX: int,
90
+ endY: int,
91
+ duration: int = ...,
92
+ jitter: bool = ...,
93
+ steps: int = ...,
94
+ ) -> bool:
95
+ """直线滑动
96
+
97
+ 参数:
98
+ startX: 起始 X
99
+ startY: 起始 Y
100
+ endX: 结束 X
101
+ endY: 结束 Y
102
+ duration: 总时长(毫秒,默认 100ms)
103
+ jitter: 是否启用抖动(默认 False)
104
+ steps: 轨迹点数量(默认 6)
105
+ 返回:
106
+ bool: 是否滑动成功
107
+ """
108
+ ...
109
+
110
+ # 长按并滑动
111
+ # 参数:touch_* 三段时长(ms);steps 步数
112
+ def press_and_swipe(
113
+ startX: int,
114
+ startY: int,
115
+ endX: int,
116
+ endY: int,
117
+ touch_down_duration: int = ...,
118
+ touch_move_duration: int = ...,
119
+ touch_up_duration: int = ...,
120
+ jitter: bool = ...,
121
+ steps: int = ...,
122
+ ) -> bool:
123
+ """长按并滑动
124
+
125
+ 参数:
126
+ touch_down_duration: 按下时长(毫秒,默认 500ms)
127
+ touch_move_duration: 移动时长(毫秒,默认 1000ms)
128
+ touch_up_duration: 抬起时长(毫秒,默认 500ms)
129
+ jitter: 是否启用抖动(默认 False)
130
+ steps: 轨迹点数量(默认 6)
131
+ 其他坐标与滑动参数同 swipe
132
+ 返回:
133
+ bool: 是否执行成功
134
+ """
135
+ ...
136
+
137
+ # 3点曲线滑动(先快后慢)
138
+ def swipe_curve(
139
+ startX: int, startY: int, midX: int, midY: int, endX: int, endY: int, duration: int
140
+ ) -> bool:
141
+ """3点曲线滑动(先快后慢)
142
+
143
+ 参数:
144
+ startX/startY: 起点坐标
145
+ midX/midY: 中间控制点坐标
146
+ endX/endY: 终点坐标
147
+ duration: 总时长(毫秒,默认 1000ms)
148
+ 返回:
149
+ bool: 是否执行成功
150
+ """
151
+ ...
152
+
153
+ # 输入英文文本(不支持中文)
154
+ def input(text: str) -> bool:
155
+ """输入英文文本(不支持中文)
156
+
157
+ 参数:
158
+ text: 文本内容
159
+ 返回:
160
+ bool: 是否输入成功
161
+ """
162
+ ...
163
+
164
+ # 删除文本(count 默认 1)
165
+ def backspace(count: int = ...) -> bool:
166
+ """删除文本
167
+
168
+ 参数:
169
+ count: 删除数量(默认 1)
170
+ 返回:
171
+ bool: 是否删除成功
172
+ """
173
+ ...
174
+
175
+ # 回车
176
+ def enter() -> bool:
177
+ """回车
178
+
179
+ 返回:
180
+ bool: 是否成功
181
+ """
182
+ ...
183
+
184
+ # 回到主屏幕
185
+ def home_screen() -> bool:
186
+ """回到主屏幕
187
+
188
+ 返回:
189
+ bool: 是否成功
190
+ """
191
+ ...
192
+
193
+ # 按按钮(home/volumeup/volumedown 等)
194
+ def press_button(button: Literal["home", "volumeup", "volumedown"]) -> bool:
195
+ """按按钮(home/volumeup/volumedown 等)
196
+
197
+ 参数:
198
+ button: 按钮名称
199
+ 返回:
200
+ bool: 是否成功
201
+ """
202
+ ...
203
+
204
+ # 按 HID 按钮(power/snapshot 等),可指定时长
205
+ def press_hid_button(button: str, duration: int = ...) -> bool:
206
+ """按 HID 按钮(power/snapshot 等),可指定时长
207
+
208
+ 参数:
209
+ button: HID 按钮名称
210
+ duration: 持续时间(毫秒,默认 20ms)
211
+ 返回:
212
+ bool: 是否成功
213
+ """
214
+ ...
215
+
216
+ # 链式 ActionBuilder
217
+ class Pointer:
218
+ def move_to(self, x: int, y: int, duration: int = ...) -> "Pointer": ...
219
+ def down(self) -> "Pointer": ...
220
+ def up(self) -> "Pointer": ...
221
+ def stay(self, duration: int = ...) -> "Pointer": ...
222
+ def tap(self, x: int, y: int, duration: int = ...) -> "Pointer": ...
223
+ def done(self) -> "ActionBuilder": ...
224
+
225
+ class ActionBuilder:
226
+ def add_pointer(self, id: int) -> Pointer: ...
227
+ def single_tap(self, x: int, y: int, duration: int = ...) -> "ActionBuilder": ...
228
+ def multi_tap(
229
+ self, points: List[TapPoint], duration: int = ...
230
+ ) -> "ActionBuilder": ...
231
+ def execute(self) -> bool: ...
232
+
233
+ def create_builder() -> ActionBuilder:
234
+ """创建 ActionBuilder 构建器
235
+
236
+ 返回:
237
+ ActionBuilder: 链式构建器实例
238
+ """
239
+ ...
kuaijs/appleocr.pyi ADDED
@@ -0,0 +1,84 @@
1
+ from typing import List, Optional, Protocol
2
+
3
+ # OCR 识别(Apple Vision)
4
+ # 参数:
5
+ # - input: 输入源(imageId、URL字符串、文件路径或 "screen")
6
+ # - x: 边界框左上角 x 坐标
7
+ # - y: 边界框左上角 y 坐标
8
+ # - ex: 边界框右下角 x 坐标
9
+ # - ey: 边界框右下角 y 坐标
10
+ # - languages: 识别语言数组,例如 ["zh-Hans", "en-US"]
11
+ class OCRResult(Protocol):
12
+ text: str
13
+ confidence: float
14
+ x: int
15
+ y: int
16
+ ex: int
17
+ ey: int
18
+ width: int
19
+ height: int
20
+ centerX: int
21
+ centerY: int
22
+
23
+ def recognize(
24
+ input: str,
25
+ x: int = ...,
26
+ y: int = ...,
27
+ ex: int = ...,
28
+ ey: int = ...,
29
+ languages: Optional[List[str]] = ...,
30
+ ) -> List[OCRResult]:
31
+ """OCR 识别(Apple Vision)
32
+
33
+ 参数默认值:
34
+ x/y/ex/ey: 0
35
+ languages: ["zh-Hans", "en-US"]
36
+ 返回:
37
+ List[OCRResult]: 文本、置信度与位置信息列表
38
+ """
39
+ ...
40
+
41
+ # 纯数字 OCR 识别
42
+ # 参数:同上,过滤非数字,仅保留 0-9 . , - +
43
+ # 返回:数字文本结果列表(含位置信息)
44
+ def recognize_numbers(
45
+ input: str,
46
+ x: int = ...,
47
+ y: int = ...,
48
+ ex: int = ...,
49
+ ey: int = ...,
50
+ ) -> List[OCRResult]:
51
+ """仅识别数字(过滤非数字,保留 0-9 . , - +)
52
+
53
+ 参数默认值:
54
+ x/y/ex/ey: 0
55
+ 返回:
56
+ 同 recognize
57
+ """
58
+ ...
59
+
60
+ # 查找包含目标文本的位置
61
+ # 参数:
62
+ # - input: 输入源(imageId、URL字符串、文件路径或 "screen")
63
+ # - targetTexts: 要查找的目标文本数组
64
+ # - x/y/ex/ey: 搜索区域边界框
65
+ # - languages: 识别语言数组(可选)
66
+ # 返回:匹配到的文本位置信息列表
67
+ def find_text(
68
+ input: str,
69
+ targetTexts: List[str],
70
+ x: int = ...,
71
+ y: int = ...,
72
+ ex: int = ...,
73
+ ey: int = ...,
74
+ languages: Optional[List[str]] = ...,
75
+ ) -> List[OCRResult]:
76
+ """查找指定文本位置
77
+
78
+ 参数默认值:
79
+ x/y/ex/ey: 0
80
+ languages: ["zh-Hans", "en-US"]
81
+ 返回:
82
+ List[OCRResult]: 匹配文本的位置信息列表
83
+ """
84
+ ...
kuaijs/config.pyi ADDED
@@ -0,0 +1,43 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ # 读取整数配置
4
+ def read_int(key: str) -> int:
5
+ """读取整数配置
6
+
7
+ 参数:
8
+ key: 配置键
9
+ 返回:
10
+ int: 配置值
11
+ """
12
+ ...
13
+
14
+ # 读取浮点配置
15
+ def read_double(key: str) -> float:
16
+ """读取浮点配置"""
17
+ ...
18
+
19
+ # 读取字符串配置
20
+ def read_string(key: str) -> Optional[str]:
21
+ """读取字符串配置(不存在返回 None)"""
22
+ ...
23
+
24
+ # 读取布尔配置
25
+ def read_bool(key: str) -> bool:
26
+ """读取布尔配置"""
27
+ ...
28
+
29
+ # 获取所有配置
30
+ def get_json() -> Dict[str, Any]:
31
+ """获取所有配置 JSON"""
32
+ ...
33
+
34
+ # 更新配置
35
+ # value 支持:str/int/float/bool
36
+ def update_config(key: str, value: Any) -> bool:
37
+ """更新配置值(支持 str/int/float/bool)"""
38
+ ...
39
+
40
+ # 删除配置
41
+ def delete_config(key: str) -> bool:
42
+ """删除配置"""
43
+ ...
kuaijs/device.pyi ADDED
@@ -0,0 +1,80 @@
1
+ from typing import Literal, Protocol
2
+
3
+ class ScreenSize(Protocol):
4
+ width: float
5
+ height: float
6
+
7
+ class BatteryInfo(Protocol):
8
+ level: int
9
+ isCharging: bool
10
+
11
+ # 获取电池信息
12
+ # 返回:{"level": 百分比int, "isCharging": 是否充电bool}
13
+ def get_battery_info() -> BatteryInfo:
14
+ """获取电池信息(level/isCharging)"""
15
+ ...
16
+
17
+ # 获取设备ID(Vendor ID)
18
+ def get_device_id() -> str:
19
+ """获取设备 ID(Vendor ID)"""
20
+ ...
21
+
22
+ # 获取服务器设备ID(自定义)
23
+ def get_server_device_id() -> str:
24
+ """获取服务器设备 ID(自定义)"""
25
+ ...
26
+
27
+ # 获取设备名称
28
+ def get_device_name() -> str:
29
+ """获取设备名称"""
30
+ ...
31
+
32
+ # 获取设备型号(硬件型号)
33
+ def get_device_model() -> str:
34
+ """获取设备型号(硬件型号)"""
35
+ ...
36
+
37
+ # 获取屏幕逻辑尺寸
38
+ # 返回:{"width": float, "height": float}
39
+ def get_screen_size() -> ScreenSize:
40
+ """获取屏幕逻辑尺寸(width/height)"""
41
+ ...
42
+
43
+ # 获取屏幕实际尺寸
44
+ # 返回:{"width": float, "height": float}
45
+ def get_screen_real_size() -> ScreenSize:
46
+ """获取屏幕实际尺寸(width/height)"""
47
+ ...
48
+
49
+ # 获取屏幕缩放比例
50
+ def get_screen_scale() -> float:
51
+ """获取屏幕缩放比例"""
52
+ ...
53
+
54
+ # 获取屏幕方向
55
+ def get_orientation() -> Literal["PORTRAIT", "LANDSCAPE"]:
56
+ """获取屏幕方向"""
57
+ ...
58
+
59
+ # 获取系统版本
60
+ def get_os_version() -> str:
61
+ """获取系统版本(例如 16.7.11)"""
62
+ ...
63
+
64
+ # 获取局域网IP
65
+ def get_lan_ip() -> str:
66
+ """获取局域网 IP(例如 192.168.1.100)"""
67
+ ...
68
+
69
+ # 震动
70
+ # 参数:duration 毫秒;intensity 0.0-1.0
71
+ def vibrate(duration: int, intensity: float) -> bool:
72
+ """震动
73
+
74
+ 参数:
75
+ duration: 持续时间(毫秒)
76
+ intensity: 强度 0.0-1.0
77
+ 返回:
78
+ bool: 是否成功
79
+ """
80
+ ...
kuaijs/file.pyi ADDED
@@ -0,0 +1,103 @@
1
+ from typing import List, Optional, Literal
2
+
3
+ # 获取内部目录
4
+ # 参数:type = documents | library | temp | libraryCaches
5
+ def get_internal_dir(
6
+ type: Literal["documents", "library", "temp", "libraryCaches"],
7
+ ) -> str:
8
+ """获取内部目录路径
9
+
10
+ 参数:
11
+ type: 目录类型
12
+ 返回:
13
+ str: 路径
14
+ """
15
+ ...
16
+
17
+ # 获取数据目录
18
+ def get_data_dir() -> str:
19
+ """获取应用数据目录路径"""
20
+ ...
21
+
22
+ # 获取数据文件路径
23
+ # 参数:file = 文件名
24
+ def get_data_file(file: str) -> str:
25
+ """获取应用数据文件路径"""
26
+ ...
27
+
28
+ # 创建文件
29
+ def create(path: str) -> bool:
30
+ """创建文件"""
31
+ ...
32
+
33
+ # 递归创建目录
34
+ def mkdirs(path: str) -> bool:
35
+ """递归创建目录"""
36
+ ...
37
+
38
+ # 删除文件或目录(谨慎)
39
+ def delete_all_file(path: str) -> bool:
40
+ """删除文件或目录(谨慎)"""
41
+ ...
42
+
43
+ # 读取文件内容(UTF-8)
44
+ def read_file(path: str) -> Optional[str]:
45
+ """读取文件内容(UTF-8)"""
46
+ ...
47
+
48
+ # 读取资源文件内容(UTF-8)
49
+ def read_res_file(fileName: str) -> Optional[str]:
50
+ """读取资源文件内容(UTF-8)"""
51
+ ...
52
+
53
+ # 删除指定行或包含关键字的行
54
+ # 参数:line >=0 删除行号;line <0 且 contains 指定关键字
55
+ def delete_line(path: str, line: int, contains: Optional[str]) -> bool:
56
+ """删除指定行或包含关键字的行
57
+
58
+ 参数:
59
+ line: 行号(>=0 删除对应行;<0 时忽略行号)
60
+ contains: 包含关键字(当行号<0时生效)
61
+ """
62
+ ...
63
+
64
+ # 列出目录文件
65
+ # 参数:recursion 是否递归
66
+ def list_dir(path: str, recursion: bool) -> List[str]:
67
+ """列出目录文件"""
68
+ ...
69
+
70
+ # 写入文件(覆盖,UTF-8)
71
+ def write_file(path: str, data: str) -> bool:
72
+ """写入文件(覆盖,UTF-8)"""
73
+ ...
74
+
75
+ # 追加一行(UTF-8)
76
+ def append_line(path: str, data: str) -> bool:
77
+ """追加一行(UTF-8)"""
78
+ ...
79
+
80
+ # 读取指定行(0 基)
81
+ def read_line(path: str, lineNo: int) -> Optional[str]:
82
+ """读取指定行(0 基)"""
83
+ ...
84
+
85
+ # 读取所有行
86
+ def read_all_lines(path: str) -> Optional[List[str]]:
87
+ """读取所有行"""
88
+ ...
89
+
90
+ # 文件是否存在
91
+ def exists(path: str) -> bool:
92
+ """文件或目录是否存在"""
93
+ ...
94
+
95
+ # 复制文件
96
+ def copy(src: str, dest: str) -> bool:
97
+ """复制文件"""
98
+ ...
99
+
100
+ # 计算文件 MD5(十六进制字符串)
101
+ def file_md5(path: str) -> Optional[str]:
102
+ """计算文件 MD5(十六进制字符串)"""
103
+ ...
kuaijs/g.pyi ADDED
@@ -0,0 +1,24 @@
1
+ from typing import Final
2
+
3
+ # 应用版本号(字符串),例如 "1.2.3"
4
+ app_version: Final[str]
5
+
6
+ # 应用构建号(整数),例如 123
7
+ app_build_number: Final[int]
8
+
9
+ # 应用名称,例如 "快点JS"
10
+ app_name: Final[str]
11
+
12
+ # 应用包名(Bundle ID),例如 "com.example.app"
13
+ app_bundle_id: Final[str]
14
+
15
+ # 是否处于调试模式(根据宿主环境设置)
16
+ is_debug: Final[bool]
17
+
18
+ # 应用的 package.json 内容
19
+ package_json: Final[dict]
20
+
21
+ # 将宿主应用切入前台
22
+ def take_me_to_front() -> None:
23
+ """将宿主应用切入前台"""
24
+ ...