ErisPulse 2.3.3.dev0__py3-none-any.whl → 2.3.4.dev2__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.
- ErisPulse/CLI/__init__.py +11 -0
- ErisPulse/CLI/__init__.pyi +13 -0
- ErisPulse/CLI/base.py +52 -0
- ErisPulse/CLI/base.pyi +50 -0
- ErisPulse/CLI/cli.py +224 -0
- ErisPulse/CLI/cli.pyi +80 -0
- ErisPulse/CLI/commands/__init__.py +6 -0
- ErisPulse/CLI/commands/__init__.pyi +12 -0
- ErisPulse/CLI/commands/init.py +395 -0
- ErisPulse/CLI/commands/init.pyi +70 -0
- ErisPulse/CLI/commands/install.py +302 -0
- ErisPulse/CLI/commands/install.pyi +58 -0
- ErisPulse/CLI/commands/list.py +160 -0
- ErisPulse/CLI/commands/list.pyi +44 -0
- ErisPulse/CLI/commands/list_remote.py +123 -0
- ErisPulse/CLI/commands/list_remote.pyi +35 -0
- ErisPulse/CLI/commands/run.py +108 -0
- ErisPulse/CLI/commands/run.pyi +39 -0
- ErisPulse/CLI/commands/self_update.py +232 -0
- ErisPulse/CLI/commands/self_update.pyi +47 -0
- ErisPulse/CLI/commands/uninstall.py +32 -0
- ErisPulse/CLI/commands/uninstall.pyi +24 -0
- ErisPulse/CLI/commands/upgrade.py +56 -0
- ErisPulse/CLI/commands/upgrade.pyi +25 -0
- ErisPulse/CLI/console.pyi +20 -0
- ErisPulse/CLI/registry.py +112 -0
- ErisPulse/CLI/registry.pyi +99 -0
- ErisPulse/{utils → CLI/utils}/__init__.py +2 -6
- ErisPulse/CLI/utils/__init__.pyi +14 -0
- ErisPulse/{utils → CLI/utils}/package_manager.py +146 -20
- ErisPulse/CLI/utils/package_manager.pyi +241 -0
- ErisPulse/{utils → CLI/utils}/reload_handler.py +7 -8
- ErisPulse/CLI/utils/reload_handler.pyi +64 -0
- ErisPulse/Core/Bases/__init__.pyi +14 -0
- ErisPulse/Core/Bases/adapter.py +13 -1
- ErisPulse/Core/Bases/adapter.pyi +140 -0
- ErisPulse/Core/Bases/manager.py +136 -0
- ErisPulse/Core/Bases/manager.pyi +108 -0
- ErisPulse/Core/Bases/module.py +53 -1
- ErisPulse/Core/Bases/module.pyi +95 -0
- ErisPulse/Core/Event/__init__.pyi +26 -0
- ErisPulse/Core/Event/base.pyi +62 -0
- ErisPulse/Core/Event/command.py +6 -1
- ErisPulse/Core/Event/command.pyi +113 -0
- ErisPulse/Core/Event/exceptions.pyi +43 -0
- ErisPulse/Core/Event/message.pyi +93 -0
- ErisPulse/Core/Event/meta.pyi +92 -0
- ErisPulse/Core/Event/notice.pyi +108 -0
- ErisPulse/Core/Event/request.pyi +76 -0
- ErisPulse/Core/Event/wrapper.py +2 -3
- ErisPulse/Core/Event/wrapper.pyi +403 -0
- ErisPulse/Core/__init__.py +16 -13
- ErisPulse/Core/__init__.pyi +16 -0
- ErisPulse/Core/_self_config.py +1 -1
- ErisPulse/Core/_self_config.pyi +72 -0
- ErisPulse/Core/adapter.py +70 -10
- ErisPulse/Core/adapter.pyi +246 -0
- ErisPulse/Core/config.pyi +70 -0
- ErisPulse/Core/exceptions.py +4 -2
- ErisPulse/Core/exceptions.pyi +60 -0
- ErisPulse/Core/lifecycle.py +15 -1
- ErisPulse/Core/lifecycle.pyi +92 -0
- ErisPulse/Core/logger.py +21 -15
- ErisPulse/Core/logger.pyi +169 -0
- ErisPulse/Core/module.py +57 -9
- ErisPulse/Core/module.pyi +189 -0
- ErisPulse/Core/router.py +13 -5
- ErisPulse/Core/router.pyi +120 -0
- ErisPulse/Core/storage.py +94 -256
- ErisPulse/Core/storage.pyi +220 -0
- ErisPulse/__init__.py +35 -1236
- ErisPulse/__init__.pyi +22 -0
- ErisPulse/__main__.py +1 -1
- ErisPulse/__main__.pyi +24 -0
- ErisPulse/loaders/__init__.py +22 -0
- ErisPulse/loaders/__init__.pyi +21 -0
- ErisPulse/loaders/adapter_loader.py +187 -0
- ErisPulse/loaders/adapter_loader.pyi +82 -0
- ErisPulse/loaders/base_loader.py +162 -0
- ErisPulse/loaders/base_loader.pyi +23 -0
- ErisPulse/loaders/initializer.py +150 -0
- ErisPulse/loaders/initializer.pyi +60 -0
- ErisPulse/loaders/module_loader.py +618 -0
- ErisPulse/loaders/module_loader.pyi +179 -0
- ErisPulse/loaders/strategy.py +129 -0
- ErisPulse/loaders/strategy.pyi +90 -0
- ErisPulse/sdk.py +435 -0
- ErisPulse/sdk.pyi +158 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/METADATA +6 -20
- erispulse-2.3.4.dev2.dist-info/RECORD +103 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/licenses/LICENSE +3 -3
- ErisPulse/Core/ux.py +0 -635
- ErisPulse/utils/cli.py +0 -1097
- erispulse-2.3.3.dev0.dist-info/RECORD +0 -35
- /ErisPulse/{utils → CLI}/console.py +0 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/WHEEL +0 -0
- {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
#
|
|
3
|
+
# Auto-generated type stub for storage.py
|
|
4
|
+
# DO NOT EDIT MANUALLY - Generated by generate-type-stubs.py
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
ErisPulse 存储管理模块
|
|
9
|
+
|
|
10
|
+
提供键值存储和事务支持,用于管理框架运行时数据。
|
|
11
|
+
基于SQLite实现持久化存储,支持复杂数据类型和原子操作。
|
|
12
|
+
|
|
13
|
+
支持两种数据库模式:
|
|
14
|
+
1. 项目数据库(默认):位于项目目录下的 config/config.db
|
|
15
|
+
2. 全局数据库:位于包内的 ../data/config.db
|
|
16
|
+
|
|
17
|
+
用户可通过在 config.toml 中配置以下选项来选择使用全局数据库:
|
|
18
|
+
```toml
|
|
19
|
+
[ErisPulse.storage]
|
|
20
|
+
use_global_db = true
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
{!--< tips >!--}
|
|
24
|
+
1. 支持JSON序列化存储复杂数据类型
|
|
25
|
+
2. 提供事务支持确保数据一致性
|
|
26
|
+
{!--< /tips >!--}
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
import os
|
|
30
|
+
import json
|
|
31
|
+
import sqlite3
|
|
32
|
+
import threading
|
|
33
|
+
from typing import List, Dict, Optional, Any, Type
|
|
34
|
+
from contextlib import contextmanager
|
|
35
|
+
|
|
36
|
+
class StorageManager:
|
|
37
|
+
"""
|
|
38
|
+
存储管理器
|
|
39
|
+
|
|
40
|
+
单例模式实现,提供键值存储的增删改查和事务管理
|
|
41
|
+
|
|
42
|
+
支持两种数据库模式:
|
|
43
|
+
1. 项目数据库(默认):位于项目目录下的 config/config.db
|
|
44
|
+
2. 全局数据库:位于包内的 ../data/config.db
|
|
45
|
+
|
|
46
|
+
用户可通过在 config.toml 中配置以下选项来选择使用全局数据库:
|
|
47
|
+
```toml
|
|
48
|
+
[ErisPulse.storage]
|
|
49
|
+
use_global_db = true
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
{!--< tips >!--}
|
|
53
|
+
1. 使用get/set方法操作存储项
|
|
54
|
+
2. 使用transaction上下文管理事务
|
|
55
|
+
{!--< /tips >!--}
|
|
56
|
+
"""
|
|
57
|
+
def __new__(cls: object, *args: ..., **kwargs: ...) -> ...:
|
|
58
|
+
...
|
|
59
|
+
def __init__(self: None) -> ...:
|
|
60
|
+
...
|
|
61
|
+
def _get_connection(self: object) -> ...:
|
|
62
|
+
"""
|
|
63
|
+
获取数据库连接(支持事务)
|
|
64
|
+
|
|
65
|
+
如果在事务中,返回事务的连接
|
|
66
|
+
否则创建新连接
|
|
67
|
+
"""
|
|
68
|
+
...
|
|
69
|
+
def _ensure_directories(self: object) -> None:
|
|
70
|
+
"""
|
|
71
|
+
确保必要的目录存在
|
|
72
|
+
"""
|
|
73
|
+
...
|
|
74
|
+
def get(self: object, key: str, default: Any = ...) -> Any:
|
|
75
|
+
"""
|
|
76
|
+
获取存储项的值
|
|
77
|
+
|
|
78
|
+
:param key: 存储项键名
|
|
79
|
+
:param default: 默认值(当键不存在时返回)
|
|
80
|
+
:return: 存储项的值
|
|
81
|
+
|
|
82
|
+
:example:
|
|
83
|
+
>>> timeout = storage.get("network.timeout", 30)
|
|
84
|
+
>>> user_settings = storage.get("user.settings", {})
|
|
85
|
+
"""
|
|
86
|
+
...
|
|
87
|
+
def get_all_keys(self: object) -> List[str]:
|
|
88
|
+
"""
|
|
89
|
+
获取所有存储项的键名
|
|
90
|
+
|
|
91
|
+
:return: 键名列表
|
|
92
|
+
|
|
93
|
+
:example:
|
|
94
|
+
>>> all_keys = storage.get_all_keys()
|
|
95
|
+
>>> print(f"共有 {len(all_keys)} 个存储项")
|
|
96
|
+
"""
|
|
97
|
+
...
|
|
98
|
+
def set(self: object, key: str, value: Any) -> bool:
|
|
99
|
+
"""
|
|
100
|
+
设置存储项的值
|
|
101
|
+
|
|
102
|
+
:param key: 存储项键名
|
|
103
|
+
:param value: 存储项的值
|
|
104
|
+
:return: 操作是否成功
|
|
105
|
+
|
|
106
|
+
:example:
|
|
107
|
+
>>> storage.set("app.name", "MyApp")
|
|
108
|
+
>>> storage.set("user.settings", {"theme": "dark"})
|
|
109
|
+
"""
|
|
110
|
+
...
|
|
111
|
+
def set_multi(self: object, items: Dict[(str, Any)]) -> bool:
|
|
112
|
+
"""
|
|
113
|
+
批量设置多个存储项
|
|
114
|
+
|
|
115
|
+
:param items: 键值对字典
|
|
116
|
+
:return: 操作是否成功
|
|
117
|
+
|
|
118
|
+
:example:
|
|
119
|
+
>>> storage.set_multi({
|
|
120
|
+
>>> "app.name": "MyApp",
|
|
121
|
+
>>> "app.version": "1.0.0",
|
|
122
|
+
>>> "app.debug": True
|
|
123
|
+
>>> })
|
|
124
|
+
"""
|
|
125
|
+
...
|
|
126
|
+
def getConfig(self: object, key: str, default: Any = ...) -> Any:
|
|
127
|
+
"""
|
|
128
|
+
获取模块/适配器配置项(委托给config模块)
|
|
129
|
+
:param key: 配置项的键(支持点分隔符如"module.sub.key")
|
|
130
|
+
:param default: 默认值
|
|
131
|
+
:return: 配置项的值
|
|
132
|
+
"""
|
|
133
|
+
...
|
|
134
|
+
def setConfig(self: object, key: str, value: Any) -> bool:
|
|
135
|
+
"""
|
|
136
|
+
设置模块/适配器配置(委托给config模块)
|
|
137
|
+
:param key: 配置项键名(支持点分隔符如"module.sub.key")
|
|
138
|
+
:param value: 配置项值
|
|
139
|
+
:return: 操作是否成功
|
|
140
|
+
"""
|
|
141
|
+
...
|
|
142
|
+
def delete(self: object, key: str) -> bool:
|
|
143
|
+
"""
|
|
144
|
+
删除存储项
|
|
145
|
+
|
|
146
|
+
:param key: 存储项键名
|
|
147
|
+
:return: 操作是否成功
|
|
148
|
+
|
|
149
|
+
:example:
|
|
150
|
+
>>> storage.delete("temp.session")
|
|
151
|
+
"""
|
|
152
|
+
...
|
|
153
|
+
def delete_multi(self: object, keys: List[str]) -> bool:
|
|
154
|
+
"""
|
|
155
|
+
批量删除多个存储项
|
|
156
|
+
|
|
157
|
+
:param keys: 键名列表
|
|
158
|
+
:return: 操作是否成功
|
|
159
|
+
|
|
160
|
+
:example:
|
|
161
|
+
>>> storage.delete_multi(["temp.key1", "temp.key2"])
|
|
162
|
+
"""
|
|
163
|
+
...
|
|
164
|
+
def get_multi(self: object, keys: List[str]) -> Dict[(str, Any)]:
|
|
165
|
+
"""
|
|
166
|
+
批量获取多个存储项的值
|
|
167
|
+
|
|
168
|
+
:param keys: 键名列表
|
|
169
|
+
:return: 键值对字典
|
|
170
|
+
|
|
171
|
+
:example:
|
|
172
|
+
>>> settings = storage.get_multi(["app.name", "app.version"])
|
|
173
|
+
"""
|
|
174
|
+
...
|
|
175
|
+
def transaction(self: object) -> StorageManager._Transaction:
|
|
176
|
+
"""
|
|
177
|
+
创建事务上下文
|
|
178
|
+
|
|
179
|
+
:return: 事务上下文管理器
|
|
180
|
+
|
|
181
|
+
:example:
|
|
182
|
+
>>> with storage.transaction():
|
|
183
|
+
>>> storage.set("key1", "value1")
|
|
184
|
+
>>> storage.set("key2", "value2")
|
|
185
|
+
"""
|
|
186
|
+
...
|
|
187
|
+
def clear(self: object) -> bool:
|
|
188
|
+
"""
|
|
189
|
+
清空所有存储项
|
|
190
|
+
|
|
191
|
+
:return: 操作是否成功
|
|
192
|
+
|
|
193
|
+
:example:
|
|
194
|
+
>>> storage.clear() # 清空所有存储
|
|
195
|
+
"""
|
|
196
|
+
...
|
|
197
|
+
def __getattr__(self: object, key: str) -> Any:
|
|
198
|
+
"""
|
|
199
|
+
通过属性访问存储项
|
|
200
|
+
|
|
201
|
+
:param key: 存储项键名
|
|
202
|
+
:return: 存储项的值
|
|
203
|
+
|
|
204
|
+
:raises AttributeError: 当存储项不存在时抛出
|
|
205
|
+
|
|
206
|
+
:example:
|
|
207
|
+
>>> app_name = storage.app_name
|
|
208
|
+
"""
|
|
209
|
+
...
|
|
210
|
+
def __setattr__(self: object, key: str, value: Any) -> None:
|
|
211
|
+
"""
|
|
212
|
+
通过属性设置存储项
|
|
213
|
+
|
|
214
|
+
:param key: 存储项键名
|
|
215
|
+
:param value: 存储项的值
|
|
216
|
+
|
|
217
|
+
:example:
|
|
218
|
+
>>> storage.app_name = "MyApp"
|
|
219
|
+
"""
|
|
220
|
+
...
|