-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: correct parsing scientific e notation as float #17
Conversation
For example: yaml_str = '''
x: 1e-4
y: !ref <x> * 0.1
'''
loaded_yaml = load_hyperpyyaml(yaml_str)
print(loaded_yaml)
print(type(loaded_yaml["x"]), type(loaded_yaml["y"])) with
with
|
@pplantinga hi, could you make a quick review for this MR? |
This is a known issue with pyyaml yaml/pyyaml#173 implementing the 1.1 spec instead of 1.2. To read these as floats, one could simply use While it would be nice to have this, the approach outlined here fails the tests, and looks to me like it would take some considerable effort to get the tests to pass again, since changing the engine is a significant change. If you're willing to put that work in, more power to you, but this is not a pressing enough issue for us to solve it on our side. |
Hi, it seems like the Loader didn't add the constructor. I added and it passed all tests offline. Could you approve again to see if it could pass all the tests on CI? |
This is an interesting solution, and I'm a little surprised that it works, but in the end it would be nice to solve #8, #12. I tried it with a working recipe, and it seems to work fine. Any objections to this change from @Gastron @TParcollet etc.? |
Oh interesting that this could solve our issue. I am a little scared because this gets used so much. However, that also means that we should quite quickly find if this runs into issues in some recipes. I am ok with merging, let's just be ready to rollback in case some big issue soon comes up. |
This MR should address #12 by simplify change
Loader
fromyaml
torumel.yaml
.