Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Jul 2, 2024
2 parents b47d5ee + cae4163 commit 2a141c7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 44 deletions.
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.5.0
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.3.0
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: forbid-submodules
- id: trailing-whitespace
exclude: \.github/ISSUE_TEMPLATE\.md|\.github/PULL_REQUEST_TEMPLATE\.md

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies: [pytest, types-freezegun, types-setuptools]
args: [--strict, --pretty, --show-error-codes, .]
pass_filenames: false

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
rev: 2.1.3
hooks:
- id: pyproject-fmt
additional_dependencies: [tox]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
rev: v0.18
hooks:
- id: validate-pyproject

Expand Down
78 changes: 42 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ readme = "README.md"
keywords = [
"humanize time size",
]
license = {text = "MIT"}
maintainers = [{name = "Hugo van Kemenade"}]
authors = [{name = "Jason Moiron", email = "[email protected]"}]
license = { text = "MIT" }
maintainers = [
{ name = "Hugo van Kemenade" },
]
authors = [
{ name = "Jason Moiron", email = "[email protected]" },
]
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -37,19 +41,17 @@ classifiers = [
dynamic = [
"version",
]
[project.optional-dependencies]
tests = [
optional-dependencies.tests = [
"freezegun",
"pytest",
"pytest-cov",
]
[project.urls]
Documentation = "https://humanize.readthedocs.io/"
Funding = "https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=pypi"
Homepage = "https://github.com/python-humanize/humanize"
"Issue tracker" = "https://github.com/python-humanize/humanize/issues"
"Release notes" = "https://github.com/python-humanize/humanize/releases"
Source = "https://github.com/python-humanize/humanize"
urls.Documentation = "https://humanize.readthedocs.io/"
urls.Funding = "https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=pypi"
urls.Homepage = "https://github.com/python-humanize/humanize"
urls."Issue tracker" = "https://github.com/python-humanize/humanize/issues"
urls."Release notes" = "https://github.com/python-humanize/humanize/releases"
urls.Source = "https://github.com/python-humanize/humanize"

[tool.hatch]
version.source = "vcs"
Expand All @@ -65,38 +67,42 @@ local_scheme = "no-local-version"
[tool.ruff]
fix = true

[tool.ruff.lint]
select = [
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle errors
"EM", # flake8-errmsg
"F", # pyflakes errors
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PGH", # pygrep-hooks
lint.select = [
"C4", # flake8-comprehensions
"D", # pydocstyle
"E", # pycodestyle errors
"EM", # flake8-errmsg
"F", # pyflakes errors
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PGH", # pygrep-hooks
"PYI", # flake8-pyi
"RUF022", # unsorted-dunder-all
"RUF100", # unused noqa (yesqa)
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
"UP", # pyupgrade
"W", # pycodestyle warnings
"YTT", # flake8-2020
]
extend-ignore = [
lint.extend-ignore = [
"E203", # Whitespace before ':'
"E221", # Multiple spaces before operator
"E226", # Missing whitespace around arithmetic operator
"E241", # Multiple spaces after ','
]
lint.per-file-ignores."tests/*" = [
"D",
]
lint.isort.known-first-party = [
"humanize",
]
lint.isort.required-imports = [
"from __future__ import annotations",
]
lint.pydocstyle.convention = "google"

[tool.ruff.lint.isort]
known-first-party = ["humanize"]
required-imports = ["from __future__ import annotations"]

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D"]
[tool.pyproject-fmt]
max_supported_python = "3.13"

[tool.pytest.ini_options]
addopts = "--color=yes"
Expand Down
2 changes: 1 addition & 1 deletion src/humanize/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def scientific(value: NumberOrString, precision: int = 2) -> str:
return _format_not_finite(value)
except (ValueError, TypeError):
return str(value)
fmt = "{:.%se}" % str(int(precision))
fmt = f"{{:.{str(int(precision))}e}}"
n = fmt.format(value)
part1, part2 = n.split("e")
# Remove redundant leading '+' or '0's (preserving the last '0' for 10⁰).
Expand Down

0 comments on commit 2a141c7

Please sign in to comment.