diff options
author | BonfaceKilz | 2022-02-24 15:32:33 +0300 |
---|---|---|
committer | BonfaceKilz | 2022-03-12 15:33:09 +0300 |
commit | 613987ef99009574bfd403973210de4d90da7c73 (patch) | |
tree | 339d29530598c54ab32c31eceb15d4f2360eafe3 /gn3/csvcmp.py | |
parent | 17d0e4239f6cb1d5c3820730162b3f59d83dac68 (diff) | |
download | genenetwork3-613987ef99009574bfd403973210de4d90da7c73.tar.gz |
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.
Diffstat (limited to 'gn3/csvcmp.py')
-rw-r--r-- | gn3/csvcmp.py | 8 |
1 files 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({ |