Skip to content
Snippets Groups Projects
Commit bc89b002 authored by Theodore Chang's avatar Theodore Chang
Browse files

Merge branch 'account-for-list-pint' into 'develop'

Account for list of pint quantities

See merge request !2080
parents 256f55de fae691c8
No related branches found
No related tags found
1 merge request!2080Account for list of pint quantities
Pipeline #217838 passed
......@@ -273,10 +273,19 @@ class Primitive(Datatype):
if value is None:
return value
if isinstance(value, pint.Quantity):
def extract_magnitude(v):
if isinstance(v, (list, tuple)):
return [extract_magnitude(x) for x in v]
if not isinstance(v, pint.Quantity):
return v
if self.unit is not None:
value = value.to(self.unit)
value = value.magnitude
v = v.to(self.unit)
return v.magnitude
value = extract_magnitude(value)
if self.is_scalar:
given_type = type(value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment