forked from iterative/dvc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request iterative#1990 from efiop/small-fixes
dvc: refactoring: unify path/remote logic and naming
- Loading branch information
Showing
42 changed files
with
233 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from __future__ import unicode_literals | ||
|
||
from dvc.remote.https import RemoteHTTPS | ||
from .http import DependencyHTTP | ||
|
||
|
||
class DependencyHTTPS(DependencyHTTP): | ||
REMOTE = RemoteHTTPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,29 @@ | ||
from dvc.utils.compat import urlunsplit | ||
|
||
|
||
class Schemes: | ||
SSH = "ssh" | ||
HDFS = "hdfs" | ||
S3 = "s3" | ||
AZURE = "azure" | ||
HTTP = "http" | ||
GS = "gs" | ||
LOCAL = "local" | ||
OSS = "oss" | ||
|
||
|
||
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 | ||
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 | ||
|
||
|
||
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, | ||
} | ||
|
||
|
||
def Path(scheme, *args, **kwargs): | ||
cls = PATH_MAP[scheme] | ||
return cls(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from dvc.scheme import Schemes | ||
from .http import PathHTTP | ||
|
||
|
||
class PathHTTPS(PathHTTP): | ||
scheme = Schemes.HTTPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.