diff --git a/pint/delegates/formatter/_compound_unit_helpers.py b/pint/delegates/formatter/_compound_unit_helpers.py index c8ac1e2d9..46934c063 100644 --- a/pint/delegates/formatter/_compound_unit_helpers.py +++ b/pint/delegates/formatter/_compound_unit_helpers.py @@ -246,6 +246,7 @@ def prepare_compount_unit( locale: Locale | str | None = None, as_ratio: bool = True, registry: UnitRegistry | None = None, + empty_numerator_fmt="1", ) -> tuple[Iterable[tuple[str, T]], Iterable[tuple[str, T]]]: """Format compound unit into unit container given an spec and locale. diff --git a/pint/delegates/formatter/plain.py b/pint/delegates/formatter/plain.py index d03c00959..5cf77f3e0 100644 --- a/pint/delegates/formatter/plain.py +++ b/pint/delegates/formatter/plain.py @@ -81,7 +81,7 @@ def format_unit( unit: PlainUnit | Iterable[tuple[str, Any]], uspec: str = "", sort_func: SortFunc | None = None, - empty_numerator_fmt = "1", + empty_numerator_fmt="1", **babel_kwds: Unpack[BabelKwds], ) -> str: """Format a unit (can be compound) into string @@ -204,7 +204,7 @@ def format_unit( unit: PlainUnit | Iterable[tuple[str, Any]], uspec: str = "", sort_func: SortFunc | None = None, - empty_numerator_fmt = "1", + empty_numerator_fmt="1", **babel_kwds: Unpack[BabelKwds], ) -> str: numerator, denominator = prepare_compount_unit( @@ -316,16 +316,13 @@ def format_unit( unit: PlainUnit | Iterable[tuple[str, Any]], uspec: str = "", sort_func: SortFunc | None = None, - empty_numerator_fmt="1", - + empty_numerator_fmt="1", **babel_kwds: Unpack[BabelKwds], - ) -> str: numerator, denominator = prepare_compount_unit( unit, uspec, sort_func=sort_func, - **babel_kwds, registry=self._registry, ) @@ -346,8 +343,7 @@ def format_unit( power_fmt="{}{}", parentheses_fmt="({})", exp_call=pretty_fmt_exponent, - empty_numerator_fmt=empty_numerator_fmt, - + empty_numerator_fmt=empty_numerator_fmt, ) def format_quantity(