hgrecco
pint
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
Fix is_compatible_with edge cases with dimensionless types and strings (#2370) Following on from #1191: - UnitRegistry.is_compatible_with(obj1, obj2) was asymmetric: if obj1 was a plain number/array (not a Quantity, Unit, or str) it always returned `not isinstance(obj2, (Quantity, Unit))`, ignoring obj2's actual dimensionality. Now it swaps the arguments (delegating to obj2's is_compatible_with) when obj2 is a Quantity/Unit/str, and otherwise treats obj1 as a dimensionless Quantity. - Quantity.is_compatible_with() and Unit.is_compatible_with() used parse_units() for string arguments, which rejects strings with a scaling factor (e.g. "35000 ft"). Switched to parse_expression(). Fixes #1190
master
4 minutes ago
Fix is_compatible_with edge cases with dimensionless types and strings Following on from #1191: - UnitRegistry.is_compatible_with(obj1, obj2) was asymmetric: if obj1 was a plain number/array (not a Quantity, Unit, or str) it always returned `not isinstance(obj2, (Quantity, Unit))`, ignoring obj2's actual dimensionality. Now it swaps the arguments (delegating to obj2's is_compatible_with) when obj2 is a Quantity/Unit/str, and otherwise treats obj1 as a dimensionless Quantity. - Quantity.is_compatible_with() and Unit.is_compatible_with() used parse_units() for string arguments, which rejects strings with a scaling factor (e.g. "35000 ft"). Switched to parse_expression(). Fixes #1190
andrewgsavage:fix/is-compatible-with-1190
5 minutes ago
Merge branch 'master' into nonreducing
andrewgsavage:nonreducing
14 minutes ago
Fix is_compatible_with edge cases with dimensionless types and strings Following on from #1191: - UnitRegistry.is_compatible_with(obj1, obj2) was asymmetric: if obj1 was a plain number/array (not a Quantity, Unit, or str) it always returned `not isinstance(obj2, (Quantity, Unit))`, ignoring obj2's actual dimensionality. Now it swaps the arguments (delegating to obj2's is_compatible_with) when obj2 is a Quantity/Unit/str, and otherwise treats obj1 as a dimensionless Quantity. - Quantity.is_compatible_with() and Unit.is_compatible_with() used parse_units() for string arguments, which rejects strings with a scaling factor (e.g. "35000 ft"). Switched to parse_expression(). Fixes #1190
andrewgsavage:fix/is-compatible-with-1190
16 minutes ago
Merge remote-tracking branch 'origin/master' into toml # Conflicts: # .github/workflows/bench.yml # pint/testsuite/test_formatting.py # pyproject.toml # requirements_docs.txt
andrewgsavage:toml
28 minutes ago
Allow string parsing of offset units (#2300) * Updated CHANGES * added test to highlight the issue * Fixes issue #386 * update changelog * Fix test_issue_386 and update test expectations for implicit multiplication - Add degC/m raises OffsetUnitCalculusError test - Update parse tree expectations to use implicit op (space) not explicit * Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update CHANGES: move offset unit parsing to 0.26, remove stale entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add comment for implicit multiplication replacement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Hernan <hernan.grecco@gmail.com> Co-authored-by: Yves Delley <delleyves@gmx.ch> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
master
32 minutes ago
Merge branch 'master' into fix/offset-units-string-parsing-386
andrewgsavage:fix/offset-units-string-parsing-386
35 minutes ago
Support * and / between Quantity and datetime.timedelta (#2367) * Support * and / between Quantity and datetime.timedelta timedelta is converted to a Quantity in seconds before the operation, so `q * timedelta(...)` and `q / timedelta(...)` (and their reflected forms) return a proper Quantity instead of one wrapping a raw timedelta magnitude. Also fixes datetime.timedelta-initialized Quantities using a non-canonical units-container key (e.g. "seconds" instead of "second"), which surfaced when routing timedelta operands through regular Quantity arithmetic. Fixes #2348 * Support + and - between Quantity and datetime.timedelta Extends the same timedelta-to-Quantity conversion used for * and / to addition and subtraction (and their in-place/reflected forms), so `q + timedelta(...)` behaves like adding a Quantity in seconds instead of raising DimensionalityError against dimensionless.
master
56 minutes ago
Latest Branches
CodSpeed Performance Gauge
+31%
Fix is_compatible_with edge cases with dimensionless types and strings
#2370
58 minutes ago
b63d97c
andrewgsavage:fix/is-compatible-with-1190
CodSpeed Performance Gauge
+3%
Nonreducing
#1993
56 minutes ago
91824f2
andrewgsavage:nonreducing
CodSpeed Performance Gauge
+46%
Toml
#2133
1 hour ago
05c3ce3
andrewgsavage:toml
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs