Skip to content

Commit

Permalink
fix: Sequence Matcher shouldn't get None input (frappe#23539)
Browse files Browse the repository at this point in the history
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
  • Loading branch information
marination and nabinhait committed Nov 17, 2020
1 parent d3074c3 commit 2c29933
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ def check_amount_vs_description(amount_matching, description_matching):
continue

if "reference_no" in am_match and "reference_no" in des_match:
if difflib.SequenceMatcher(lambda x: x == " ", am_match["reference_no"], des_match["reference_no"]).ratio() > 70:
# Sequence Matcher does not handle None as input
am_reference = am_match["reference_no"] or ""
des_reference = des_match["reference_no"] or ""

if difflib.SequenceMatcher(lambda x: x == " ", am_reference, des_reference).ratio() > 70:
if am_match not in result:
result.append(am_match)
if result:
Expand Down

0 comments on commit 2c29933

Please sign in to comment.