mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-05 05:45:10 +00:00
Adjust log level & Add workbench virtual example & Add not action decorator & Add check_mode &
This commit is contained in:
@@ -28,6 +28,7 @@ __all__ = [
|
||||
from ast import Constant
|
||||
|
||||
from unilabos.utils import logger
|
||||
from unilabos.utils.decorator import is_not_action
|
||||
|
||||
|
||||
class ImportManager:
|
||||
@@ -275,6 +276,9 @@ class ImportManager:
|
||||
method_info = self._analyze_method_signature(method)
|
||||
result["status_methods"][actual_name] = method_info
|
||||
elif not name.startswith("_"):
|
||||
# 检查是否被 @not_action 装饰器标记
|
||||
if is_not_action(method):
|
||||
continue
|
||||
# 其他非_开头的方法归类为action
|
||||
method_info = self._analyze_method_signature(method)
|
||||
result["action_methods"][name] = method_info
|
||||
@@ -330,6 +334,9 @@ class ImportManager:
|
||||
if actual_name not in result["status_methods"]:
|
||||
result["status_methods"][actual_name] = method_info
|
||||
else:
|
||||
# 检查是否被 @not_action 装饰器标记
|
||||
if self._is_not_action_method(node):
|
||||
continue
|
||||
# 其他非_开头的方法归类为action
|
||||
result["action_methods"][method_name] = method_info
|
||||
return result
|
||||
@@ -450,6 +457,13 @@ class ImportManager:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _is_not_action_method(self, node: ast.FunctionDef) -> bool:
|
||||
"""检查是否是@not_action装饰的方法"""
|
||||
for decorator in node.decorator_list:
|
||||
if isinstance(decorator, ast.Name) and decorator.id == "not_action":
|
||||
return True
|
||||
return False
|
||||
|
||||
def _get_property_name_from_setter(self, node: ast.FunctionDef) -> str:
|
||||
"""从setter装饰器中获取属性名"""
|
||||
for decorator in node.decorator_list:
|
||||
|
||||
Reference in New Issue
Block a user