Repository navigation
Parse from_ucum into the registry instance - #80
Merged
Merged
Conversation
PintUcumRegistry built its transformer without passing itself, so
from_ucum parsed into the application registry and ignored the
instance's options (non_int_type, case_sensitive, ...).
The transformer also computed the implicit 1 of a unary division (/h)
and of an annotation in a term ({rbc}/L) as the int 1, which mixes
float and Decimal in a Decimal registry. It now uses the registry's
number type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks for the PR. The change is fine. But I would prefer not to have this "Co-Authored-By: Claude Opus 5.5" nonsense in ucumvert. It is your contribution and CC is just a tool not an author. I merge nevertheless as its not worth to delay the fix for this. I should probably add an AI Covenant file... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #79.
PintUcumRegistrybuilds its transformer withureg=self, sofrom_ucumreturns quantities of the instance and honours its options (non_int_type,case_sensitive, …).UcumToPintTransformeruses the registry's number type for the implicit 1 of a unary division (/h) and of an annotation in a term ({rbc}/L), so aDecimalregistry doesn't mix float and Decimal. A float registry gives the same results as before.PintUcumRegistry(non_int_type=Decimal),from_ucumreturns quantities of that registry, andmL,/hand{rbc}/Lconvert to base units as exactDecimals (mL→0.000001). They fail without the change.The full suite passes with pint 0.25.3 (3548 passed, 10 skipped).
ruff checkreports the same sixPLC0415findings intests/conftest.pyas on main.🤖 Generated with Claude Code