File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import math
6- import re
76
87from .i18n import _gettext as _
98from .i18n import _ngettext , decimal_separator , thousands_separator
@@ -166,6 +165,8 @@ def intcomma(value: NumberOrString, ndigits: int | None = None) -> str:
166165 else :
167166 orig = str (value )
168167 orig = orig .replace ("." , decimal_sep )
168+ import re
169+
169170 while True :
170171 new = re .sub (r"^(-?\d+)(\d{3})" , rf"\g<1>{ thousands_sep } \g<2>" , orig )
171172 if orig == new :
@@ -430,6 +431,8 @@ def scientific(value: NumberOrString, precision: int = 2) -> str:
430431 n = fmt .format (value )
431432 part1 , part2 = n .split ("e" )
432433 # Remove redundant leading '+' or '0's (preserving the last '0' for 10⁰).
434+ import re
435+
433436 part2 = re .sub (r"^\+?(\-?)0*(.+)$" , r"\1\2" , part2 )
434437
435438 new_part2 = []
Original file line number Diff line number Diff line change 55
66from __future__ import annotations
77
8- import collections .abc
98import datetime as dt
109import math
1110from enum import Enum
@@ -328,7 +327,7 @@ def _quotient_and_remainder(
328327 divisor : float ,
329328 unit : Unit ,
330329 minimum_unit : Unit ,
331- suppress : collections . abc . Iterable [Unit ],
330+ suppress : Iterable [Unit ],
332331) -> tuple [float , float ]:
333332 """Divide `value` by `divisor` returning the quotient and remainder.
334333
You can’t perform that action at this time.
0 commit comments