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

Replace number stringification hack with custom YAML loader #4183

Merged
merged 3 commits into from
Jul 24, 2023

Conversation

kenodegard
Copy link
Contributor

This change was prompted by issues identified in #4179.

Instead of monkeypatching the yaml Loader every time it is used in an attempt to avoid parsing numbers make a custom Loader where the float/int tags are entirely removed.

This change also catches a number of cases that were previously missed. For example, pyyaml defined float resolvers for "-+0123456789." and int resolvers for "-+0123456789" and since the prior implementation only monkeypatched for "0123456789" it was still possible for numbers to be missed (e.g. ".0", "-1", "+1").

@anaconda-issue-bot anaconda-issue-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jan 16, 2021
@kenodegard kenodegard force-pushed the stringify-numbers branch 2 times, most recently from 3b5467b to fae6188 Compare January 21, 2021 16:17
@kenodegard
Copy link
Contributor Author

Yay! All done here!

@mingwandroid - no rush just let me know if anything here needs further work/discussion.

@jezdez
Copy link
Member

jezdez commented Aug 26, 2021

@kenodegard You identified a few cases that were previously missing, could you turn those cases into test cases please?

@kenodegard
Copy link
Contributor Author

Absolutely! I will need to revive some dormant brain cells first...

I'm assuming we'd want the tests written in test_metadata?

@kenodegard
Copy link
Contributor Author

kenodegard commented Sep 20, 2021

@jezdez added a few simple tests that are just checking to see if any int/floats occur in the parsed yaml. The zero, positive, and negative tests all fail on master.

@kenodegard
Copy link
Contributor Author

@anaconda-issue-bot check

Instead of monkeypatching the yaml Loader in an attempt to avoid parsing numbers make a custom Loader where the float/int tags are entirely removed.
@beeankha beeankha added the source::anaconda created by members of Anaconda, Inc. label Dec 7, 2022
@kenodegard kenodegard changed the title Custom yaml Loader Replace number stringification hack with custom YAML loader Jul 18, 2023
@kenodegard kenodegard requested a review from a team July 18, 2023 19:30
@kenodegard kenodegard self-assigned this Jul 18, 2023
@kenodegard kenodegard merged commit 25c695e into conda:main Jul 24, 2023
@kenodegard kenodegard deleted the stringify-numbers branch July 24, 2023 16:44
@kenodegard kenodegard mentioned this pull request Sep 26, 2023
36 tasks
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Jul 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity source::anaconda created by members of Anaconda, Inc.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants