u 3.0__tar.gz → 3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {u-3.0 → u-3.1}/PKG-INFO +1 -1
- {u-3.0 → u-3.1}/changelog.md +5 -0
- {u-3.0 → u-3.1}/tests/test_quantities.py +5 -0
- {u-3.0 → u-3.1}/u/__init__.py +1 -1
- {u-3.0 → u-3.1}/u/quantity.py +8 -0
- {u-3.0 → u-3.1}/.gitignore +0 -0
- {u-3.0 → u-3.1}/LICENSE.txt +0 -0
- {u-3.0 → u-3.1}/README.md +0 -0
- {u-3.0 → u-3.1}/docs/api/quantity.md +0 -0
- {u-3.0 → u-3.1}/docs/api/unit.md +0 -0
- {u-3.0 → u-3.1}/docs/index.md +0 -0
- {u-3.0 → u-3.1}/mkdocs.yml +0 -0
- {u-3.0 → u-3.1}/pyproject.toml +0 -0
- {u-3.0 → u-3.1}/tests/static_tests.py +0 -0
- {u-3.0 → u-3.1}/tests/test_conversions.py +0 -0
- {u-3.0 → u-3.1}/tests/test_decimal.py +0 -0
- {u-3.0 → u-3.1}/tests/test_math.py +0 -0
- {u-3.0 → u-3.1}/tests/test_prefixes.py +0 -0
- {u-3.0 → u-3.1}/tests/test_typing.py +0 -0
- {u-3.0 → u-3.1}/tests/test_units.py +0 -0
- {u-3.0 → u-3.1}/u/_utils.py +0 -0
- {u-3.0 → u-3.1}/u/capital_quantities.py +0 -0
- {u-3.0 → u-3.1}/u/cli/__init__.py +0 -0
- {u-3.0 → u-3.1}/u/cli/make_derived_quantity.py +0 -0
- {u-3.0 → u-3.1}/u/maths.py +0 -0
- {u-3.0 → u-3.1}/u/prefixes.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/__init__.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/acceleration.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/amount_of_substance.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/angle.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/area.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/data_transfer_speed.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/data_volume.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/distance.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/duration.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/electric_charge.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/electric_current.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/electric_resistance.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/energy.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/force.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/frequency.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/luminous_intensity.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/mass.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/one.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/pixels.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/power.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/pressure.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/solid_angle.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/speed.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/temperature.py +0 -0
- {u-3.0 → u-3.1}/u/quantities/volume.py +0 -0
- {u-3.0 → u-3.1}/u/unit.py +0 -0
- {u-3.0 → u-3.1}/uv.lock +0 -0
{u-3.0 → u-3.1}/PKG-INFO
RENAMED
{u-3.0 → u-3.1}/changelog.md
RENAMED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
# 3.1
|
|
2
|
+
|
|
3
|
+
- Add `__hash__` method
|
|
4
|
+
|
|
1
5
|
# 3.0
|
|
2
6
|
|
|
3
7
|
- Add support for `decimal.Decimal`. Unlike floats and Decimals, which throw a TypeError when used
|
|
4
8
|
together, `Quantity`s remain interoperable regardless of whether they were created with a float or
|
|
5
9
|
a Decimal.
|
|
6
10
|
- `Unit.multiplier` is now a Decimal.
|
|
11
|
+
- Add `systems` parameter and attribute to `Unit`
|
|
7
12
|
|
|
8
13
|
# 2.1
|
|
9
14
|
|
{u-3.0 → u-3.1}/u/__init__.py
RENAMED
{u-3.0 → u-3.1}/u/quantity.py
RENAMED
|
@@ -417,6 +417,14 @@ class Quantity(t.Generic[Q_co], metaclass=QuantityMeta):
|
|
|
417
417
|
def __neg__(self) -> Quantity[Q_co]:
|
|
418
418
|
return Quantity(-self._value, self._unit)
|
|
419
419
|
|
|
420
|
+
# TODO: Rethink equality. I threw in `math.isclose` because I expected problems with floating
|
|
421
|
+
# point precision, but failed to realize that this breaks the "transitive" property of equality.
|
|
422
|
+
# (It's now possible to have 3 quantities A, B, C where B is equal to A and C, but A is not
|
|
423
|
+
# equal to C.)
|
|
424
|
+
def __hash__(self) -> int:
|
|
425
|
+
rounded_value = round(self._value, 10)
|
|
426
|
+
return hash((rounded_value, self._unit))
|
|
427
|
+
|
|
420
428
|
def __eq__(self, quantity: object, /) -> bool:
|
|
421
429
|
if quantity == 0:
|
|
422
430
|
num = float(self)
|
{u-3.0 → u-3.1}/.gitignore
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/LICENSE.txt
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
{u-3.0 → u-3.1}/docs/api/unit.md
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/docs/index.md
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/mkdocs.yml
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{u-3.0 → u-3.1}/u/_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{u-3.0 → u-3.1}/u/maths.py
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/u/prefixes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{u-3.0 → u-3.1}/u/unit.py
RENAMED
|
File without changes
|
{u-3.0 → u-3.1}/uv.lock
RENAMED
|
File without changes
|