Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify float validation logic #67

Merged
merged 1 commit into from
Nov 10, 2022
Merged

Conversation

molisani
Copy link
Contributor

@molisani molisani commented Oct 11, 2022

Resolves #58

In is_float_none, the except block is not necessary. It exists to capture a ValueError and return None if value is None or "". However, value can never be None here because float(None) throws a TypeError (see issue #58) which is not caught. As well, if value is "" then we return None and re-raise the error for any other value.

Instead, this conditional can be moved to the beginning of the function. Then, the float(value) will continue to raise exceptions for all non-"" values, and None will correctly return None.

@jarondl
Copy link
Owner

jarondl commented Nov 10, 2022

Thank you!

@jarondl jarondl merged commit 5ba9313 into jarondl:master Nov 10, 2022
@molisani molisani deleted the patch-1 branch November 10, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError when 'shape_dist_traveled' is empty
2 participants