Skip to content

Commit

Permalink
fix: add a default value of 0 to min() to avoid a ValueError when an …
Browse files Browse the repository at this point in the history
…empty list is provided
  • Loading branch information
florianzwagemaker committed Aug 8, 2023
1 parent a78dd5b commit c23301f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AmpliGone/cutlery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def PositionInOrBeforePrimer(pos, clist, max_lookaround):
"""
d = lambda x: abs(x - pos)
near = min(clist, key=d)
near = min(clist, key=d, default=0)
return abs(pos - near) < max_lookaround and pos <= near


Expand All @@ -47,7 +47,7 @@ def PositionInOrAfterPrimer(pos, clist, max_lookaround):
"""
d = lambda x: abs(x - pos)
near = min(clist, key=d)
near = min(clist, key=d, default=0)
return abs(pos - near) < max_lookaround and pos >= near


Expand Down

0 comments on commit c23301f

Please sign in to comment.