MCPcopy Create free account
hub / github.com/modelscope/ms-agent / _get_resource_path

Method _get_resource_path

ms_agent/skill/schema.py:472–489  ·  view source on GitHub ↗

Get path string for a resource file. Tries relative path first, falls back to absolute path. Args: file_path: Path to the resource file. Returns: Path string (relative if possible, absolute otherwise).

(self, file_path: Path)

Source from the content-addressed store, hash-verified

470 ]
471
472 def _get_resource_path(self, file_path: Path) -> str:
473 """
474 Get path string for a resource file.
475
476 Tries relative path first, falls back to absolute path.
477
478 Args:
479 file_path: Path to the resource file.
480
481 Returns:
482 Path string (relative if possible, absolute otherwise).
483 """
484 resolved_path = file_path.resolve()
485 try:
486 return str(resolved_path.relative_to(self.root_path.resolve()))
487 except ValueError:
488 # Path is not under root_path, use absolute path
489 return str(resolved_path)
490
491 def load_scripts(self, names: List[str] = None) -> List[Dict[str, Any]]:
492 """

Callers 3

load_scriptsMethod · 0.95
load_referencesMethod · 0.95
load_resourcesMethod · 0.95

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected