From 7979d07a9be53e23f1535ec7c5258289e1998d83 Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Sat, 15 Jul 2023 15:46:24 -0300 Subject: [PATCH] In _parse_units make as_delta and case_sensitive mandatory and pure boolean. Also make external uses of _parse_units to parse_units --- pint/facets/plain/registry.py | 4 ++-- pint/util.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pint/facets/plain/registry.py b/pint/facets/plain/registry.py index 903620b2e..903fad9d1 100644 --- a/pint/facets/plain/registry.py +++ b/pint/facets/plain/registry.py @@ -1167,8 +1167,8 @@ def parse_units( def _parse_units( self, input_string: str, - as_delta: bool = True, - case_sensitive: Optional[bool] = None, + as_delta: bool, + case_sensitive: bool, ) -> UnitsContainer: """Parse a units expression and returns a UnitContainer with the canonical names. diff --git a/pint/util.py b/pint/util.py index e940ea6c2..340a38789 100644 --- a/pint/util.py +++ b/pint/util.py @@ -1039,8 +1039,7 @@ def to_units_container( return unit_like._units elif str in mro: if registry: - # TODO: Why not parse.units here? - return registry._parse_units(unit_like) + return registry.parse_units(unit_like) else: return ParserHelper.from_string(unit_like) elif dict in mro: