Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading