Skip to content

Commit

Permalink
Merge pull request #265 from hassec/hassec_pint
Browse files Browse the repository at this point in the history
fix(pint>=0.20) use pint.Quantity for isintance check instead of pint.quantity._Quantity
  • Loading branch information
orso82 authored Aug 16, 2023
2 parents 47ae79c + e8b01a7 commit 0cd6e21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions omas/omas_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,11 +961,11 @@ def __setitem__(self, key, value):

if (
'units' in info
and isinstance(value, pint.quantity._Quantity)
and isinstance(value, pint.Quantity)
or (
isinstance(value, numpy.ndarray)
and value.size
and isinstance(numpy.atleast_1d(value).flat[0], pint.quantity._Quantity)
and isinstance(numpy.atleast_1d(value).flat[0], pint.Quantity)
)
):
value = value.to(info['units']).magnitude
Expand Down

0 comments on commit 0cd6e21

Please sign in to comment.