pint icon indicating copy to clipboard operation
pint copied to clipboard

Type error when creating Quantity in 0.24.4

Open brearleyt opened this issue 1 year ago • 2 comments

After upgrading to 0.24.4, I get a type error for this example:

Code:

from pint import UnitRegistry

ureg = UnitRegistry()

distance = 24.0 * ureg.meter

Error:

example.py:5:1 - error: Type of "distance" is partially unknown
  Type of "distance" is "Unit | Unknown | PlainQuantity[Any] | _NotImplementedType" (reportUnknownVariableType)

I am using pyright 1.1.388 on strict mode.

When using 0.24.3, pyright was able to infer the type of distance as _NotImplementedType | Quantity and did not raise any errors.

brearleyt avatar Nov 08 '24 08:11 brearleyt

I think this is because __mul__ is not typed.

reteps avatar May 07 '25 20:05 reteps

Duplicate of #1947

reteps avatar May 07 '25 20:05 reteps