Skip to content
New issue

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

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

Already on GitHub? # to your account

ModeSpec accepts bend_radius = np.nan, but error in runtime #2112

Open
FilipeFcp opened this issue Dec 6, 2024 · 2 comments
Open

ModeSpec accepts bend_radius = np.nan, but error in runtime #2112

FilipeFcp opened this issue Dec 6, 2024 · 2 comments
Assignees

Comments

@FilipeFcp
Copy link
Contributor

I noticed that it is possible to pass the bend_radius argument of the ModeSpec object as np.nan. However, this will cause an error in runtime.

I believe it is worth to add a validator for that.

@momchil-flex
Copy link
Collaborator

This is unlikely to be limited to bend_radius, but rather to anything that's e.g. a float. There may be some native pydantic way to validate nans.

@caseyflex
Copy link
Contributor

caseyflex commented Dec 10, 2024

Yeah something like

class Finite(BaseModel):
    value: confloat(allow_inf_nan=False)

https://stackoverflow.com/questions/72472526/how-to-filter-out-nan-by-pydantic

We would have to replace float -> Finite everywhere. There was some discussion about changing our use of pydantic so I think this should wait (and is anyway pretty low priority)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants