From 875186d5a60e97c4f45deb2c0696283a0e0c5a6a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 18 Aug 2019 05:09:30 +0300 Subject: [PATCH 1/2] dvc: remove unused code A bunch of leftovers from a very old pkg implementation. --- dvc/output/base.py | 5 ----- dvc/output/local.py | 14 -------------- dvc/scm/git/__init__.py | 8 ++------ 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/dvc/output/base.py b/dvc/output/base.py index c887518be..f91a939e3 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -138,11 +138,6 @@ class OutputBase(object): def dir_cache(self): return self.cache.get_dir_cache(self.checksum) - def assign_to_stage_file(self, target_repo): - raise DvcException( - "change repo is not supported for {}".format(self.scheme) - ) - @classmethod def supported(cls, url): return cls.REMOTE.supported(url) diff --git a/dvc/output/local.py b/dvc/output/local.py index 13ae650f2..777ac3756 100644 --- a/dvc/output/local.py +++ b/dvc/output/local.py @@ -47,20 +47,6 @@ class OutputLOCAL(OutputBase): def_scheme = urlparse(self.def_path).scheme return def_scheme != "remote" and not os.path.isabs(self.def_path) - def assign_to_stage_file(self, stage): - from dvc.repo import Repo - - # Make path info the same but relative to passed stage - rel_path = self.path_info.relpath(self.stage.wdir) - self.path_info = ( - self.REMOTE.path_cls(os.path.abspath(stage.wdir)) / rel_path - ) - - self.repo = Repo(self.fspath) - - self.stage = stage - return self - def dumpd(self): ret = super(OutputLOCAL, self).dumpd() if self.is_in_repo: diff --git a/dvc/scm/git/__init__.py b/dvc/scm/git/__init__.py index 290ca5802..9c18b216e 100644 --- a/dvc/scm/git/__init__.py +++ b/dvc/scm/git/__init__.py @@ -114,12 +114,8 @@ class Git(Base): ) return False - def ignore(self, path, in_curr_dir=False): - base_dir = ( - os.path.realpath(os.curdir) - if in_curr_dir - else os.path.dirname(path) - ) + def ignore(self, path): + base_dir = os.path.dirname(path) entry, gitignore = self._get_gitignore(path, base_dir) if self._ignored(entry, gitignore): From 5915f17fcf61b4b58d6cbb98f35494bcea6f82d6 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 18 Aug 2019 05:15:08 +0300 Subject: [PATCH 2/2] output: base: remove unnecessary 'else' Reported by DeepSource. --- dvc/output/base.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dvc/output/base.py b/dvc/output/base.py index f91a939e3..8b55bd71f 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -104,8 +104,7 @@ class OutputBase(object): if remote: parsed = urlparse(path) return remote.path_info / parsed.path.lstrip("/") - else: - return self.REMOTE.path_cls(path) + return self.REMOTE.path_cls(path) def __repr__(self): return "{class_name}: '{def_path}'".format(