refactor: 优化 CoreDriver 实现并增强代码可读性
- 优化 部分核心功能实现。 - 新增 详细的文档字符串(Docstrings)和注释。 - 移除 代码中的冗余注释和无效代码。
This commit is contained in:
20
utils/decorators.py
Normal file
20
utils/decorators.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import logging
|
||||
from functools import wraps
|
||||
from typing import Union, Callable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def resolve_wait_method(func):
|
||||
"""
|
||||
装饰器:将字符串形式的等待条件解析为可调用的 EC 对象
|
||||
"""
|
||||
@wraps(func)
|
||||
def wrapper(self, method: Union[Callable, str], *args, **kwargs):
|
||||
if isinstance(method, str):
|
||||
# TODO: 这里可以接入 custom_ec 字典进行查找
|
||||
# method = custom_ec.get(method, lambda x: False)
|
||||
logger.info(f"解析命名等待条件: '{method}'")
|
||||
# 保持原有逻辑作为占位
|
||||
method = lambda _: False
|
||||
return func(self, method, *args, **kwargs)
|
||||
return wrapper
|
||||
Reference in New Issue
Block a user