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

Method _parse_path

dvc/output.py:442–458  ·  view source on GitHub ↗
(self, fs, fs_path)

Source from the content-addressed store, hash-verified

440 self.hash_info = HashInfo("md5", md5)
441
442 def _parse_path(self, fs, fs_path):
443 parsed = urlparse(self.def_path)
444 if (
445 parsed.scheme != "remote"
446 and self.stage
447 and self.stage.repo.fs == fs
448 and not fs.isabs(fs_path)
449 ):
450 # NOTE: we can path either from command line or .dvc file,
451 # so we should expect both posix and windows style paths.
452 # paths accepts both, i.e. / works everywhere, \ only on win.
453 #
454 # FIXME: if we have Windows path containing / or posix one with \
455 # then we have #2059 bug and can't really handle that.
456 fs_path = fs.join(self.stage.wdir, fs_path)
457
458 return fs.abspath(fs.normpath(fs_path))
459
460 def __repr__(self):
461 return f"{type(self).__name__}: {self.def_path!r}"

Callers 1

__init__Method · 0.95

Calls 3

joinMethod · 0.80
abspathMethod · 0.80
normpathMethod · 0.80

Tested by

no test coverage detected