| Commit message (Collapse) | Author | Age | Files | Lines |
| |\
| |
| | |
custom unit formats
|
| | | |
|
| |\ \
| |/ |
|
| | | |
|
| | | |
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Quantity as Generic class
- Add overloaded signature for __new__ Quantity
- Add typing module as private
- Add py.typed for PEP561 supports
- Add overloaded signature for __new__ Quantity
- Quantity as Generic class
- Add type hints throughout the project
- Add py.typed in package data in setup.cfg
- Add type hints for decorators
- Add type hints for public API of registry.py
- Add type hints for units.py
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
More tests
CHANGES
Support pickle protocol 0/1
Polish
|
| |\ |
|
| | |\
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
999: Preparing the codebase for a better Decimal support r=hgrecco a=hgrecco
This is a series of three commits to prepare the codebase for a better Decimal support. These are mostly and internal clean up and should not affect any user.
- [ ] ~~Closes # (insert issue number)~~
- [x] Executed ``black -t py36 . && isort -rc . && flake8`` with no errors
- [ ] ~~The change is fully covered by automated unit tests~~
- [ ] ~~Documented in docs/ as appropriate~~
- [x] Added an entry to the CHANGES file
Co-authored-by: Hernan <hernan.grecco@gmail.com>
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Until this commit, `int` and `float` were special types in Pint
(just as they are in Python). Numbers were parsed from strings
as int/float from the definition files and from user provided
strings; and exponents of units were also stored as int/float.
This commit change this by adding a new argument (`non_int_type`)
to classes and methods. It indicates how numeric values will be parsed
and defaulted. Any numerical class can be used such as `float` (default),
Decimal, Fraction.
This argument will be found in the following places
1. UnitRegistry: used for parsing the definition files and any
value provided as a string.
2. UnitsContainer: used to compare equality with strings, multiply and
divide by strings (which is equivalent to parse the string)
3. All methods OUTSIDE the UnitRegistry/Quantity that can parse
strings have a `non_int_type` argument. (e.g. Definition.from_string)
Tests have been added for by duplicating most cases in `test_quantity.py`.
(Some tests have been deleted such as those dealing with numpy.)
The new file `test_non_int.py` run the tests for `Decimal`, `Fraction` and
`float` (which is redundant but is kept as a crosscheck for the implementation
of this testsuite)
BREAKING CHANGE: `use_decimal` is deprecated.
Use `non_int_type` keyword argument when instantiating the registry.
>>> from decimal import Decimal
>>> ureg = UnitRegistry(non_int_type=Decimal)
|
| |/
|
|
|
|
|
|
|
|
| |
In the original codebase, many accumulators, default values and so on were initialized
with floats (instead fo integers). The reason behind this decision was that in Python 2
the division (/) was by default an integer division if all values were ints. Therefore,
using a float ensured "the right result".
Now that the codebase is Python 3, we can safely use integers everywhere. This wil be
helpful when a different non integer type is desired.
|
| | |
|
| | |
|
| | |
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
920: Fix autoreducedimension conversion r=hgrecco a=jules-ch
* use iterable in function
* Raise an error when trying to remove non existing key
* Add test in test_issues.py
* Update registry.py to remove unit when unit exists
Closes #902
Co-authored-by: Jules Chéron <jules.cheron@gmail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
* use iterable in function
* Raise an error when trying to remove non existing key
* Add test in test_issues.py
* Update registry.py to remove unit when unit exists
Closes #902
|
| | | |
|
| | | |
|
| |\ \
| |/ |
|
| | | |
|
| | | |
|
| | | |
|
| |/
|
|
| |
# pint/registry.py
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
time
|
| |\ |
|
| | | |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|