From dcadac73813291a86a4ab3aca44706fc9b8e3b5e Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Wed, 26 Jun 2024 09:20:15 +0800 Subject: chore(docs): add structures.svg and contributing guidance --- .vscode/settings.json | 3 ++- CONTRIBUTING.rst | 8 +++++++ docs/_static/.$Structures.svg.bkp | 42 +++++++++++++++++++++++++++++++++++++ docs/_static/.$Structures.svg.dtmp | 4 ++++ docs/_static/Structures.svg | 4 ++++ docs/source/index.rst | 8 +++---- docs/source/pages/contributing.rst | 2 +- hrc/__init__.py | 2 ++ hrc/rule_package.py | 0 hrc/rules/BaseRule/CharacterCard.py | 22 +++++++++++++++++++ hrc/rules/BaseRule/__init__.py | 13 +----------- hrc/rules/__init__.py | 12 ++++++++++- hrc/rules/py.typed | 0 hrc/typing.py | 7 +++++++ tests/test_BRP_pdfquery.py | 2 +- tests/test_BaseRule.py | 28 ++++++++++++++++++++----- 16 files changed, 132 insertions(+), 25 deletions(-) create mode 100644 CONTRIBUTING.rst create mode 100644 docs/_static/.$Structures.svg.bkp create mode 100644 docs/_static/.$Structures.svg.dtmp create mode 100644 docs/_static/Structures.svg delete mode 100644 hrc/rule_package.py create mode 100644 hrc/rules/BaseRule/CharacterCard.py create mode 100644 hrc/rules/py.typed diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e5ca18..414a2fa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "restructuredtext.preview.name": "sphinx", - "iis.configDir": "" + "iis.configDir": "", + "livePreview.defaultPreviewPath": "/docs/_build/html/index.html" } \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..8cd8d29 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,8 @@ +CONTRIBUTING +============ + +How to commit with PullRequest? +------------------------------- + +How to open an issue? +--------------------- \ No newline at end of file diff --git a/docs/_static/.$Structures.svg.bkp b/docs/_static/.$Structures.svg.bkp new file mode 100644 index 0000000..723359b --- /dev/null +++ b/docs/_static/.$Structures.svg.bkp @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/_static/.$Structures.svg.dtmp b/docs/_static/.$Structures.svg.dtmp new file mode 100644 index 0000000..26247d9 --- /dev/null +++ b/docs/_static/.$Structures.svg.dtmp @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/docs/_static/Structures.svg b/docs/_static/Structures.svg new file mode 100644 index 0000000..674f55e --- /dev/null +++ b/docs/_static/Structures.svg @@ -0,0 +1,4 @@ + + + +
Orgchart
Orgchart
Tessa Miller
CFO
Email
Tessa Miller...
Edward Morrison
Brand Manager
Email
Edward Morrison...
Evan Valet
HR Director
Email
Evan Valet...
Alison Donovan
System Admin
Email
Alison Donovan...
Text is not SVG - cannot display
\ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index efda5f6..8f98453 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,7 +1,7 @@ .. hide-toc: true HydroRollCore -========= +============== .. include:: ../../README.rst :start-after: .. index-start @@ -11,13 +11,13 @@ HydroRollCore .. toctree:: :hidden: - Quick start + 快速开始 .. toctree:: :caption: Development :hidden: - CONTRIBUTING - CHANGELOG + 贡献指南 + 变更日志 COPYING \ No newline at end of file diff --git a/docs/source/pages/contributing.rst b/docs/source/pages/contributing.rst index 64b74a9..4e5383d 100644 --- a/docs/source/pages/contributing.rst +++ b/docs/source/pages/contributing.rst @@ -1 +1 @@ -.. include:: ../../../CONTRIBUTING.md \ No newline at end of file +.. include:: ../../../CONTRIBUTING.rst \ No newline at end of file diff --git a/hrc/__init__.py b/hrc/__init__.py index 6c6b22c..b8a3bde 100644 --- a/hrc/__init__.py +++ b/hrc/__init__.py @@ -1,2 +1,4 @@ from .LibCore import * + from . import rules +# from . import \ No newline at end of file diff --git a/hrc/rule_package.py b/hrc/rule_package.py deleted file mode 100644 index e69de29..0000000 diff --git a/hrc/rules/BaseRule/CharacterCard.py b/hrc/rules/BaseRule/CharacterCard.py new file mode 100644 index 0000000..6d09e5a --- /dev/null +++ b/hrc/rules/BaseRule/CharacterCard.py @@ -0,0 +1,22 @@ +import dataclasses +from dataclasses import dataclass +from typing import Literal, Optional, Union + + +@dataclass +class Custom(object): + """Docstring for Custom.""" + property: type + + +class Attribute(Custom): + ... + + +class Skill(Custom): + ... + + +class Information(Custom): + ... + diff --git a/hrc/rules/BaseRule/__init__.py b/hrc/rules/BaseRule/__init__.py index 4d3bc9d..c30e24a 100644 --- a/hrc/rules/BaseRule/__init__.py +++ b/hrc/rules/BaseRule/__init__.py @@ -3,18 +3,7 @@ from dataclasses import dataclass from typing import Literal, Optional, Union from . import JudgeRule - -@dataclass -class CharacterCard(object): - """Docstring for CharacterCard.""" - property: type - - class Information(object): - age: Optional[Union[int, str]] - race: Optional[str] - gender: Optional[str] - group: Optional[str] - +from . import CharacterCard @dataclass class CustomRule(object): diff --git a/hrc/rules/__init__.py b/hrc/rules/__init__.py index be96d47..ccd3dbc 100644 --- a/hrc/rules/__init__.py +++ b/hrc/rules/__init__.py @@ -1 +1,11 @@ -from . import BaseRule \ No newline at end of file +from typing import Generic, Any, Type + +from abc import ABC + +from . import BaseRule +from ..typing import RulesT + + +class Rules(ABC, Generic[RulesT]): + ... + \ No newline at end of file diff --git a/hrc/rules/py.typed b/hrc/rules/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/hrc/typing.py b/hrc/typing.py index e69de29..b3ced30 100644 --- a/hrc/typing.py +++ b/hrc/typing.py @@ -0,0 +1,7 @@ +from typing import TypeVar, Generic, Any, TYPE_CHECKING, Awaitable, Callable, Optional + +if TYPE_CHECKING: + from .rules import Rules + + +RulesT = TypeVar("RulesT", bound="Rules[Any]") \ No newline at end of file diff --git a/tests/test_BRP_pdfquery.py b/tests/test_BRP_pdfquery.py index 453e471..bda7bd1 100644 --- a/tests/test_BRP_pdfquery.py +++ b/tests/test_BRP_pdfquery.py @@ -3,4 +3,4 @@ from pdfquery import PDFQuery pdf = PDFQuery("../rule_book/BRP SRD 1.0 CHN.pdf") pdf.load() -print(pdf.get_page(1)) +print([dir(x) for x in dir(pdf.get_page(1))]) diff --git a/tests/test_BaseRule.py b/tests/test_BaseRule.py index f450c28..da5ac93 100644 --- a/tests/test_BaseRule.py +++ b/tests/test_BaseRule.py @@ -57,13 +57,31 @@ __rule_book__ = "BASIC ROLEPLAYING" # ============================================== # MyRule -from hrc.rules.BaseRule import JudgeRule +import hrc +from hrc.rules import BaseRule, Rules +from hrc.rules.BaseRule import CharacterCard, JudgeRule -class JudgeAttr(JudgeRule.Attribute): - """来自判定规则 - 属性判定 - 属性判定规则(模式)""" +class JudgeAttr(JudgeRule.Attribute): + """属性判定规则""" class JudgeCustom(JudgeRule.Custom): - ... + """自定义判定规则""" + + +class ChaAttr(CharacterCard.Attribute): + """人物卡属性列表""" + + +class ChaSkill(CharacterCard.Skill): + """人物卡技能列表""" + + +class ThePool(Rules[JudgeAttr, JudgeCustom]): + """规则包[池]""" + + __config__ = 'ThePool' + + + \ No newline at end of file -- cgit v1.2.3-70-g09d2