aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/conventionalrp/extractors
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2025-10-25 00:30:48 +0800
committer简律纯 <i@jyunko.cn>2025-10-25 00:30:48 +0800
commitcbc653ffd0ea9abf4360623dc7a7651e1a49cc61 (patch)
treeea3c396148158077bae3e77eaa9341f8c1990636 /src/conventionalrp/extractors
parent08299b37dfda86e56e4f2b442f68ccd2da7a82e3 (diff)
downloadconventional_role_play-cbc653ffd0ea9abf4360623dc7a7651e1a49cc61.tar.gz
conventional_role_play-cbc653ffd0ea9abf4360623dc7a7651e1a49cc61.zip
feat: Implement plugin system with combat tracker and dice analyzer
- Added `plugin_system_demo.py` to demonstrate basic plugin usage, processing, and analysis. - Created `CombatTrackerPlugin` for tracking combat statistics including damage and healing. - Developed `DiceAnalyzerPlugin` for analyzing dice rolls and calculating success rates. - Introduced `renderer_demo.py` for rendering output in HTML, Markdown, and JSON formats. - Implemented `rule_system_demo.py` to showcase rule engine capabilities with various examples. - Established core rule engine functionality in `rules.py` with support for conditions and actions. - Enhanced base plugin structure in `base.py` to support different plugin types (Processor, Renderer, Analyzer). - Added custom exception handling in `exceptions.py` for better error management. - Configured logging setup in `logging_config.py` for improved logging capabilities. - Created unit tests in `test_rust_core.py` to validate core functionalities and performance.
Diffstat (limited to 'src/conventionalrp/extractors')
-rw-r--r--src/conventionalrp/extractors/__init__.py3
-rw-r--r--src/conventionalrp/extractors/rule_extractor.py25
2 files changed, 0 insertions, 28 deletions
diff --git a/src/conventionalrp/extractors/__init__.py b/src/conventionalrp/extractors/__init__.py
index e693e03..e69de29 100644
--- a/src/conventionalrp/extractors/__init__.py
+++ b/src/conventionalrp/extractors/__init__.py
@@ -1,3 +0,0 @@
-"""
-This file initializes the extractors module.
-"""
diff --git a/src/conventionalrp/extractors/rule_extractor.py b/src/conventionalrp/extractors/rule_extractor.py
index bfc60c8..12b9e4b 100644
--- a/src/conventionalrp/extractors/rule_extractor.py
+++ b/src/conventionalrp/extractors/rule_extractor.py
@@ -15,12 +15,6 @@ class RuleExtractor(BaseExtractor):
"""规则提取器,用于从配置文件加载解析规则"""
def __init__(self, config_file: Optional[str] = None):
- """
- 初始化规则提取器
-
- Args:
- config_file: 规则配置文件路径(可选)
- """
self.config_file = config_file
self.rules: Dict[str, Any] = {}
if config_file:
@@ -29,16 +23,6 @@ class RuleExtractor(BaseExtractor):
def load_rules_from_file(self, config_file: str) -> Dict[str, Any]:
"""
从文件加载规则
-
- Args:
- config_file: 规则配置文件路径
-
- Returns:
- 解析后的规则字典
-
- Raises:
- FileNotFoundError: 文件不存在
- ValueError: 文件内容为空或格式错误
"""
if not Path(config_file).exists():
raise FileNotFoundError(f"Rule file not found: {config_file}")
@@ -56,12 +40,6 @@ class RuleExtractor(BaseExtractor):
def load_rules(self, config_file: str) -> Dict[str, Any]:
"""
加载规则(兼容旧接口)
-
- Args:
- config_file: 规则配置文件路径
-
- Returns:
- 解析后的规则字典
"""
self.rules = self.load_rules_from_file(config_file)
return self.rules
@@ -69,8 +47,5 @@ class RuleExtractor(BaseExtractor):
def extract(self) -> Dict[str, Any]:
"""
提取规则
-
- Returns:
- 规则字典
"""
return self.rules