summaryrefslogtreecommitdiff
path: root/pint/formatting.py
diff options
context:
space:
mode:
Diffstat (limited to 'pint/formatting.py')
-rw-r--r--pint/formatting.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pint/formatting.py b/pint/formatting.py
index b8b3370..554b381 100644
--- a/pint/formatting.py
+++ b/pint/formatting.py
@@ -157,7 +157,7 @@ def register_unit_format(name):
def wrapper(func):
if name in _FORMATTERS:
- raise ValueError(f"format {name:!r} already exists") # or warn instead
+ raise ValueError(f"format {name!r} already exists") # or warn instead
_FORMATTERS[name] = func
return wrapper
@@ -439,8 +439,9 @@ def siunitx_format_unit(units, registry):
lpick = lpos if power >= 0 else lneg
prefix = None
+ # TODO: fix this to be fore efficient and detect also aliases.
for p in registry._prefixes.values():
- p = str(p)
+ p = str(p.name)
if len(p) > 0 and unit.find(p) == 0:
prefix = p
unit = unit.replace(prefix, "", 1)