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

Implement registry-based string preprocessing as list of callables #911

Merged
merged 1 commit into from
Dec 5, 2019

Conversation

jthielen
Copy link
Contributor

@jthielen jthielen commented Dec 4, 2019

As suggested in #429, this implements simple registry-based unit/expression string preprocessing through a list of callables.

There are a couple questions I was wondering about:

  • Is the added argument to the docstring sufficient documentation, or would additional documentation (such as an example with percent as in How to use sign %? #429) be useful?
  • Right now, the unit string preprocessing occurs in parse_units, rather than _parse_units, which avoids the cache. For performance reasons, would it be worth the extra complexity of cache invalidation to have this moved inside _parse_units after the cache check?

Closes #429
Closes #851

pint/registry.py Outdated Show resolved Hide resolved
@hgrecco
Copy link
Owner

hgrecco commented Dec 5, 2019

bors r+

bors bot added a commit that referenced this pull request Dec 5, 2019
911: Implement registry-based string preprocessing as list of callables r=hgrecco a=jthielen

As suggested in #429, this implements simple registry-based unit/expression string preprocessing through a list of callables.

There are a couple questions I was wondering about:
- Is the added argument to the docstring sufficient documentation, or would additional documentation (such as an example with percent as in #429) be useful?
- Right now, the unit string preprocessing occurs in `parse_units`, rather than `_parse_units`, which avoids the cache. For performance reasons, would it be worth the extra complexity of cache invalidation to have this moved inside `_parse_units` after the cache check?

Closes #429
Closes #851

Co-authored-by: Jon Thielen <github@jont.cc>
@hgrecco
Copy link
Owner

hgrecco commented Dec 5, 2019

i am merging this now, but I think before launching the next version we need to revisit the docs and improve it.
Regarding the cache, let's see if we actually need it

@bors
Copy link
Contributor

bors bot commented Dec 5, 2019

Build succeeded

@bors bors bot merged commit ec76aa1 into hgrecco:master Dec 5, 2019
tgbugs added a commit to tgbugs/parsercomb that referenced this pull request Jun 22, 2022
there was a bugfix in pint 19 that means that the percent sign in
units has to be expanded so that it is not treated as a unary operator

see hgrecco/pint#911 for details/examples/links
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.

Possibility of support for CF/UDUNITS-style powers of units How to use sign %?
2 participants