WIP: Fix Offset conversion with prefix & conversions using offset units #1509
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.
pre-commit run --all-files
with no errorsWell it works but the implementation is so ugly.
It basically using an iterator to get converter from unit to base unit & making conversion from src to base & then from base to dst.
prefixed_src -> src_referenced -> ... -> base
base -> ... -> dst_reference -> prefixed_dst
It is similar to what happens with multiplicative, but this time I'm using an iterator instead of the recursive function used in get_roots_units with the accumulator.
I had to use some trickery for to identify the prefixed unit as non multiplicative.
I think we need to work on this, since if a converter is non multiplicative in this tree going back to base unit, well conversion will be non multiplicative.
If you guys have insights, I feel like this is clearly not OK in terms of clarity.