Skip to content

Commit

Permalink
Update pre-commit (#226)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and hugovk authored Jan 7, 2025
1 parent fd230cf commit fb61d5a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.8.6
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down Expand Up @@ -32,12 +32,12 @@ repos:
- id: check-renovate

- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
rev: v1.7.6
hooks:
- id: actionlint

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v0.9.1
rev: v1.0.0
hooks:
- id: zizmor

Expand Down
2 changes: 1 addition & 1 deletion src/humanize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"intcomma",
"intword",
"metric",
"natural_list",
"naturaldate",
"naturalday",
"naturaldelta",
"natural_list",
"naturalsize",
"naturaltime",
"ordinal",
Expand Down
4 changes: 2 additions & 2 deletions src/humanize/filesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def naturalsize(
abs_bytes = abs(bytes_)

if abs_bytes == 1 and not gnu:
return "%d Byte" % bytes_
return f"{bytes_} Byte"

if abs_bytes < base:
return ("%dB" if gnu else "%d Bytes") % bytes_
return f"{bytes_}B" if gnu else f"{bytes_} Bytes"

for i, s in enumerate(suffix, 2):
unit = base**i
Expand Down
2 changes: 1 addition & 1 deletion src/humanize/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def metric(value: float, unit: str = "", precision: int = 3) -> str:
ordinal_ = "mμnpfazyrq"[(-exponent - 1) // 3]
else:
ordinal_ = ""
value_ = format(value, ".%if" % max(0, precision - (exponent % 3) - 1))
value_ = format(value, f".{int(max(0, precision - exponent % 3 - 1))}f")
if not (unit or ordinal_) or unit in ("°", "′", "″"):
space = ""
else:
Expand Down
4 changes: 2 additions & 2 deletions src/humanize/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from .number import intcomma

__all__ = [
"naturaldate",
"naturalday",
"naturaldelta",
"naturaltime",
"naturalday",
"naturaldate",
"precisedelta",
]

Expand Down

0 comments on commit fb61d5a

Please sign in to comment.