From 0467f6a03656e0858e42ccb096cc66d227c825e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Wed, 14 Dec 2022 21:23:07 +0545 Subject: [PATCH] add index._plot_sources --- dvc/repo/index.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dvc/repo/index.py b/dvc/repo/index.py index 809bc969d..83e36da9b 100644 --- a/dvc/repo/index.py +++ b/dvc/repo/index.py @@ -89,6 +89,21 @@ class Index: self._collect() return self._plots + @cached_property + def _plot_sources(self): + from dvc.repo.plots import _collect_pipeline_files + + sources = [] + for data in _collect_pipeline_files(self.repo, [], {}).values(): + for plot_id, props in data.get("data", {}).items(): + if isinstance(props.get("y"), dict): + sources.extend(props["y"]) + if isinstance(props.get("x"), dict): + sources.extend(props["x"]) + else: + sources.append(plot_id) + return sources + @cached_property def _top_params(self): self._collect()