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

Extend parsing of Scientific Notation to JSON capabilites #1956

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

maximilian-tech
Copy link

@maximilian-tech maximilian-tech commented May 11, 2024

Solves Issues #1955 (comment) and #1952 (comment)

It boils down to yaml vs. json floating point parsing. The SafeLoader of yaml has to be extended to allow for the same range of float notations like json.
See here for more background.
I copied the SO-solution and it does work (for me)

Copy link

codecov bot commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8eccc15) to head (0120a77).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1956   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           38        38           
  Lines         4285      4287    +2     
  Branches       987       987           
=========================================
+ Hits          4285      4287    +2     
Flag Coverage Δ
unittests 99.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented May 11, 2024

CodSpeed Performance Report

Merging #1956 will not alter performance

Comparing maximilian-tech:Fix_parsing_scientific_notation (0120a77) with main (8eccc15)

Summary

✅ 30 untouched benchmarks

@koxudaxi
Copy link
Owner

koxudaxi commented Jun 5, 2024

@maximilian-tech
I'm sorry for my late reply.
Thank you for creating the PR.
The PR looks good.
But Can we add your changes as a CLI option?
Because I avoid to change the default behavior for existing users.

@maximilian-tech
Copy link
Author

Hi,

I like your consideration towards older users by not breaking the current behavior.

However, I am not sure how such a flag should be called:
--parse-json-as-json or --extend-yaml-scientifc-notation?

I really think, that this is a bug, as only now JSON is parsed correctly, and should be the new default behavior.

However, I would be happy either way :)

Thanks for this nice tool!

@koxudaxi
Copy link
Owner

koxudaxi commented Jun 5, 2024

Thank you for agreeing with our opinion.
I prefer --extend-yaml-scientifc-notation.
Of course, the cli help should explain it a bit more.

I really think, that this is a bug, as only now JSON is parsed correctly, and should be the new default behavior.

I agree that this is the case in most cases, but the problem is that being right often gets someone in trouble 😅
It would be appropriate to change to the default behavior as a breaking change during a major version upgrade. It is pretty legitimate.

@maximilian-tech
Copy link
Author

It would be appropriate to change to the default behavior as a breaking change during a major version upgrade.

Agreed. 👍

@maximilian-tech
Copy link
Author

I just wanted to know what the next steps would be. I really would like to have it in the main branch.

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.

2 participants