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

DRYify input validation #452

Open
dylanhmorris opened this issue Sep 18, 2024 · 1 comment
Open

DRYify input validation #452

dylanhmorris opened this issue Sep 18, 2024 · 1 comment

Comments

@dylanhmorris
Copy link
Collaborator

dylanhmorris commented Sep 18, 2024

Would be good to have generic functions for common input validation tasks. Even better to depend on a well-liked/tested library for this.

Example: checking for an integer > x, which happens in a non-generic way here:

if not isinstance(differencing_order, int):
raise ValueError(
"differencing_order must be an integer. "
f"got type {type(differencing_order)} "
f"and value {differencing_order}"
)
if not differencing_order >= 1:
raise ValueError(
"differencing_order must be an integer "
"greater than or equal to 1. Got "
f"{differencing_order}"
)

@damonbayer
Copy link
Collaborator

Example: checking for an integer > x

This already part of #403

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

No branches or pull requests

2 participants