From a593a9ce2ec3d99ee2ab52686575782696aabe5d Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 12 May 2019 17:17:39 +0300 Subject: [PATCH] dvc: refactor PathInfos Following same conventions from remotes/outsputs/dependencies. Signed-off-by: Ruslan Kuprieiev --- dvc/dependency/__init__.py | 16 +++++----- dvc/dependency/http.py | 4 +-- dvc/output/__init__.py | 2 +- dvc/output/hdfs.py | 4 +-- dvc/output/local.py | 4 +-- dvc/output/s3.py | 4 +-- dvc/output/ssh.py | 4 +-- dvc/path/__init__.py | 56 +++++++++++++++------------------- dvc/path/azure.py | 5 +-- dvc/path/base.py | 23 ++++++++++++++ dvc/path/gs.py | 5 +-- dvc/path/hdfs.py | 7 +++-- dvc/path/http.py | 6 ++-- dvc/path/https.py | 6 ++-- dvc/path/local.py | 5 +-- dvc/path/oss.py | 5 +-- dvc/path/s3.py | 5 +-- dvc/path/ssh.py | 7 +++-- dvc/path/utils.py | 27 ---------------- dvc/remote/azure.py | 6 ++-- dvc/remote/base.py | 6 ++-- dvc/remote/gs.py | 6 ++-- dvc/remote/hdfs.py | 6 ++-- dvc/remote/http.py | 6 ++-- dvc/remote/https.py | 2 +- dvc/remote/local/__init__.py | 9 +++--- dvc/remote/oss.py | 6 ++-- dvc/remote/s3.py | 6 ++-- dvc/remote/ssh/__init__.py | 4 +-- dvc/repo/__init__.py | 4 +-- dvc/scheme.py | 13 ++++++++ tests/func/test_remote.py | 4 +-- tests/func/test_s3.py | 4 +-- tests/func/test_state.py | 6 ++-- tests/unit/remote/test_base.py | 6 ++-- 35 files changed, 152 insertions(+), 137 deletions(-) create mode 100644 dvc/path/base.py delete mode 100644 dvc/path/utils.py create mode 100644 dvc/scheme.py diff --git a/dvc/dependency/__init__.py b/dvc/dependency/__init__.py index 085a46be6..5c5ba67d4 100644 --- a/dvc/dependency/__init__.py +++ b/dvc/dependency/__init__.py @@ -2,6 +2,8 @@ from __future__ import unicode_literals import schema +from dvc.scheme import Schemes + import dvc.output as output from dvc.output.base import OutputBase from dvc.dependency.s3 import DependencyS3 @@ -25,13 +27,13 @@ DEPS = [ ] DEP_MAP = { - "local": DependencyLOCAL, - "ssh": DependencySSH, - "s3": DependencyS3, - "gs": DependencyGS, - "hdfs": DependencyHDFS, - "http": DependencyHTTP, - "https": DependencyHTTPS, + Schemes.LOCAL: DependencyLOCAL, + Schemes.SSH: DependencySSH, + Schemes.S3: DependencyS3, + Schemes.GS: DependencyGS, + Schemes.HDFS: DependencyHDFS, + Schemes.HTTP: DependencyHTTP, + Schemes.HTTPS: DependencyHTTPS, } diff --git a/dvc/dependency/http.py b/dvc/dependency/http.py index c90a760f3..24ddfe497 100644 --- a/dvc/dependency/http.py +++ b/dvc/dependency/http.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from dvc.path.utils import PathInfo +from dvc.path import Path from dvc.utils.compat import urlparse, urljoin from dvc.output.base import OutputBase from dvc.remote.http import RemoteHTTP @@ -17,4 +17,4 @@ class DependencyHTTP(DependencyBase, OutputBase): if path.startswith("remote"): path = urljoin(self.remote.cache_dir, urlparse(path).path) - self.path_info = PathInfo(self.scheme, url=self.url, path=path) + self.path_info = Path(self.scheme, url=self.url, path=path) diff --git a/dvc/output/__init__.py b/dvc/output/__init__.py index 54e76c52d..60db6a50c 100644 --- a/dvc/output/__init__.py +++ b/dvc/output/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import schema -from dvc.path import Schemes +from dvc.scheme import Schemes from dvc.utils.compat import urlparse, str from dvc.output.base import OutputBase diff --git a/dvc/output/hdfs.py b/dvc/output/hdfs.py index dd01d7488..94225c90b 100644 --- a/dvc/output/hdfs.py +++ b/dvc/output/hdfs.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import posixpath -from dvc.path.hdfs import HDFSPathInfo +from dvc.path.hdfs import PathHDFS from dvc.utils.compat import urlparse from dvc.output.base import OutputBase from dvc.remote.hdfs import RemoteHDFS @@ -35,4 +35,4 @@ class OutputHDFS(OutputBase): if remote: path = posixpath.join(remote.url, urlparse(path).path.lstrip("/")) user = remote.user if remote else self.group("user") - self.path_info = HDFSPathInfo(user=user, url=self.url, path=path) + self.path_info = PathHDFS(user=user, url=self.url, path=path) diff --git a/dvc/output/local.py b/dvc/output/local.py index 848e21fd2..1064009ca 100644 --- a/dvc/output/local.py +++ b/dvc/output/local.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import os import logging -from dvc.path.local import LocalPathInfo +from dvc.path.local import PathLOCAL from dvc.utils.compat import urlparse from dvc.istextfile import istextfile from dvc.exceptions import DvcException @@ -50,7 +50,7 @@ class OutputLOCAL(OutputBase): p = os.path.join(stage.wdir, p) p = os.path.abspath(os.path.normpath(p)) - self.path_info = LocalPathInfo(url=self.url, path=p) + self.path_info = PathLOCAL(url=self.url, path=p) def __str__(self): return self.rel_path diff --git a/dvc/output/s3.py b/dvc/output/s3.py index caa039970..4c5cc4724 100644 --- a/dvc/output/s3.py +++ b/dvc/output/s3.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import posixpath -from dvc.path.utils import PathInfo +from dvc.path import Path from dvc.remote.s3 import RemoteS3 from dvc.utils.compat import urlparse from dvc.output.base import OutputBase @@ -37,6 +37,6 @@ class OutputS3(OutputBase): if remote: path = posixpath.join(remote.prefix, path) - self.path_info = PathInfo( + self.path_info = Path( self.scheme, bucket=bucket, path=path, url=self.url ) diff --git a/dvc/output/ssh.py b/dvc/output/ssh.py index 184b41218..f461175fd 100644 --- a/dvc/output/ssh.py +++ b/dvc/output/ssh.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import getpass import posixpath -from dvc.path.ssh import SSHPathInfo +from dvc.path.ssh import PathSSH from dvc.utils.compat import urlparse from dvc.output.base import OutputBase from dvc.remote.ssh import RemoteSSH @@ -49,6 +49,6 @@ class OutputSSH(OutputBase): else: path = parsed.path - self.path_info = SSHPathInfo( + self.path_info = PathSSH( host=host, user=user, port=port, url=self.url, path=path ) diff --git a/dvc/path/__init__.py b/dvc/path/__init__.py index aa0433a85..0af623dee 100644 --- a/dvc/path/__init__.py +++ b/dvc/path/__init__.py @@ -1,35 +1,29 @@ -from dvc.utils.compat import urlunsplit +from dvc.scheme import Schemes + +from dvc.path.azure import PathAZURE +from dvc.path.gs import PathGS +from dvc.path.hdfs import PathHDFS +from dvc.path.http import PathHTTP +from dvc.path.https import PathHTTPS +from dvc.path.local import PathLOCAL +from dvc.path.oss import PathOSS +from dvc.path.s3 import PathS3 +from dvc.path.ssh import PathSSH -class Schemes: - SSH = "ssh" - HDFS = "hdfs" - S3 = "s3" - AZURE = "azure" - HTTP = "http" - HTTPS = "https" - GS = "gs" - LOCAL = "local" - OSS = "oss" +PATH_MAP = { + Schemes.SSH: PathSSH, + Schemes.HDFS: PathHDFS, + Schemes.S3: PathS3, + Schemes.AZURE: PathAZURE, + Schemes.HTTP: PathHTTP, + Schemes.HTTPS: PathHTTPS, + Schemes.GS: PathGS, + Schemes.LOCAL: PathLOCAL, + Schemes.OSS: PathOSS, +} -class BasePathInfo(object): - scheme = None - - def __init__(self, url=None, path=None): - self.url = url - self.path = path - - def __str__(self): - return self.url - - -class DefaultCloudPathInfo(BasePathInfo): - def __init__(self, bucket, url=None, path=None): - super(DefaultCloudPathInfo, self).__init__(url, path) - self.bucket = bucket - - def __str__(self): - if not self.url: - return urlunsplit((self.scheme, self.bucket, self.path, "", "")) - return self.url +def Path(scheme, *args, **kwargs): + cls = PATH_MAP[scheme] + return cls(*args, **kwargs) diff --git a/dvc/path/azure.py b/dvc/path/azure.py index 956d91581..019cf0af4 100644 --- a/dvc/path/azure.py +++ b/dvc/path/azure.py @@ -1,5 +1,6 @@ -from dvc.path import Schemes, DefaultCloudPathInfo +from dvc.scheme import Schemes +from .base import PathCloudBASE -class AzurePathInfo(DefaultCloudPathInfo): +class PathAZURE(PathCloudBASE): scheme = Schemes.AZURE diff --git a/dvc/path/base.py b/dvc/path/base.py new file mode 100644 index 000000000..616df4041 --- /dev/null +++ b/dvc/path/base.py @@ -0,0 +1,23 @@ +from dvc.utils.compat import urlunsplit + + +class PathBASE(object): + scheme = None + + def __init__(self, url=None, path=None): + self.url = url + self.path = path + + def __str__(self): + return self.url + + +class PathCloudBASE(PathBASE): + def __init__(self, bucket, url=None, path=None): + super(PathCloudBASE, self).__init__(url, path) + self.bucket = bucket + + def __str__(self): + if not self.url: + return urlunsplit((self.scheme, self.bucket, self.path, "", "")) + return self.url diff --git a/dvc/path/gs.py b/dvc/path/gs.py index 087c584be..f2befca6c 100644 --- a/dvc/path/gs.py +++ b/dvc/path/gs.py @@ -1,5 +1,6 @@ -from dvc.path import Schemes, DefaultCloudPathInfo +from dvc.scheme import Schemes +from .base import PathCloudBASE -class GSPathInfo(DefaultCloudPathInfo): +class PathGS(PathCloudBASE): scheme = Schemes.GS diff --git a/dvc/path/hdfs.py b/dvc/path/hdfs.py index d5ce13314..628bd2c29 100644 --- a/dvc/path/hdfs.py +++ b/dvc/path/hdfs.py @@ -1,12 +1,13 @@ from dvc.utils.compat import urlunsplit -from dvc.path import BasePathInfo, Schemes +from dvc.scheme import Schemes +from .base import PathBASE -class HDFSPathInfo(BasePathInfo): +class PathHDFS(PathBASE): scheme = Schemes.HDFS def __init__(self, user, url=None, path=None): - super(HDFSPathInfo, self).__init__(url, path) + super(PathHDFS, self).__init__(url, path) self.user = user def __str__(self): diff --git a/dvc/path/http.py b/dvc/path/http.py index ed71c609f..579db8198 100644 --- a/dvc/path/http.py +++ b/dvc/path/http.py @@ -1,8 +1,10 @@ -from dvc.path import BasePathInfo, Schemes +from dvc.scheme import Schemes from dvc.utils.compat import urlunsplit +from .base import PathBASE -class HTTPPathInfo(BasePathInfo): + +class PathHTTP(PathBASE): scheme = Schemes.HTTP def __str__(self): diff --git a/dvc/path/https.py b/dvc/path/https.py index 957f02123..b631045eb 100644 --- a/dvc/path/https.py +++ b/dvc/path/https.py @@ -1,6 +1,6 @@ -from . import Schemes -from .http import HTTPPathInfo +from dvc.scheme import Schemes +from .http import PathHTTP -class HTTPSPathInfo(HTTPPathInfo): +class PathHTTPS(PathHTTP): scheme = Schemes.HTTPS diff --git a/dvc/path/local.py b/dvc/path/local.py index cbde5c2a4..4d90364c5 100644 --- a/dvc/path/local.py +++ b/dvc/path/local.py @@ -1,9 +1,10 @@ import os -from dvc.path import BasePathInfo, Schemes +from dvc.scheme import Schemes +from .base import PathBASE -class LocalPathInfo(BasePathInfo): +class PathLOCAL(PathBASE): scheme = Schemes.LOCAL def __str__(self): diff --git a/dvc/path/oss.py b/dvc/path/oss.py index 606007b26..67cb3dd19 100644 --- a/dvc/path/oss.py +++ b/dvc/path/oss.py @@ -1,5 +1,6 @@ -from dvc.path import Schemes, DefaultCloudPathInfo +from dvc.scheme import Schemes +from .base import PathCloudBASE -class OSSPathInfo(DefaultCloudPathInfo): +class PathOSS(PathCloudBASE): scheme = Schemes.OSS diff --git a/dvc/path/s3.py b/dvc/path/s3.py index a1c04fa75..df46e87e3 100644 --- a/dvc/path/s3.py +++ b/dvc/path/s3.py @@ -1,5 +1,6 @@ -from dvc.path import Schemes, DefaultCloudPathInfo +from dvc.scheme import Schemes +from .base import PathCloudBASE -class S3PathInfo(DefaultCloudPathInfo): +class PathS3(PathCloudBASE): scheme = Schemes.S3 diff --git a/dvc/path/ssh.py b/dvc/path/ssh.py index 3c9c2e185..13f0b8508 100644 --- a/dvc/path/ssh.py +++ b/dvc/path/ssh.py @@ -1,12 +1,13 @@ from dvc.utils.compat import urlunsplit -from dvc.path import BasePathInfo, Schemes +from dvc.scheme import Schemes +from .base import PathBASE -class SSHPathInfo(BasePathInfo): +class PathSSH(PathBASE): scheme = Schemes.SSH def __init__(self, host, user, port, url=None, path=None): - super(SSHPathInfo, self).__init__(url, path) + super(PathSSH, self).__init__(url, path) self.host = host self.user = user self.port = port diff --git a/dvc/path/utils.py b/dvc/path/utils.py deleted file mode 100644 index 0c7f084f1..000000000 --- a/dvc/path/utils.py +++ /dev/null @@ -1,27 +0,0 @@ -from dvc.path import Schemes -from dvc.path.azure import AzurePathInfo -from dvc.path.gs import GSPathInfo -from dvc.path.hdfs import HDFSPathInfo -from dvc.path.http import HTTPPathInfo -from dvc.path.https import HTTPSPathInfo -from dvc.path.local import LocalPathInfo -from dvc.path.oss import OSSPathInfo -from dvc.path.s3 import S3PathInfo -from dvc.path.ssh import SSHPathInfo - -PATH_MAP = { - Schemes.SSH: SSHPathInfo, - Schemes.HDFS: HDFSPathInfo, - Schemes.S3: S3PathInfo, - Schemes.AZURE: AzurePathInfo, - Schemes.HTTP: HTTPPathInfo, - Schemes.HTTPS: HTTPSPathInfo, - Schemes.GS: GSPathInfo, - Schemes.LOCAL: LocalPathInfo, - Schemes.OSS: OSSPathInfo, -} - - -def PathInfo(scheme, *args, **kwargs): - cls = PATH_MAP[scheme] - return cls(*args, **kwargs) diff --git a/dvc/remote/azure.py b/dvc/remote/azure.py index 263c2f724..91031040c 100644 --- a/dvc/remote/azure.py +++ b/dvc/remote/azure.py @@ -5,8 +5,8 @@ import os import re import logging -from dvc.path import Schemes -from dvc.path.azure import AzurePathInfo +from dvc.scheme import Schemes +from dvc.path.azure import PathAZURE try: from azure.storage.blob import BlockBlobService @@ -72,7 +72,7 @@ class RemoteAzure(RemoteBase): raise ValueError("azure storage connection string missing") self.__blob_service = None - self.path_info = AzurePathInfo(bucket=self.bucket) + self.path_info = PathAZURE(bucket=self.bucket) @property def blob_service(self): diff --git a/dvc/remote/base.py b/dvc/remote/base.py index 766933686..0ef72972b 100644 --- a/dvc/remote/base.py +++ b/dvc/remote/base.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from copy import copy -from dvc.path.local import LocalPathInfo +from dvc.path.local import PathLOCAL from dvc.utils.compat import str import os @@ -211,7 +211,7 @@ class RemoteBase(object): with open(tmp, "w+") as fobj: json.dump(dir_info, fobj, sort_keys=True) - from_info = LocalPathInfo(path=tmp) + from_info = PathLOCAL(path=tmp) self.cache.upload([from_info], [to_info], no_progress_bar=True) checksum = self.get_file_checksum(to_info) + self.CHECKSUM_DIR_SUFFIX @@ -235,7 +235,7 @@ class RemoteBase(object): fobj = tempfile.NamedTemporaryFile(delete=False) path = fobj.name - to_info = LocalPathInfo(path=path) + to_info = PathLOCAL(path=path) self.cache.download([path_info], [to_info], no_progress_bar=True) try: diff --git a/dvc/remote/gs.py b/dvc/remote/gs.py index b41aff3e6..25959993e 100644 --- a/dvc/remote/gs.py +++ b/dvc/remote/gs.py @@ -3,8 +3,8 @@ from __future__ import unicode_literals import os import logging -from dvc.path import Schemes -from dvc.path.gs import GSPathInfo +from dvc.scheme import Schemes +from dvc.path.gs import PathGS try: from google.cloud import storage @@ -41,7 +41,7 @@ class RemoteGS(RemoteBase): self.bucket = parsed.netloc self.prefix = parsed.path.lstrip("/") - self.path_info = GSPathInfo(bucket=self.bucket) + self.path_info = PathGS(bucket=self.bucket) @staticmethod def compat_config(config): diff --git a/dvc/remote/hdfs.py b/dvc/remote/hdfs.py index b6922c1db..d40c665c0 100644 --- a/dvc/remote/hdfs.py +++ b/dvc/remote/hdfs.py @@ -8,8 +8,8 @@ import logging from subprocess import Popen, PIPE from dvc.config import Config -from dvc.path import Schemes -from dvc.path.hdfs import HDFSPathInfo +from dvc.scheme import Schemes +from dvc.path.hdfs import PathHDFS from dvc.remote.base import RemoteBase, RemoteCmdError from dvc.utils import fix_env, tmp_fname @@ -32,7 +32,7 @@ class RemoteHDFS(RemoteBase): Config.SECTION_REMOTE_USER, getpass.getuser() ) - self.path_info = HDFSPathInfo(user=self.user) + self.path_info = PathHDFS(user=self.user) def hadoop_fs(self, cmd, user=None): cmd = "hadoop fs -" + cmd diff --git a/dvc/remote/http.py b/dvc/remote/http.py index 6ddd73c7c..d684e5bb2 100644 --- a/dvc/remote/http.py +++ b/dvc/remote/http.py @@ -1,7 +1,7 @@ from __future__ import unicode_literals -from dvc.path import Schemes -from dvc.path.utils import PathInfo +from dvc.scheme import Schemes +from dvc.path import Path from dvc.utils.compat import open, makedirs import os @@ -44,7 +44,7 @@ class RemoteHTTP(RemoteBase): self.cache_dir = config.get(Config.SECTION_REMOTE_URL) self.url = self.cache_dir - self.path_info = PathInfo(self.scheme) + self.path_info = Path(self.scheme) @property def prefix(self): diff --git a/dvc/remote/https.py b/dvc/remote/https.py index 0653b0a1e..e775a5161 100644 --- a/dvc/remote/https.py +++ b/dvc/remote/https.py @@ -1,6 +1,6 @@ from __future__ import unicode_literals -from dvc.path import Schemes +from dvc.scheme import Schemes from .http import RemoteHTTP diff --git a/dvc/remote/local/__init__.py b/dvc/remote/local/__init__.py index 7d853b702..24d581ad9 100644 --- a/dvc/remote/local/__init__.py +++ b/dvc/remote/local/__init__.py @@ -2,8 +2,9 @@ from __future__ import unicode_literals from copy import copy -from dvc.path import BasePathInfo, Schemes -from dvc.path.local import LocalPathInfo +from dvc.scheme import Schemes +from dvc.path.base import PathBASE +from dvc.path.local import PathLOCAL from dvc.remote.local.slow_link_detection import slow_link_guard from dvc.utils.compat import str, makedirs @@ -80,7 +81,7 @@ class RemoteLOCAL(RemoteBase): os.mkdir(self.cache_dir) self._dir_info = {} - self.path_info = LocalPathInfo() + self.path_info = PathLOCAL() @staticmethod def compat_config(config): @@ -116,7 +117,7 @@ class RemoteLOCAL(RemoteBase): return self.checksum_to_path(md5) def exists(self, path_info): - assert isinstance(path_info, BasePathInfo) + assert isinstance(path_info, PathBASE) assert path_info.scheme == "local" return os.path.lexists(path_info.path) diff --git a/dvc/remote/oss.py b/dvc/remote/oss.py index b07d87999..3c851cd93 100644 --- a/dvc/remote/oss.py +++ b/dvc/remote/oss.py @@ -4,8 +4,8 @@ from __future__ import unicode_literals import os import logging -from dvc.path import Schemes -from dvc.path.oss import OSSPathInfo +from dvc.scheme import Schemes +from dvc.path.oss import PathOSS try: import oss2 @@ -73,7 +73,7 @@ class RemoteOSS(RemoteBase): ) self._bucket = None - self.path_info = OSSPathInfo(bucket=self.bucket) + self.path_info = PathOSS(bucket=self.bucket) @property def oss_service(self): diff --git a/dvc/remote/s3.py b/dvc/remote/s3.py index 0964090a1..e4946a245 100644 --- a/dvc/remote/s3.py +++ b/dvc/remote/s3.py @@ -4,8 +4,8 @@ import os import threading import logging -from dvc.path import Schemes -from dvc.path.s3 import S3PathInfo +from dvc.scheme import Schemes +from dvc.path.s3 import PathS3 try: import boto3 @@ -72,7 +72,7 @@ class RemoteS3(RemoteBase): self.bucket = parsed.netloc self.prefix = parsed.path.lstrip("/") - self.path_info = S3PathInfo(bucket=self.bucket) + self.path_info = PathS3(bucket=self.bucket) @staticmethod def compat_config(config): diff --git a/dvc/remote/ssh/__init__.py b/dvc/remote/ssh/__init__.py index b9b924570..291f8a088 100644 --- a/dvc/remote/ssh/__init__.py +++ b/dvc/remote/ssh/__init__.py @@ -5,7 +5,7 @@ import getpass import logging from dvc.path import Schemes -from dvc.path.ssh import SSHPathInfo +from dvc.path.ssh import PathSSH try: import paramiko @@ -68,7 +68,7 @@ class RemoteSSH(RemoteBase): Config.SECTION_REMOTE_ASK_PASSWORD, False ) - self.path_info = SSHPathInfo( + self.path_info = PathSSH( host=self.host, user=self.user, port=self.port ) diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 4e6a477f4..e50b3eb1d 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -12,7 +12,7 @@ from dvc.exceptions import ( TargetNotDirectoryError, ) from dvc.ignore import DvcIgnoreFileHandler -from dvc.path.local import LocalPathInfo +from dvc.path.local import PathLOCAL logger = logging.getLogger(__name__) @@ -117,7 +117,7 @@ class Repo(object): return Repo(root_dir) def unprotect(self, target): - path_info = LocalPathInfo(path=target) + path_info = PathLOCAL(path=target) return self.cache.local.unprotect(path_info) def _ignore(self): diff --git a/dvc/scheme.py b/dvc/scheme.py new file mode 100644 index 000000000..e12b768f5 --- /dev/null +++ b/dvc/scheme.py @@ -0,0 +1,13 @@ +from __future__ import unicode_literals + + +class Schemes: + SSH = "ssh" + HDFS = "hdfs" + S3 = "s3" + AZURE = "azure" + HTTP = "http" + HTTPS = "https" + GS = "gs" + LOCAL = "local" + OSS = "oss" diff --git a/tests/func/test_remote.py b/tests/func/test_remote.py index a0c527a39..3af5e642f 100644 --- a/tests/func/test_remote.py +++ b/tests/func/test_remote.py @@ -1,6 +1,6 @@ import os import configobj -from dvc.path.local import LocalPathInfo +from dvc.path.local import PathLOCAL from dvc.remote.base import RemoteBase from mock import patch @@ -199,7 +199,7 @@ def test_dir_checksum_should_be_key_order_agnostic(dvc): with open(file2, "w") as fobj: fobj.write("2") - path_info = LocalPathInfo(path=data_dir) + path_info = PathLOCAL(path=data_dir) with dvc.state: with patch.object( RemoteBase, diff --git a/tests/func/test_s3.py b/tests/func/test_s3.py index 718a8a41c..c6768b93e 100644 --- a/tests/func/test_s3.py +++ b/tests/func/test_s3.py @@ -4,7 +4,7 @@ from copy import copy import boto3 import pytest -from dvc.path.s3 import S3PathInfo +from dvc.path.s3 import PathS3 from dvc.remote.s3 import RemoteS3 from tests.func.test_data_cloud import TEST_AWS_REPO_BUCKET, _should_test_aws @@ -12,7 +12,7 @@ from tests.func.test_data_cloud import TEST_AWS_REPO_BUCKET, _should_test_aws def _get_src_dst(): prefix = str(uuid.uuid4()) - from_info = S3PathInfo( + from_info = PathS3( bucket=TEST_AWS_REPO_BUCKET, path=posixpath.join(prefix, "from") ) to_info = copy(from_info) diff --git a/tests/func/test_state.py b/tests/func/test_state.py index 5c0fbc96c..70fb0db0b 100644 --- a/tests/func/test_state.py +++ b/tests/func/test_state.py @@ -1,6 +1,6 @@ import os import mock -from dvc.path.local import LocalPathInfo +from dvc.path.local import PathLOCAL from dvc.utils.compat import str @@ -15,7 +15,7 @@ from tests.basic_env import TestDvc class TestState(TestDvc): def test_update(self): path = os.path.join(self.dvc.root_dir, self.FOO) - path_info = LocalPathInfo(path=path) + path_info = PathLOCAL(path=path) md5 = file_md5(path)[0] state = State(self.dvc, self.dvc.config.config) @@ -78,6 +78,6 @@ class TestGetStateRecordForInode(TestDvc): get_inode_mock.side_effect = self.mock_get_inode(path, inode) with state: - state.save(LocalPathInfo(path=path), md5) + state.save(PathLOCAL(path=path), md5) ret = state.get_state_record_for_inode(inode) self.assertIsNotNone(ret) diff --git a/tests/unit/remote/test_base.py b/tests/unit/remote/test_base.py index a63bfa55b..751198fc2 100644 --- a/tests/unit/remote/test_base.py +++ b/tests/unit/remote/test_base.py @@ -1,7 +1,7 @@ import mock from unittest import TestCase -from dvc.path import BasePathInfo +from dvc.path.base import PathBASE from dvc.remote.base import RemoteBase, RemoteCmdError, RemoteMissingDepsError @@ -44,10 +44,10 @@ class TestCacheExists(TestCase): remote = RemoteBase(None, config) remote.PARAM_CHECKSUM = "checksum" - remote.path_info = BasePathInfo(None, None) + remote.path_info = PathBASE(None, None) remote.url = "" remote.prefix = "" - path_info = BasePathInfo("example", None) + path_info = PathBASE("example", None) checksum_info = {remote.PARAM_CHECKSUM: "1234567890"} with mock.patch.object(remote, "_checkout") as mock_checkout: