(old, new, with_unchanged)
| 16 | |
| 17 | |
| 18 | def _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 | |
| 32 | def _flatten(d): |
no outgoing calls
no test coverage detected