From f5e0024137be345c424e63ea06f425d0ea986155 Mon Sep 17 00:00:00 2001 From: pared Date: Thu, 25 Jul 2019 16:33:49 +0200 Subject: [PATCH] metrics: show: add comment clarifying metric type and xpath usage --- dvc/repo/metrics/show.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dvc/repo/metrics/show.py b/dvc/repo/metrics/show.py index f82beb5b3..4b53f2222 100644 --- a/dvc/repo/metrics/show.py +++ b/dvc/repo/metrics/show.py @@ -188,10 +188,16 @@ def _collect_metrics(repo, path, recursive, typ, xpath, branch): if not o.metric: continue + # NOTE this case assumes that metric has been modified with + # `dvc metric modify -t {} -x {}`, so stage file should contain + # info what type metric is and what is its xpath if not typ and isinstance(o.metric, dict): t = o.metric.get(o.PARAM_METRIC_TYPE, typ) + # NOTE user might want to check different xpath, hence xpath first x = xpath or o.metric.get(o.PARAM_METRIC_XPATH) else: + # NOTE if metric has not been modified, user needs to provide + # both metric type and xpath t = typ x = xpath