MCPcopy Create free account
hub / github.com/NVIDIA/SkillSpector / resolve

Method resolve

src/skillspector/input_handler.py:94–126  ·  view source on GitHub ↗

Resolve input to a scannable directory. Args: input_path: Path or URL to resolve Returns: Tuple of (resolved_path, source_type) source_type is one of: "git", "url", "zip", "file", "directory" Raises: ValueError: If i

(self, input_path: str)

Source from the content-addressed store, hash-verified

92 self._temp_dir: Path | None = None
93
94 def resolve(self, input_path: str) -> tuple[Path, str]:
95 """
96 Resolve input to a scannable directory.
97
98 Args:
99 input_path: Path or URL to resolve
100
101 Returns:
102 Tuple of (resolved_path, source_type)
103 source_type is one of: "git", "url", "zip", "file", "directory"
104
105 Raises:
106 ValueError: If input type cannot be determined
107 FileNotFoundError: If local path doesn't exist
108 """
109 input_path = input_path.strip()
110
111 if self._is_git_url(input_path):
112 return self._clone_git(input_path), "git"
113 if self._is_file_url(input_path):
114 return self._download_file(input_path), "url"
115 if input_path.endswith(".zip"):
116 return self._extract_zip(Path(input_path)), "zip"
117 if input_path.endswith(".md"):
118 return self._wrap_single_file(Path(input_path)), "file"
119 if Path(input_path).is_dir():
120 return Path(input_path).resolve(), "directory"
121 if Path(input_path).is_file():
122 return self._wrap_single_file(Path(input_path)), "file"
123 raise ValueError(
124 f"Cannot determine input type for: {input_path}\n"
125 "Supported formats: Git URL, file URL, .zip file, .md file, or directory"
126 )
127
128 def cleanup(self) -> None:
129 """Clean up temporary files created during resolution."""

Callers 15

resolve_inputFunction · 0.95
test_resolve_directoryFunction · 0.95
test_resolve_zip_fileFunction · 0.95
test_cleanup_idempotentFunction · 0.95
_main_implFunction · 0.80

Calls 6

_is_git_urlMethod · 0.95
_clone_gitMethod · 0.95
_is_file_urlMethod · 0.95
_download_fileMethod · 0.95
_extract_zipMethod · 0.95
_wrap_single_fileMethod · 0.95