Skip to content

Commit

Permalink
Merge pull request #67 from molisani/patch-1
Browse files Browse the repository at this point in the history
Simplify float validation logic
  • Loading branch information
jarondl authored Nov 10, 2022
2 parents bdeae2a + 9172033 commit 5ba9313
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pygtfs/gtfs_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,9 @@ def in_range(self, key, value):
def _validate_float_none(*field_names):
@validates(*field_names)
def is_float_none(self, key, value):
try:
return float(value)
except ValueError:
if value is None or value == "":
return None
else:
raise
if value is None or value == "":
return None
return float(value)
return is_float_none


Expand Down

0 comments on commit 5ba9313

Please sign in to comment.