integrate @efiop 's suggestions

This commit is contained in:
Mr. Outis
2019-08-10 11:37:35 -05:00
parent 163d872c92
commit a17caefd50
2 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -16,9 +16,9 @@ def show_metrics(metrics, all_branches=False, all_tags=False):
metrics (list): Where each element is either a `list`
if an xpath was specified, otherwise a `str`
"""
# When `metrics` contains a `_missing` key, it means that some files
# When `metrics` contains a `None` key, it means that some files
# specified as `targets` in `repo.metrics.show` didn't contain any metrics.
missing = metrics.pop("_missing", None)
missing = metrics.pop(None, None)
for branch, val in metrics.items():
if all_branches or all_tags:
+6 -4
View File
@@ -276,12 +276,14 @@ def show(
for branch in repo.brancher(all_branches=all_branches, all_tags=all_tags):
metrics = {}
for p in targets:
entries = _collect_metrics(repo, p, recursive, typ, xpath, branch)
for target in targets:
entries = _collect_metrics(
repo, target, recursive, typ, xpath, branch
)
metric = _read_metrics(repo, entries, branch)
if metric:
found.add(p)
found.add(target)
metrics.update(metric)
if metrics:
@@ -293,6 +295,6 @@ def show(
missing = set(targets) - found
if missing:
res["_missing"] = missing
res[None] = missing
return res