From 40346f89748a70470ddac680deb31a42292d604e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 11 Feb 2024 17:18:17 +0000 Subject: [PATCH] Use isort to sort imports --- .pre-commit-config.yaml | 13 ++++--------- pyproject.toml | 12 ++++++++++++ src/django_htmx/http.py | 1 - tests/templatetags/test_django_htmx.py | 2 +- tests/test_jinja.py | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82a46964..2dcab8f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,16 +52,11 @@ repos: - id: blacken-docs additional_dependencies: - black==23.1.0 -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 +- repo: https://github.com/pycqa/isort + rev: 5.13.2 hooks: - - id: reorder-python-imports - args: - - --py38-plus - - --application-directories - - .:example:src - - --add-import - - 'from __future__ import annotations' + - id: isort + name: isort (python) - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 74fd6318..730dc5bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,18 @@ Repository = "https://github.com/adamchainz/django-htmx" [tool.black] target-version = ['py38'] +[tool.isort] +add_imports = [ + "from __future__ import annotations" +] +force_single_line = true +profile = "black" +src_paths = [ + ".", + "example", + "src", +] + [tool.pytest.ini_options] addopts = """\ --strict-config diff --git a/src/django_htmx/http.py b/src/django_htmx/http.py index bd2d2722..22b547ea 100644 --- a/src/django_htmx/http.py +++ b/src/django_htmx/http.py @@ -10,7 +10,6 @@ from django.http.response import HttpResponseBase from django.http.response import HttpResponseRedirectBase - HTMX_STOP_POLLING = 286 diff --git a/tests/templatetags/test_django_htmx.py b/tests/templatetags/test_django_htmx.py index 4319a37a..8346b7b1 100644 --- a/tests/templatetags/test_django_htmx.py +++ b/tests/templatetags/test_django_htmx.py @@ -2,8 +2,8 @@ from django.template import Context from django.template import Template -from django.test import override_settings from django.test import SimpleTestCase +from django.test import override_settings class DjangoHtmxScriptTests(SimpleTestCase): diff --git a/tests/test_jinja.py b/tests/test_jinja.py index ffe1e1cb..a0d790db 100644 --- a/tests/test_jinja.py +++ b/tests/test_jinja.py @@ -1,7 +1,7 @@ from __future__ import annotations -from django.test import override_settings from django.test import SimpleTestCase +from django.test import override_settings from django_htmx.jinja import django_htmx_script