Skip to content

Commit

Permalink
Configure usage of pyupgrade and upgrade our code base
Browse files Browse the repository at this point in the history
  • Loading branch information
dlax committed Feb 21, 2024
1 parent 59b93ed commit 6b0edb8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ repos:
exclude: tests/test_*.txt
- repo: local
hooks:
- id: pyupgrade
name: pyupgrade
entry: pyupgrade --py38-plus --exit-zero-even-if-changed
language: system
types: [python]
- id: black
name: black
entry: black --check .
Expand Down
2 changes: 1 addition & 1 deletion pgactivity/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def add_column(key: str, name: str, **kwargs: Any) -> None:
key="database",
name="DATABASE(*)" if filters.dbname else "DATABASE",
min_width=max_db_length,
transform=functools.lru_cache()(
transform=functools.lru_cache(
lambda v: utils.ellipsis(v, width=16) if v else "",
),
sort_key=None,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dev = [
"flake8",
"isort",
"pre-commit",
"pyupgrade",
]
typing = [
"mypy",
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ deps =
black >= 24.2.0
flake8
isort
pre-commit
pyupgrade
commands =
codespell {toxinidir}
black --check --diff {toxinidir}
flake8 {toxinidir}
isort --check --diff {toxinidir}
pre-commit run --all-files --show-diff-on-failure pyupgrade

[testenv:mypy]
extras =
Expand Down

0 comments on commit 6b0edb8

Please sign in to comment.