Skip to content

Commit

Permalink
pre-commit autoupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Feb 12, 2022
1 parent 8f2c855 commit 48506d4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
rev: v2.31.0
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/psf/black
rev: 21.11b1
rev: 22.1.0
hooks:
- id: black
args: [--target-version=py37]
Expand Down Expand Up @@ -42,7 +42,7 @@ repos:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand All @@ -57,7 +57,7 @@ repos:
files: "src/"

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 0.5.1
rev: 0.5.2
hooks:
- id: tox-ini-fmt

Expand Down
6 changes: 3 additions & 3 deletions src/humanize/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ def intcomma(value, ndigits=None):
else:
orig = str(value)

new = re.sub(r"^(-?\d+)(\d{3})", fr"\g<1>{sep}\g<2>", orig)
new = re.sub(r"^(-?\d+)(\d{3})", rf"\g<1>{sep}\g<2>", orig)
if orig == new:
return new
else:
return intcomma(new)


powers = [10 ** x for x in (3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 100)]
powers = [10**x for x in (3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 100)]
human_powers = (
NS_("thousand", "thousand"),
NS_("million", "million"),
Expand Down Expand Up @@ -197,7 +197,7 @@ def intword(value, format="%.1f"):
for ordinal, power in enumerate(powers[1:], 1):
if value < power:
chopped = value / float(powers[ordinal - 1])
if float(format % chopped) == float(10 ** 3):
if float(format % chopped) == float(10**3):
chopped = value / float(powers[ordinal])
singular, plural = human_powers[ordinal]
return (
Expand Down
8 changes: 4 additions & 4 deletions tests/test_filesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
([3000, False, True], "2.9K"),
([3000000, False, True], "2.9M"),
([1024, False, True], "1.0K"),
([10 ** 26 * 30, False, True], "2481.5Y"),
([10 ** 26 * 30, True], "2481.5 YiB"),
([10 ** 26 * 30], "3000.0 YB"),
([10**26 * 30, False, True], "2481.5Y"),
([10**26 * 30, True], "2481.5 YiB"),
([10**26 * 30], "3000.0 YB"),
([1, False, False], "1 Byte"),
([3141592, False, False, "%.2f"], "3.14 MB"),
([3000, False, True, "%.3f"], "2.930K"),
([3000000000, False, True, "%.0f"], "3G"),
([10 ** 26 * 30, True, False, "%.3f"], "2481.542 YiB"),
([10**26 * 30, True, False, "%.3f"], "2481.542 YiB"),
],
)
def test_naturalsize(test_args, expected):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_intword_powers():
(["8100000000000000000000000000000000"], "8.1 decillion"),
([None], None),
(["1230000", "%0.2f"], "1.23 million"),
([10 ** 101], "1" + "0" * 101),
([10**101], "1" + "0" * 101),
],
)
def test_intword(test_args, expected):
Expand Down

0 comments on commit 48506d4

Please sign in to comment.