MCPcopy
hub / github.com/treeverse/dvc / resolve_output

Function resolve_output

dvc/utils/__init__.py:250–267  ·  view source on GitHub ↗
(inp: str, out: Optional[str], force=False)

Source from the content-addressed store, hash-verified

248
249
250def resolve_output(inp: str, out: Optional[str], force=False) -> str:
251 from urllib.parse import urlparse
252
253 from dvc.exceptions import FileExistsLocallyError
254
255 name = os.path.basename(os.path.normpath(urlparse(inp).path))
256 if not out:
257 ret = name
258 elif os.path.isdir(out):
259 ret = os.path.join(out, name)
260 else:
261 ret = out
262
263 if os.path.exists(ret) and not force:
264 hint = "\nTo override it, re-run with '--force'."
265 raise FileExistsLocallyError(ret, hint=hint)
266
267 return ret
268
269
270def resolve_paths(repo, out, always_local=False):

Callers 7

imp_urlFunction · 0.90
getFunction · 0.90
get_urlFunction · 0.90
downloadMethod · 0.90
get_or_create_stageFunction · 0.90
imp_dbFunction · 0.90
test_resolve_outputFunction · 0.90

Calls 5

normpathMethod · 0.80
isdirMethod · 0.80
joinMethod · 0.80
existsMethod · 0.45

Tested by 1

test_resolve_outputFunction · 0.72