MCPcopy Index your code
hub / github.com/treeverse/dvc / _diff_vals

Function _diff_vals

dvc/utils/diff.py:18–29  ·  view source on GitHub ↗
(old, new, with_unchanged)

Source from the content-addressed store, hash-verified

16
17
18def _diff_vals(old, new, with_unchanged):
19 if isinstance(new, list) and isinstance(old, list) and len(old) == len(new) == 1:
20 return _diff_vals(old[0], new[0], with_unchanged)
21
22 if not with_unchanged and old == new:
23 return {}
24
25 res = {"old": old, "new": new}
26 if isinstance(new, (int, float)) and isinstance(old, (int, float)):
27 res["diff"] = new - old
28
29 return res
30
31
32def _flatten(d):

Callers 2

_diff_dictsFunction · 0.85
_diffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected