diff options
author | Keewis <keewis@posteo.de> | 2021-08-18 19:24:15 +0200 |
---|---|---|
committer | Keewis <keewis@posteo.de> | 2021-08-18 19:24:15 +0200 |
commit | b5dc48503800ee1b6264e0ff84ad47058c01a13a (patch) | |
tree | 82135c5a9fe3e4de89b0a7062b77f70e3024d8d5 /pint | |
parent | 139ce1655f5e78419308f96003bc2b9331b92b25 (diff) | |
download | pint-b5dc48503800ee1b6264e0ff84ad47058c01a13a.tar.gz |
convert to a code block
Diffstat (limited to 'pint')
-rw-r--r-- | pint/formatting.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/pint/formatting.py b/pint/formatting.py index e9b9c3a..a04205d 100644 --- a/pint/formatting.py +++ b/pint/formatting.py @@ -139,15 +139,17 @@ def register_unit_format(name): Examples -------- - >>> @pint.register_unit_format("custom") - ... def format_custom(unit, registry, **options): - ... result = "<formatted unit>" # do the formatting - ... return result - ... - >>> ureg = pint.UnitRegistry() - >>> u = ureg.m / ureg.s ** 2 - >>> f"{u:custom}" - '<formatted unit>' + .. code:: python + + @pint.register_unit_format("custom") + def format_custom(unit, registry, **options): + result = "<formatted unit>" # do the formatting + return result + + + ureg = pint.UnitRegistry() + u = ureg.m / ureg.s ** 2 + f"{u:custom}" """ def wrapper(func): |