Skip to content

Commit 6947087

Browse files
authored
Merge pull request #105 from HowieHz/dev
1.7.0
2 parents 994dc97 + fe58f2f commit 6947087

File tree

124 files changed

+1557
-1104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1557
-1104
lines changed

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ __pycache__/
33
.vscode/
44
.cspell/
55
Output/
6-
Setting/
7-
PythonJava混合编程支持/
8-
可选文件/
9-
必须文件/
6+
Settings/
107
点我启动.exe
118
NoWinRun.exe
129
Log/
1310
out/
1411
report/
15-
*.ps1
16-
*.bat
1712
*.py[cod]
1813
*$py.class
1914
*.fbp
2015
.history/
16+
packing_must/
17+
packing_extra/
2118

2219

2320
# C extensions

.idea/hpyculator.iml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法太累了,要是能像加载Minecraft的mod一样加载算法就好了” 这样的想法
1616

1717
[各类数组程序V1.2](https://www.bilibili.com/video/BV18p4y1h7bQ)的基础上开发而来
18-
19-
欢迎提pr和issue
2018

2119
>本项目基于python3.10构建
2220
@@ -26,29 +24,13 @@ hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法
2624

2725
2.写了一个小工具,这时候只需要添加一个包含一些数据的字典和一个函数,就可以把它变成一个hpyculator插件来使用
2826

29-
## 快速开始
30-
31-
### 用户
32-
33-
1.从github的[releases](https://github.com/HowieHz/hpyculator/releases)下载最新版本
34-
35-
2.解压,双击目录下的__main__.exe
36-
37-
3.去[插件市场](https://github.com/HowieHz/hpyculatorPluginCatalogue)下点插件就能愉快的使用了
38-
39-
(程序内置插件,可直接使用)
40-
41-
### 开发者(开发插件)
42-
43-
从github的releases下载最新版本
44-
45-
然后到[插件开发](https://hpyculator.readthedocs.io/zh_CN/latest/plugin_dev/index.html)页面查看详情
46-
47-
### 开发者(程序)
27+
## 开始
4828

49-
从github项目src文件夹获取源码
29+
- **用户手册**: [UserManual](docs/UserManual.md)
30+
- 开发文档: [开发插件](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id3)[参与到此项目](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id9)
31+
- 更新日志: [release](https://github.com/HowieHz/hpyculator/releases)[changelog](https://hpyculator.readthedocs.io/zh_CN/latest/changelog.html)
5032

51-
前往 [文档](https://hpyculator.readthedocs.io/zh_CN/latest/quick_start.html#id9) 查看简单部署流程
33+
[//]: # (- 开发计划: [milestones](https://github.com/HowieHz/hpyculator/milestones))
5234

5335
## 插件
5436

@@ -64,7 +46,7 @@ hpyculator(下文简称hpyc),是我怀揣着 “一个一个添加算法
6446

6547
## 其他
6648

67-
欢迎提issue和pr
49+
遇到问题或者有对项目发展的建议欢迎提issue
6850

6951
## 鸣谢
7052

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## 装依赖
88

9-
毋庸置疑python3是必须的
9+
毋庸置疑python3.10是必须的
1010

1111
确保你cmd的工作目录为docs
1212

docs/source/changelog.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,26 @@
88
Fixed - 解决的问题
99
Others - 性能优化和安全性增强等改进
1010

11-
v1.6.4(草稿)
11+
v1.7.1
12+
13+
计划
14+
创建cli应用程序hpyc_cli
15+
完成hpyc_core模块的test
16+
17+
v1.7.0
1218

1319
Added
14-
打表模式,每次输出后添加一个","
15-
common_factor_hz,pluperfect_digital_invariant_hz插件
20+
分离核心为hpyc_core
21+
分离基于pyside6的ui为hpyc_pyside_ui
22+
完成文档关于API的说明
23+
hpyc_pyside_ui新增打表模式,每次输出后添加一个","
24+
新增common_factor_hz,pluperfect_digital_invariant_hz插件
1625
Changed
17-
内置文档对于打表模式做出了解释
18-
文档更新,对于元数据进行了更详细的说明
26+
多处文档更新
1927
插件更新
28+
Removed
29+
移除了output_without_line_break
30+
移除了hpyc.RETURN_ITERABLE_OUTPUT_IN_ONE_LINE
2031
Others
2132
代码性能优化(尽可能多的使用元组)
2233
结构优化,并补充注释,类型表示

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = "HowieHz"
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "v1.6.1"
25+
release = "v1.7.0"
2626

2727
# -- General configuration ---------------------------------------------------
2828

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
创建核心实例
2+
=============================================
3+
首先确保你安装了 ``hpyc_core`` 模块
4+
5+
.. code-block:: bash
6+
7+
pip install hpyc_core
8+
9+
接下来创建核心实例
10+
11+
.. code-block:: python
12+
13+
from hpyc_core import Core
14+
instance_core = Core(output_dir_path: Optional[str] = None, # 输出目录
15+
settings_dir_path: Optional[str] = None, # 设置文件所在目录
16+
plugins_dir_path: Optional[str] = None, # 插件存放目录
17+
settings_file_name: str = "hpyculator_setting", # 设置文件名
18+
settings_file_format: str = "json",) # 设置文件格式
19+
20+
.. list-table:: 选取顺序: 输入 > 设置文件 > 默认值!
21+
:widths: 20 20 45 20
22+
:header-rows: 1
23+
24+
* - 参数
25+
- 设置文件中对应键
26+
- 默认值
27+
- 数据要求
28+
* - output_dir_path
29+
- "output_dir_path"
30+
- str(os.path.join(os.getcwd(), "Output"))
31+
- 字符串类型
32+
* - settings_dir_path
33+
- 无
34+
- str(os.path.join(os.getcwd(), "Settings"))
35+
- 字符串类型
36+
* - plugins_dir_path
37+
- "plugins_dir_path"
38+
- str(os.path.join(os.getcwd(), "Plugin"))
39+
- 字符串类型
40+
* - settings_file_name
41+
- 无
42+
- "hpyculator_setting"
43+
- 字符串类型
44+
* - settings_file_format
45+
- 无
46+
- "json"
47+
- "json" | "yaml" | "toml"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
数据结构
2+
==================
3+
可通过 ``from hpyc_core.data_structure import 结构名`` 来获取对应结构
4+
5+
6+
MetadataDict
7+
---------------
8+
插件元数据规定
9+
10+
通过 ``getPluginMetadata`` 获取到的数据类型
11+
12+
.. code-block:: python
13+
14+
class MetadataDict(TypedDict, total=False):
15+
"""插件元数据数据类型"""
16+
17+
input_mode: int
18+
id: str
19+
option: str
20+
version: str
21+
tag: list | str
22+
save_name: str
23+
quantifier: str
24+
output_start: str
25+
output_name: str
26+
author: str | list
27+
help: str
28+
output_end: str
29+
return_mode: int
30+
fullwidth_symbol: int

docs/source/core_api/event.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
事件
2+
=============================================
3+
以下均为 ``hpyc_core.Core`` 的方法
4+
5+
eventStartCalculate
6+
-----------------------
7+
开始计算 (启动计算线程)
8+
9+
.. code-block:: python
10+
11+
eventStartCalculate(self, plugin_id: str, input_data: Any, mode="Return") -> None:
12+
13+
参数说明
14+
- plugin_id: 插件id, 类型 ``str``
15+
- input_data: 未处理的原始输入数据, 类型 ``typing.Any``
16+
- mode: 计算模式, 类型 ``str``
17+
18+
可能引发的异常
19+
- ValueError: 当输入了不存在的mode
20+
21+
mode参数别名
22+
- 运算结果仅返回到消息队列
23+
"ReturnAfterComputing",
24+
"ComputingAndReturn",
25+
"RAC",
26+
"Return",
27+
"ReturnAfterCalculating",
28+
29+
- 运算结果仅保存到文件中
30+
"SaveAfterComputing",
31+
"ComputingAndSave",
32+
"SAC",
33+
"Save",
34+
"SaveAfterCalculating",
35+
36+
- 运算结果从缓冲区中返回到消息队列
37+
"ReturnAfterComputingFromBuffer",
38+
"ComputingAndReturnFromBuffer",
39+
"RACFB",
40+
"ReturnFromBuffer",
41+
"ReturnAfterCalculatingFromBuffer",
42+
43+
- 运算结果从缓冲区中返回到消息队列,但是有返回上限
44+
"ReturnAfterComputingFromLimitedBuffer",
45+
"ComputingAndReturnFromLimitedBuffer",
46+
"RACFLB",
47+
"ReturnFromLimitedBuffer",
48+
"ReturnAfterCalculatingFromLimitedBuffer",
49+
50+
eventReloadPlugins
51+
-----------------------
52+
重新加载插件
53+
54+
.. code-block:: python
55+
56+
def eventReloadPlugins(self) -> None:
57+
58+
eventExit
59+
-----------------------
60+
退出流程,进行一些收尾工作防止进程残留
61+
62+
默认使用atexit模块注册到退出事件
63+
64+
所以一般来说不需要手动触发
65+
66+
.. code-block:: python
67+
68+
def eventExit() -> None:
69+

docs/source/core_api/get.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
获取
2+
=============================================
3+
以下均为 ``hpyc_core.Core`` 的方法
4+
5+
getMessageQueue
6+
-----------------------
7+
获取消息输出队列
8+
9+
.. code-block:: python
10+
11+
def getMessageQueue() -> Queue:
12+
13+
getSettingsFileInstance
14+
-----------------------
15+
获取设置文件实例
16+
17+
.. code-block:: python
18+
19+
def getSettingsFileInstance() -> SettingsFileObject:
20+
21+
getPluginsDirPath
22+
-----------------------
23+
获取插件存放路径
24+
25+
.. code-block:: python
26+
27+
def getMessageQueue() -> str:
28+
29+
getOutputDirPath
30+
-----------------------
31+
获取输出路径
32+
33+
.. code-block:: python
34+
35+
def getOutputDirPath(self) -> str:
36+
37+
getSettingsDirPath
38+
-----------------------
39+
获取设置文件存放路径
40+
41+
.. code-block:: python
42+
43+
def getSettingsDirPath(self) -> str:
44+
45+
getPluginsTagOption
46+
-----------------------
47+
获取所有插件的tag,tag对应插件选项名
48+
49+
(((plugin1_tag1, plugin1_tag2, ...), plugin1_option), ((plugin2_tag1,), plugin2_option)), ...)
50+
51+
.. code-block:: python
52+
53+
def getPluginsTagOption() -> tuple[tuple[tuple[str, ...], str], ...]:
54+
55+
getPluginsOptionToId
56+
-----------------------
57+
获取插件选项名和id的映射表
58+
59+
.. code-block:: python
60+
61+
def getPluginsOptionToId() -> dict[str, str]:
62+
63+
getPluginIdFromOption
64+
-----------------------
65+
通过选项名获得对应插件ID
66+
67+
.. code-block:: python
68+
69+
getPluginIdFromOption(option: str) -> str:
70+
71+
getPluginInstance
72+
-----------------------
73+
获取对应插件实例
74+
75+
.. code-block:: python
76+
77+
def getPluginInstance(plugin_id: str) -> ModuleType:
78+
79+
getPluginMetadata
80+
-----------------------
81+
拖过插件ID获取对应插件元数据
82+
83+
.. code-block:: python
84+
85+
def getPluginMetadata(plugin_id: str) -> MetadataDict:
86+

0 commit comments

Comments
 (0)