您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

tool_file_parser.py 585B

12345678910111213141516171819
  1. from collections.abc import Callable
  2. from typing import TYPE_CHECKING
  3. if TYPE_CHECKING:
  4. from core.tools.tool_file_manager import ToolFileManager
  5. _tool_file_manager_factory: Callable[[], "ToolFileManager"] | None = None
  6. class ToolFileParser:
  7. @staticmethod
  8. def get_tool_file_manager() -> "ToolFileManager":
  9. assert _tool_file_manager_factory is not None
  10. return _tool_file_manager_factory()
  11. def set_tool_file_manager_factory(factory: Callable[[], "ToolFileManager"]) -> None:
  12. global _tool_file_manager_factory
  13. _tool_file_manager_factory = factory