From 09d0b8d85de262e2a0398140a6e411a0bb03d6fa Mon Sep 17 00:00:00 2001 From: James Crake-Merani Date: Thu, 12 Sep 2024 11:20:26 +0100 Subject: [PATCH] Use the new multiply function. --- sasdata/quantities/unit_parser.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sasdata/quantities/unit_parser.py b/sasdata/quantities/unit_parser.py index b4801fc..600f730 100644 --- a/sasdata/quantities/unit_parser.py +++ b/sasdata/quantities/unit_parser.py @@ -57,16 +57,8 @@ def parse_unit_stack(unit_str: str) -> list[Unit]: dimension_modifier = int(token) to_modify = unit_stack[-1] # FIXME: This is horrible but I'm not sure how to fix this without changing the Dimension class itself. - to_modify.dimensions = Dimensions( - length=to_modify.dimensions.length * dimension_modifier, - time=to_modify.dimensions.time * dimension_modifier, - mass=to_modify.dimensions.mass * dimension_modifier, - current=to_modify.dimensions.current * dimension_modifier, - temperature=to_modify.dimensions.temperature * dimension_modifier, - moles_hint=to_modify.dimensions.moles_hint * dimension_modifier, - angle_hint=to_modify.dimensions.angle_hint * dimension_modifier - ) - + multiplier = Dimensions(dimension_modifier, dimension_modifier, dimension_modifier, dimension_modifier, dimension_modifier, dimension_modifier, dimension_modifier) + to_modify.dimensions = multiply_dimensions(to_modify.dimensions, multiplier) except ValueError: new_units = parse_unit_strs(token) unit_stack += new_units