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.
Files changed (97) hide show
  1. ErisPulse/CLI/__init__.py +11 -0
  2. ErisPulse/CLI/__init__.pyi +13 -0
  3. ErisPulse/CLI/base.py +52 -0
  4. ErisPulse/CLI/base.pyi +50 -0
  5. ErisPulse/CLI/cli.py +224 -0
  6. ErisPulse/CLI/cli.pyi +80 -0
  7. ErisPulse/CLI/commands/__init__.py +6 -0
  8. ErisPulse/CLI/commands/__init__.pyi +12 -0
  9. ErisPulse/CLI/commands/init.py +395 -0
  10. ErisPulse/CLI/commands/init.pyi +70 -0
  11. ErisPulse/CLI/commands/install.py +302 -0
  12. ErisPulse/CLI/commands/install.pyi +58 -0
  13. ErisPulse/CLI/commands/list.py +160 -0
  14. ErisPulse/CLI/commands/list.pyi +44 -0
  15. ErisPulse/CLI/commands/list_remote.py +123 -0
  16. ErisPulse/CLI/commands/list_remote.pyi +35 -0
  17. ErisPulse/CLI/commands/run.py +108 -0
  18. ErisPulse/CLI/commands/run.pyi +39 -0
  19. ErisPulse/CLI/commands/self_update.py +232 -0
  20. ErisPulse/CLI/commands/self_update.pyi +47 -0
  21. ErisPulse/CLI/commands/uninstall.py +32 -0
  22. ErisPulse/CLI/commands/uninstall.pyi +24 -0
  23. ErisPulse/CLI/commands/upgrade.py +56 -0
  24. ErisPulse/CLI/commands/upgrade.pyi +25 -0
  25. ErisPulse/CLI/console.pyi +20 -0
  26. ErisPulse/CLI/registry.py +112 -0
  27. ErisPulse/CLI/registry.pyi +99 -0
  28. ErisPulse/{utils → CLI/utils}/__init__.py +2 -6
  29. ErisPulse/CLI/utils/__init__.pyi +14 -0
  30. ErisPulse/{utils → CLI/utils}/package_manager.py +146 -20
  31. ErisPulse/CLI/utils/package_manager.pyi +241 -0
  32. ErisPulse/{utils → CLI/utils}/reload_handler.py +7 -8
  33. ErisPulse/CLI/utils/reload_handler.pyi +64 -0
  34. ErisPulse/Core/Bases/__init__.pyi +14 -0
  35. ErisPulse/Core/Bases/adapter.py +13 -1
  36. ErisPulse/Core/Bases/adapter.pyi +140 -0
  37. ErisPulse/Core/Bases/manager.py +136 -0
  38. ErisPulse/Core/Bases/manager.pyi +108 -0
  39. ErisPulse/Core/Bases/module.py +53 -1
  40. ErisPulse/Core/Bases/module.pyi +95 -0
  41. ErisPulse/Core/Event/__init__.pyi +26 -0
  42. ErisPulse/Core/Event/base.pyi +62 -0
  43. ErisPulse/Core/Event/command.py +6 -1
  44. ErisPulse/Core/Event/command.pyi +113 -0
  45. ErisPulse/Core/Event/exceptions.pyi +43 -0
  46. ErisPulse/Core/Event/message.pyi +93 -0
  47. ErisPulse/Core/Event/meta.pyi +92 -0
  48. ErisPulse/Core/Event/notice.pyi +108 -0
  49. ErisPulse/Core/Event/request.pyi +76 -0
  50. ErisPulse/Core/Event/wrapper.py +2 -3
  51. ErisPulse/Core/Event/wrapper.pyi +403 -0
  52. ErisPulse/Core/__init__.py +16 -13
  53. ErisPulse/Core/__init__.pyi +16 -0
  54. ErisPulse/Core/_self_config.py +1 -1
  55. ErisPulse/Core/_self_config.pyi +72 -0
  56. ErisPulse/Core/adapter.py +70 -10
  57. ErisPulse/Core/adapter.pyi +246 -0
  58. ErisPulse/Core/config.pyi +70 -0
  59. ErisPulse/Core/exceptions.py +4 -2
  60. ErisPulse/Core/exceptions.pyi +60 -0
  61. ErisPulse/Core/lifecycle.py +15 -1
  62. ErisPulse/Core/lifecycle.pyi +92 -0
  63. ErisPulse/Core/logger.py +21 -15
  64. ErisPulse/Core/logger.pyi +169 -0
  65. ErisPulse/Core/module.py +57 -9
  66. ErisPulse/Core/module.pyi +189 -0
  67. ErisPulse/Core/router.py +13 -5
  68. ErisPulse/Core/router.pyi +120 -0
  69. ErisPulse/Core/storage.py +94 -256
  70. ErisPulse/Core/storage.pyi +220 -0
  71. ErisPulse/__init__.py +35 -1236
  72. ErisPulse/__init__.pyi +22 -0
  73. ErisPulse/__main__.py +1 -1
  74. ErisPulse/__main__.pyi +24 -0
  75. ErisPulse/loaders/__init__.py +22 -0
  76. ErisPulse/loaders/__init__.pyi +21 -0
  77. ErisPulse/loaders/adapter_loader.py +187 -0
  78. ErisPulse/loaders/adapter_loader.pyi +82 -0
  79. ErisPulse/loaders/base_loader.py +162 -0
  80. ErisPulse/loaders/base_loader.pyi +23 -0
  81. ErisPulse/loaders/initializer.py +150 -0
  82. ErisPulse/loaders/initializer.pyi +60 -0
  83. ErisPulse/loaders/module_loader.py +618 -0
  84. ErisPulse/loaders/module_loader.pyi +179 -0
  85. ErisPulse/loaders/strategy.py +129 -0
  86. ErisPulse/loaders/strategy.pyi +90 -0
  87. ErisPulse/sdk.py +435 -0
  88. ErisPulse/sdk.pyi +158 -0
  89. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/METADATA +6 -20
  90. erispulse-2.3.4.dev2.dist-info/RECORD +103 -0
  91. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/licenses/LICENSE +3 -3
  92. ErisPulse/Core/ux.py +0 -635
  93. ErisPulse/utils/cli.py +0 -1097
  94. erispulse-2.3.3.dev0.dist-info/RECORD +0 -35
  95. /ErisPulse/{utils → CLI}/console.py +0 -0
  96. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/WHEEL +0 -0
  97. {erispulse-2.3.3.dev0.dist-info → erispulse-2.3.4.dev2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,179 @@
1
+ # type: ignore
2
+ #
3
+ # Auto-generated type stub for module_loader.py
4
+ # DO NOT EDIT MANUALLY - Generated by generate-type-stubs.py
5
+ #
6
+
7
+ """
8
+ ErisPulse 模块加载器
9
+
10
+ 专门用于从 PyPI 包加载和初始化普通模块
11
+
12
+ {!--< tips >!--}
13
+ 1. 模块必须通过 entry-points 机制注册到 erispulse.module 组
14
+ 2. 模块类名应与 entry-point 名称一致
15
+ 3. 模块支持懒加载机制
16
+ {!--< /tips >!--}
17
+ """
18
+
19
+ import sys
20
+ import asyncio
21
+ import inspect
22
+ import importlib.metadata
23
+ from typing import Dict, List, Any, Tuple, Type, TYPE_CHECKING
24
+ from .base_loader import BaseLoader
25
+ from ..Core.logger import logger
26
+ from ..Core.lifecycle import lifecycle
27
+
28
+ class ModuleLoader(BaseLoader):
29
+ """
30
+ 模块加载器
31
+
32
+ 负责从 PyPI entry-points 加载模块,支持懒加载
33
+
34
+ {!--< tips >!--}
35
+ 使用方式:
36
+ >>> loader = ModuleLoader()
37
+ >>> module_objs, enabled, disabled = await loader.load(module_manager)
38
+ {!--< /tips >!--}
39
+ """
40
+ def __init__(self: None) -> ...:
41
+ """
42
+ 初始化模块加载器
43
+ """
44
+ ...
45
+ def _get_entry_point_group(self: object) -> str:
46
+ """
47
+ 获取 entry-point 组名
48
+
49
+ :return: "erispulse.module"
50
+ """
51
+ ...
52
+ async def _process_entry_point(self: object, entry_point: Any, objs: Dict[(str, Any)], enabled_list: List[str], disabled_list: List[str], manager_instance: Any) -> Tuple[(Dict[(str, Any)], List[str], List[str])]:
53
+ """
54
+ 处理单个模块 entry-point
55
+
56
+ :param entry_point: entry-point 对象
57
+ :param objs: 模块对象字典
58
+ :param enabled_list: 启用的模块列表
59
+ :param disabled_list: 停用的模块列表
60
+ :param manager_instance: 模块管理器实例
61
+
62
+ :return:
63
+ Dict[str, Any]: 更新后的模块对象字典
64
+ List[str]: 更新后的启用模块列表
65
+ List[str]: 更新后的禁用模块列表
66
+
67
+ :raises ImportError: 当模块加载失败时抛出
68
+ """
69
+ ...
70
+ async def register_to_manager(self: object, modules: List[str], module_objs: Dict[(str, Any)], manager_instance: Any) -> bool:
71
+ """
72
+ 将模块类注册到管理器
73
+
74
+ :param modules: 模块名称列表
75
+ :param module_objs: 模块对象字典
76
+ :param manager_instance: 模块管理器实例
77
+ :return: 模块注册是否成功
78
+
79
+ {!--< tips >!--}
80
+ 此方法由初始化协调器调用,仅注册模块类,不进行实例化
81
+ {!--< /tips >!--}
82
+ """
83
+ ...
84
+ async def initialize_modules(self: object, modules: List[str], module_objs: Dict[(str, Any)], manager_instance: Any, sdk_instance: Any) -> bool:
85
+ """
86
+ 初始化模块(创建实例并挂载到 SDK)
87
+
88
+ :param modules: 模块名称列表
89
+ :param module_objs: 模块对象字典
90
+ :param manager_instance: 模块管理器实例
91
+ :param sdk_instance: SDK 实例
92
+ :return: 模块初始化是否成功
93
+
94
+ {!--< tips >!--}
95
+ 此方法处理模块的实际初始化和挂载
96
+ {!--< /tips >!--}
97
+
98
+ 并行注册所有模块类(已在 register_to_manager 中完成)
99
+ 这里处理模块的实例化和挂载
100
+ """
101
+ ...
102
+
103
+ class LazyModule:
104
+ """
105
+ 懒加载模块包装器
106
+
107
+ 当模块第一次被访问时才进行实例化
108
+
109
+ {!--< tips >!--}
110
+ 1. 模块的实际实例化会在第一次属性访问时进行
111
+ 2. 依赖模块会在被使用时自动初始化
112
+ 3. 对于继承自 BaseModule 的模块,会自动调用生命周期方法
113
+ {!--< /tips >!--}
114
+ """
115
+ def __init__(self: None, module_name: str, module_class: Type, sdk_ref: Any, module_info: Dict[(str, Any)], manager_instance: Any) -> None:
116
+ """
117
+ 初始化懒加载包装器
118
+
119
+ :param module_name: str 模块名称
120
+ :param module_class: Type 模块类
121
+ :param sdk_ref: Any SDK 引用
122
+ :param module_info: Dict[str, Any] 模块信息字典
123
+ :param manager_instance: 模块管理器实例
124
+ """
125
+ ...
126
+ def __getattr__(self: object, name: str) -> Any:
127
+ """
128
+ 属性访问时触发初始化
129
+
130
+ :param name: str 属性名
131
+ :return: Any 属性值
132
+ """
133
+ ...
134
+ def __setattr__(self: object, name: str, value: Any) -> None:
135
+ """
136
+ 属性设置
137
+
138
+ :param name: str 属性名
139
+ :param value: Any 属性值
140
+ """
141
+ ...
142
+ def __delattr__(self: object, name: str) -> None:
143
+ """
144
+ 属性删除
145
+
146
+ :param name: str 属性名
147
+ """
148
+ ...
149
+ def __getattribute__(self: object, name: str) -> Any:
150
+ """
151
+ 属性访问,初始化后直接委托给实际实例
152
+
153
+ :param name: str 属性名
154
+ :return: Any 属性值
155
+ """
156
+ ...
157
+ def __dir__(self: object) -> List[str]:
158
+ """
159
+ 返回模块属性列表
160
+
161
+ :return: List[str] 属性列表
162
+ """
163
+ ...
164
+ def __repr__(self: object) -> str:
165
+ """
166
+ 返回模块表示字符串
167
+
168
+ :return: str 表示字符串
169
+ """
170
+ ...
171
+ def __call__(self: object, *args: ..., **kwargs: ...) -> ...:
172
+ """
173
+ 代理函数调用
174
+
175
+ :param args: 位置参数
176
+ :param kwargs: 关键字参数
177
+ :return: 调用结果
178
+ """
179
+ ...
@@ -0,0 +1,129 @@
1
+ """
2
+ ErisPulse 模块加载策略
3
+
4
+ 提供统一的模块加载策略配置类
5
+
6
+ {!--< tips >!--}
7
+ 1. 所有属性统一处理,没有预定义字段
8
+ 2. 支持通过构造函数传入任意参数
9
+ 3. 支持字典方式创建
10
+ {!--< /tips >!--}
11
+ """
12
+
13
+ from typing import Any, Dict, Union
14
+
15
+
16
+ class ModuleLoadStrategy:
17
+ """
18
+ 模块加载策略配置
19
+
20
+ 所有属性统一处理,通过魔术方法实现动态访问
21
+ 没有预定义属性,完全由用户传入的内容决定
22
+
23
+ {!--< tips >!--}
24
+ 使用方式:
25
+ >>> strategy = ModuleLoadStrategy(
26
+ ... lazy_load=False,
27
+ ... priority=100,
28
+ ... custom_option=123
29
+ ... )
30
+
31
+ eager_load 也是一个合法的属性,但不建议使用,其的han'y
32
+ >>> strategy.lazy_load
33
+ False
34
+ >>> strategy.priority
35
+ 100
36
+ >>> strategy.custom_option
37
+ 123
38
+
39
+ 从字典创建:
40
+ >>> config = {"lazy_load": False, "priority": 100}
41
+ >>> strategy = ModuleLoadStrategy.from_dict(config)
42
+ {!--< /tips >!--}
43
+ """
44
+
45
+ def __init__(self, **kwargs):
46
+ """
47
+ 初始化策略,所有参数统一存储
48
+
49
+ :param kwargs: 策略配置项,任意键值对
50
+
51
+ {!--< tips >!--}
52
+ 常用配置项:
53
+ - lazy_load: bool, 是否懒加载(默认 True)
54
+ - priority: int, 加载优先级(默认 0,数值越大优先级越高)
55
+ {!--< /tips >!--}
56
+ """
57
+ object.__setattr__(self, '_data', kwargs)
58
+
59
+ def __getattr__(self, name: str) -> Any:
60
+ """
61
+ 获取属性值
62
+
63
+ :param name: 属性名
64
+ :return: 属性值,如果不存在则返回 None
65
+
66
+ {!--< internal-use >!--}
67
+ 内部方法,用于动态属性访问
68
+ {!--< /internal-use >!--}
69
+ """
70
+ if name.startswith('_'):
71
+ raise AttributeError(f"'{type(self).__name__}' has no attribute '{name}'")
72
+ data = object.__getattribute__(self, '_data')
73
+ if name not in data:
74
+ return None
75
+ return data[name]
76
+
77
+ def __setattr__(self, name: str, value: Any) -> Any:
78
+ """
79
+ 设置属性值
80
+
81
+ :param name: 属性名
82
+ :param value: 属性值
83
+
84
+ {!--< internal-use >!--}
85
+ 内部方法,用于动态属性设置
86
+ {!--< /internal-use >!--}
87
+ """
88
+ if name.startswith('_'):
89
+ object.__setattr__(self, name, value)
90
+ else:
91
+ self._data[name] = value
92
+
93
+ def __contains__(self, name: str) -> bool:
94
+ """
95
+ 检查属性是否存在
96
+
97
+ :param name: 属性名
98
+ :return: 是否存在该属性
99
+ """
100
+ return name in self._data
101
+
102
+ def __repr__(self) -> str:
103
+ """
104
+ 返回策略的字符串表示
105
+
106
+ :return: 字符串表示
107
+ """
108
+ return f"ModuleLoadStrategy({self._data})"
109
+
110
+ @classmethod
111
+ def from_dict(cls, config: Dict[str, Any]) -> 'ModuleLoadStrategy':
112
+ """
113
+ 从字典创建策略实例
114
+
115
+ :param config: 配置字典
116
+ :return: 策略实例
117
+
118
+ {!--< tips >!--}
119
+ 示例:
120
+ >>> config = {"lazy_load": False, "priority": 100}
121
+ >>> strategy = ModuleLoadStrategy.from_dict(config)
122
+ {!--< /tips >!--}
123
+ """
124
+ return cls(**config)
125
+
126
+
127
+ __all__ = [
128
+ "ModuleLoadStrategy"
129
+ ]
@@ -0,0 +1,90 @@
1
+ # type: ignore
2
+ #
3
+ # Auto-generated type stub for strategy.py
4
+ # DO NOT EDIT MANUALLY - Generated by generate-type-stubs.py
5
+ #
6
+
7
+ """
8
+ ErisPulse 模块加载策略
9
+
10
+ 提供统一的模块加载策略配置类
11
+
12
+ {!--< tips >!--}
13
+ 1. 所有属性统一处理,没有预定义字段
14
+ 2. 支持通过构造函数传入任意参数
15
+ 3. 支持字典方式创建
16
+ {!--< /tips >!--}
17
+ """
18
+
19
+ from typing import Any, Dict, Union
20
+
21
+ class ModuleLoadStrategy:
22
+ """
23
+ 模块加载策略配置
24
+
25
+ 所有属性统一处理,通过魔术方法实现动态访问
26
+ 没有预定义属性,完全由用户传入的内容决定
27
+
28
+ {!--< tips >!--}
29
+ 使用方式:
30
+ >>> strategy = ModuleLoadStrategy(
31
+ ... lazy_load=False,
32
+ ... priority=100,
33
+ ... custom_option=123
34
+ ... )
35
+
36
+ eager_load 也是一个合法的属性,但不建议使用,其的han'y
37
+ >>> strategy.lazy_load
38
+ False
39
+ >>> strategy.priority
40
+ 100
41
+ >>> strategy.custom_option
42
+ 123
43
+
44
+ 从字典创建:
45
+ >>> config = {"lazy_load": False, "priority": 100}
46
+ >>> strategy = ModuleLoadStrategy.from_dict(config)
47
+ {!--< /tips >!--}
48
+ """
49
+ def __init__(self: None, **kwargs: ...) -> ...:
50
+ """
51
+ 初始化策略,所有参数统一存储
52
+
53
+ :param kwargs: 策略配置项,任意键值对
54
+
55
+ {!--< tips >!--}
56
+ 常用配置项:
57
+ - lazy_load: bool, 是否懒加载(默认 True)
58
+ - priority: int, 加载优先级(默认 0,数值越大优先级越高)
59
+ {!--< /tips >!--}
60
+ """
61
+ ...
62
+ def __contains__(self: object, name: str) -> bool:
63
+ """
64
+ 检查属性是否存在
65
+
66
+ :param name: 属性名
67
+ :return: 是否存在该属性
68
+ """
69
+ ...
70
+ def __repr__(self: object) -> str:
71
+ """
72
+ 返回策略的字符串表示
73
+
74
+ :return: 字符串表示
75
+ """
76
+ ...
77
+ def from_dict(cls: object, config: Dict[(str, Any)]) -> ModuleLoadStrategy:
78
+ """
79
+ 从字典创建策略实例
80
+
81
+ :param config: 配置字典
82
+ :return: 策略实例
83
+
84
+ {!--< tips >!--}
85
+ 示例:
86
+ >>> config = {"lazy_load": False, "priority": 100}
87
+ >>> strategy = ModuleLoadStrategy.from_dict(config)
88
+ {!--< /tips >!--}
89
+ """
90
+ ...