Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit 3b322a9

Browse files
committed
Add pre-commit hook for pyupgrade
1 parent 5f7f8b5 commit 3b322a9

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

.pre-commit-config.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ repos:
3333
language: system
3434
types: [python]
3535
require_serial: true
36+
- id: pyupgrade
37+
name: pyupgrade
38+
description: Automatically upgrade syntax for newer versions.
39+
entry: pyupgrade
40+
language: system
41+
types: [python]
42+
args: [--py37-plus]
3643
- id: reorder-python-imports
3744
name: Reorder python imports
3845
entry: reorder-python-imports

poetry.lock

+28-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pre-commit-hooks = "^4.0.1"
5555
typeguard = "^2.13.2"
5656
sphinx-rtd-theme = "^1.0.0"
5757
coverage = {version = "6.1.2", extras = ["toml"]}
58+
pyupgrade = "^2.29.1"
5859

5960
[tool.coverage.paths]
6061
source = ["src", "*/site-packages"]

src/django_sorting_bootstrap/templatetags/sorting_tags.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def result_headers(context, cl):
2727
continue
2828

2929
# OK, it is sortable if we got this far
30-
th_classes = ["sortable", "column-{}".format(field_name)]
30+
th_classes = ["sortable", f"column-{field_name}"]
3131
ascending = None
3232
is_sorted = False
3333
# Is it currently being sorted on?
@@ -173,7 +173,7 @@ def auto_sort(parser, token):
173173
tag_name, queryset = token.split_contents()
174174
except ValueError:
175175
raise template.TemplateSyntaxError(
176-
"{} tag requires a single argument".format(token.contents.split()[0])
176+
f"{token.contents.split()[0]} tag requires a single argument"
177177
) from None
178178
return SortedQuerysetNode(queryset)
179179

0 commit comments

Comments
 (0)