(
url,
path,
out=None,
rev=None,
jobs=None,
force=False,
config=None,
remote=None,
remote_config=None,
)
| 20 | |
| 21 | |
| 22 | def get( |
| 23 | url, |
| 24 | path, |
| 25 | out=None, |
| 26 | rev=None, |
| 27 | jobs=None, |
| 28 | force=False, |
| 29 | config=None, |
| 30 | remote=None, |
| 31 | remote_config=None, |
| 32 | ): |
| 33 | from dvc.config import Config |
| 34 | from dvc.dvcfile import is_valid_filename |
| 35 | from dvc.repo import Repo |
| 36 | |
| 37 | out = resolve_output(path, out, force=force) |
| 38 | |
| 39 | if is_valid_filename(out): |
| 40 | raise GetDVCFileError |
| 41 | |
| 42 | if config and not isinstance(config, dict): |
| 43 | config = Config.load_file(config) |
| 44 | |
| 45 | with Repo.open( |
| 46 | url=url, |
| 47 | rev=rev, |
| 48 | subrepos=True, |
| 49 | uninitialized=True, |
| 50 | config=config, |
| 51 | remote=remote, |
| 52 | remote_config=remote_config, |
| 53 | ) as repo: |
| 54 | from dvc.fs import download |
| 55 | from dvc.fs.data import DataFileSystem |
| 56 | |
| 57 | fs: Union[DataFileSystem, DVCFileSystem] |
| 58 | if os.path.isabs(path): |
| 59 | fs = DataFileSystem(index=repo.index.data["local"]) |
| 60 | fs_path = fs.from_os_path(path) |
| 61 | else: |
| 62 | fs = repo.dvcfs |
| 63 | fs_path = fs.from_os_path(path) |
| 64 | download(fs, fs_path, os.path.abspath(out), jobs=jobs) |
no test coverage detected