From 613987ef99009574bfd403973210de4d90da7c73 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 24 Feb 2022 15:32:33 +0300 Subject: Replace "all" with "and" * gn3/csvcmp.py (remove_insignificant_edits): "all" evaluates all elements and throws an error if when `abs(float(x) - float(y)) < epsilon` is processed. Use "and" instead because of it's short-circuiting behaviour. --- gn3/csvcmp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py index a525b91..35133dc 100644 --- a/gn3/csvcmp.py +++ b/gn3/csvcmp.py @@ -16,11 +16,9 @@ def remove_insignificant_edits(diff_data, epsilon=0.001): original = mod.get("Original").split(",") current = mod.get("Current").split(",") for i, (x, y) in enumerate(zip(original, current)): - if all([ - x.replace('.', '').isdigit(), - y.replace('.', '').isdigit(), - abs(float(x) - float(y)) < epsilon, - ]): + if (x.replace('.', '').isdigit() and + y.replace('.', '').isdigit() and + abs(float(x) - float(y)) < epsilon): current[i] = x if not (__o := ",".join(original)) == (__c := ",".join(current)): _mod.append({ -- cgit v1.2.3