From a0e45cdd5df084912ade258d26ef6beaaeb3b186 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Wed, 19 Oct 2022 17:41:30 +0900 Subject: [PATCH] index: remove partial_imports in favor of repo.imports view --- dvc/repo/__init__.py | 41 +---------------------------------------- dvc/repo/index.py | 8 -------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 86e8a4a46..4b3d01d29 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -3,7 +3,7 @@ import os from collections import defaultdict from contextlib import contextmanager from functools import wraps -from typing import TYPE_CHECKING, Callable, List, Optional +from typing import TYPE_CHECKING, Callable, Optional from funcy import cached_property @@ -18,7 +18,6 @@ if TYPE_CHECKING: from dvc.fs import FileSystem from dvc.repo.scm_context import SCMContext from dvc.scm import Base - from dvc.stage import Stage logger = logging.getLogger(__name__) @@ -447,44 +446,6 @@ class Repo: return used - def partial_imports( - self, - targets=None, - all_branches=False, - all_tags=False, - all_commits=False, - all_experiments=False, - commit_date: Optional[str] = None, - recursive=False, - revs=None, - num=1, - ) -> List["Stage"]: - """Get the stages related to the given target and collect dependencies - which are missing outputs. - - This is useful to retrieve files which have been imported to the repo - using --no-download. - - Returns: - A list of partially imported stages - """ - from itertools import chain - - partial_imports = chain.from_iterable( - self.index.partial_imports(targets, recursive=recursive) - for _ in self.brancher( - revs=revs, - all_branches=all_branches, - all_tags=all_tags, - all_commits=all_commits, - all_experiments=all_experiments, - commit_date=commit_date, - num=num, - ) - ) - - return list(partial_imports) - @property def stages(self): # obsolete, only for backward-compatibility return self.index.stages diff --git a/dvc/repo/index.py b/dvc/repo/index.py index 005065baf..297b68bdd 100644 --- a/dvc/repo/index.py +++ b/dvc/repo/index.py @@ -279,14 +279,6 @@ class Index: used[odb].update(objs) return used - def partial_imports( - self, - targets: "TargetType" = None, - recursive: bool = False, - ) -> List["Stage"]: - pairs = self._collect_targets(targets, recursive=recursive) - return [stage for stage, _ in pairs if stage.is_partial_import] - # Following methods help us treat the collection as a set-like structure # and provides faux-immutability. # These methods do not preserve stages order.