Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions dvc/repo/metrics/diff.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from collections import defaultdict

from flatten_dict import flatten
from flatten_json import flatten

from dvc.exceptions import NoMetricsError

Expand Down Expand Up @@ -34,25 +34,18 @@ def _diff_vals(old, new):
return res


# dot_reducer is not released yet (flatten-dict > 0.2.0)
def _dot(k1, k2):
if k1 is None:
return k2
return "{0}.{1}".format(k1, k2)


def _diff_dicts(old_dict, new_dict):
old_default = None
new_default = None

if isinstance(new_dict, dict):
new = flatten(new_dict, reducer=_dot)
new = flatten(new_dict, ".")
else:
new = defaultdict(lambda: "not a dict")
new_default = "unable to parse"

if isinstance(old_dict, dict):
old = flatten(old_dict, reducer=_dot)
old = flatten(old_dict, ".")
else:
old = defaultdict(lambda: "not a dict")
old_default = "unable to parse"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def run(self):
"networkx>=2.1,<2.4",
"speedcopy>=2.0.1",
"pyfastcopy>=1.0.3",
"flatten-dict>=0.2.0",
"flatten_json>=0.1.6",
"texttable>=0.5.2",
]

Expand Down