refactor: restructure main_clean.py with dependency injection and interfaces
Refactor discrete material cleaner to improve maintainability and testability: - Introduce dependency injection pattern for service components - Add interfaces (IPageNavigator, IMaterialExtractor, IDeletionChecker) - Extract PageNavigator service for page navigation logic - Extract MaterialExtractor service for data extraction - Extract DatabaseDeletionChecker service for deletion logic - Add MaterialInfo data model for structured data - Centralize configuration (CleanerConfig, UIConstants) - Implement separation of concerns across services layer Also includes comprehensive execution mechanism documentation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
24
interfaces/i_deletion_checker.py
Normal file
24
interfaces/i_deletion_checker.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
删除判断接口
|
||||
定义判断物料是否需要删除的抽象接口
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from models.material_info import MaterialInfo
|
||||
|
||||
|
||||
class IDeletionChecker(ABC):
|
||||
"""删除判断接口"""
|
||||
|
||||
@abstractmethod
|
||||
def should_delete(self, material: MaterialInfo) -> bool:
|
||||
"""
|
||||
判断物料是否需要删除
|
||||
|
||||
Args:
|
||||
material: 物料信息对象
|
||||
|
||||
Returns:
|
||||
是否需要删除
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user