From cbc653ffd0ea9abf4360623dc7a7651e1a49cc61 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Sat, 25 Oct 2025 00:30:48 +0800 Subject: 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. --- src/conventionalrp/extractors/__init__.py | 3 --- src/conventionalrp/extractors/rule_extractor.py | 25 ------------------------- 2 files changed, 28 deletions(-) (limited to 'src/conventionalrp/extractors') 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 -- cgit v1.2.3-70-g09d2