Files
AppAutoTest/utils/decorators.py
CNWei 2e98252e34 refactor: 优化 CoreDriver 实现并增强代码可读性
- 优化 部分核心功能实现。
- 新增 详细的文档字符串(Docstrings)和注释。
- 移除 代码中的冗余注释和无效代码。
2026-01-22 15:44:28 +08:00

20 lines
714 B
Python

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