diff --git a/dvc/dependency/__init__.py b/dvc/dependency/__init__.py index ae08a6eca..b513e31dd 100644 --- a/dvc/dependency/__init__.py +++ b/dvc/dependency/__init__.py @@ -28,7 +28,7 @@ def loadd_from(stage, d_list): ret = [] for d in d_list: p = d[DependencyBase.PARAM_PATH] - ret.append(_get(p).loadd(stage, d)) + ret.append(_get(p)(stage, **d)) return ret diff --git a/dvc/dependency/base.py b/dvc/dependency/base.py index 171c9819a..31fd48437 100644 --- a/dvc/dependency/base.py +++ b/dvc/dependency/base.py @@ -56,8 +56,3 @@ class DependencyBase(object): def dumpd(self): return {self.PARAM_PATH: self.path} - - @classmethod - def loadd(cls, stage, d): - path = d[cls.PARAM_PATH] - return cls(stage, path) diff --git a/dvc/dependency/local.py b/dvc/dependency/local.py index 97dc37c1c..847635658 100644 --- a/dvc/dependency/local.py +++ b/dvc/dependency/local.py @@ -22,7 +22,10 @@ class DependencyLOCAL(DependencyBase): def __init__(self, stage, path, md5=None): self.stage = stage self.project = stage.project - self.path = os.path.abspath(os.path.normpath(path)) + if not os.path.isabs(path): + path = self.unixpath(path) + path = os.path.join(stage.cwd, path) + self.path = os.path.normpath(path) self.md5 = md5 @property @@ -76,13 +79,3 @@ class DependencyLOCAL(DependencyBase): return {self.PARAM_PATH: path, self.PARAM_MD5:self.md5} - - @classmethod - def loadd(cls, stage, d): - path = d[cls.PARAM_PATH] - if not os.path.isabs(path): - path = cls.unixpath(path) - path = os.path.join(stage.cwd, path) - path = os.path.normpath(path) - md5 = d.get(cls.PARAM_MD5, None) - return cls(stage, path, md5=md5) diff --git a/dvc/dependency/s3.py b/dvc/dependency/s3.py index 522730978..52974057b 100644 --- a/dvc/dependency/s3.py +++ b/dvc/dependency/s3.py @@ -48,9 +48,3 @@ class DependencyS3(DependencyBase): def dumpd(self): return {self.PARAM_PATH: self.path, self.PARAM_ETAG: self.etag} - - @classmethod - def loadd(cls, stage, d): - path = d[cls.PARAM_PATH] - etag = d.get(cls.PARAM_ETAG, None) - return cls(stage, path, etag=etag) diff --git a/dvc/output/__init__.py b/dvc/output/__init__.py index 5139af482..0153fee5f 100644 --- a/dvc/output/__init__.py +++ b/dvc/output/__init__.py @@ -26,12 +26,12 @@ def loadd_from(stage, d_list): ret = [] for d in d_list: p = d[DependencyBase.PARAM_PATH] - ret.append(_get(p).loadd(stage, d)) + ret.append(_get(p)(stage, **d)) return ret def loads_from(stage, s_list, use_cache=False): ret = [] for s in s_list: - ret.append(_get(s)(stage, s, use_cache=use_cache)) + ret.append(_get(s)(stage, s, cache=use_cache)) return ret diff --git a/dvc/output/gs.py b/dvc/output/gs.py index 3a89e7e7f..fc84d78bb 100644 --- a/dvc/output/gs.py +++ b/dvc/output/gs.py @@ -4,9 +4,9 @@ from dvc.dependency.gs import DependencyGS class OutputGS(DependencyGS): PARAM_CACHE = 'cache' - def __init__(self, stage, path, etag=None, use_cache=True): + def __init__(self, stage, path, etag=None, cache=True): super(OutputGS, self).__init__(stage, path, etag=etag) - self.use_cache = use_cache + self.use_cache = cache @property def cache(self): @@ -22,12 +22,6 @@ class OutputGS(DependencyGS): ret[self.PARAM_CACHE] = self.use_cache return ret - @classmethod - def loadd(cls, stage, d): - ret = super(OutputGS, cls).loadd(stage, d) - ret.use_cache = d.get(cls.PARAM_CACHE, True) - return ret - def changed(self): if super(OutputGS, self).changed(): return True diff --git a/dvc/output/local.py b/dvc/output/local.py index 2f761f547..e9dd2876a 100644 --- a/dvc/output/local.py +++ b/dvc/output/local.py @@ -16,9 +16,9 @@ class OutputLOCAL(DependencyLOCAL): DoesNotExistError = OutputDoesNotExistError IsNotFileOrDirError = OutputIsNotFileOrDirError - def __init__(self, stage, path, md5=None, use_cache=True): + def __init__(self, stage, path, md5=None, cache=True): super(OutputLOCAL, self).__init__(stage, path, md5=md5) - self.use_cache = use_cache + self.use_cache = cache @property def cache(self): @@ -32,12 +32,6 @@ class OutputLOCAL(DependencyLOCAL): ret[self.PARAM_CACHE] = self.use_cache return ret - @classmethod - def loadd(cls, stage, d): - ret = super(OutputLOCAL, cls).loadd(stage, d) - ret.use_cache = d.get(cls.PARAM_CACHE, True) - return ret - def changed(self): if super(OutputLOCAL, self).changed(): return True diff --git a/dvc/output/s3.py b/dvc/output/s3.py index b5df0feca..8c9fd4d29 100644 --- a/dvc/output/s3.py +++ b/dvc/output/s3.py @@ -4,9 +4,9 @@ from dvc.dependency.s3 import DependencyS3 class OutputS3(DependencyS3): PARAM_CACHE = 'cache' - def __init__(self, stage, path, etag=None, use_cache=True): + def __init__(self, stage, path, etag=None, cache=True): super(OutputS3, self).__init__(stage, path, etag=etag) - self.use_cache = use_cache + self.use_cache = cache @property def cache(self): @@ -22,12 +22,6 @@ class OutputS3(DependencyS3): ret[self.PARAM_CACHE] = self.use_cache return ret - @classmethod - def loadd(cls, stage, d): - ret = super(OutputS3, cls).loadd(stage, d) - ret.use_cache = d.get(cls.PARAM_CACHE, True) - return ret - def changed(self): if super(OutputS3, self).changed(): return True