From aba62bb0bafd2c0ebf575166fa1bf7ffc601285a Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Fri, 19 Jan 2024 02:47:32 -0300 Subject: [PATCH] Create function to join magnitude and units that deal with 3 1 / s --- pint/delegates/formatter/_helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pint/delegates/formatter/_helpers.py b/pint/delegates/formatter/_helpers.py index 7a9898364..3c130d3b8 100644 --- a/pint/delegates/formatter/_helpers.py +++ b/pint/delegates/formatter/_helpers.py @@ -290,3 +290,9 @@ def split_format( uspec = uspec or default_uspec return mspec, uspec + + +def join_mu(joint_fstring: str, mstr: str, ustr: str) -> str: + if ustr.startswith("1 / "): + return joint_fstring.format(mstr, ustr[2:]) + return joint_fstring.format(mstr, ustr)