Revert "Lift returned value closer to condition, drop else"

This reverts commit 2415554a65.
This commit is contained in:
overflowy
2022-11-08 22:37:21 +01:00
parent 33116aa8c5
commit 3148b60521

View File

@@ -259,12 +259,13 @@ class Scalar(NamedTuple):
"""
if token.lower() == "auto":
scalar = cls(1.0, Unit.AUTO, Unit.AUTO)
return scalar
match = _MATCH_SCALAR(token)
if match is None:
raise ScalarParseError(f"{token!r} is not a valid scalar")
value, unit_name = match.groups()
scalar = cls(float(value), SYMBOL_UNIT[unit_name or ""], percent_unit)
else:
match = _MATCH_SCALAR(token)
if match is None:
raise ScalarParseError(f"{token!r} is not a valid scalar")
value, unit_name = match.groups()
scalar = cls(float(value), SYMBOL_UNIT[unit_name or ""], percent_unit)
return scalar
@lru_cache(maxsize=4096)
def resolve_dimension(