Skip to content

Commit

Permalink
Use isort to sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Feb 11, 2024
1 parent 4b22134 commit 6c665a8
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 19 deletions.
13 changes: 4 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,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:
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Repository = "https://github.com/adamchainz/django-linear-migrations"
[tool.black]
target-version = ['py38']

[tool.isort]
add_imports = [
"from __future__ import annotations"
]
force_single_line = true
profile = "black"

[tool.pytest.ini_options]
addopts = """\
--strict-config
Expand Down
2 changes: 1 addition & 1 deletion src/django_linear_migrations/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from django.apps import apps
from django.conf import settings
from django.core.checks import Error
from django.core.checks import register
from django.core.checks import Tags
from django.core.checks import register
from django.core.signals import setting_changed
from django.db.migrations.loader import MigrationLoader
from django.dispatch import receiver
Expand Down
1 change: 0 additions & 1 deletion src/django_linear_migrations/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys
from typing import no_type_check


if sys.version_info >= (3, 9):
ast_unparse = ast.unparse
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from django.core.management.commands.makemigrations import Command as BaseCommand
from django.db.migrations.loader import MigrationLoader

from django_linear_migrations.apps import MigrationDetails
from django_linear_migrations.apps import first_party_app_configs
from django_linear_migrations.apps import get_graph_plan
from django_linear_migrations.apps import MigrationDetails


class Command(BaseCommand):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from django.core.management.commands.makemigrations import Command as BaseCommand
from django.db.migrations import Migration

from django_linear_migrations.apps import first_party_app_configs
from django_linear_migrations.apps import MigrationDetails
from django_linear_migrations.apps import first_party_app_configs


class Command(BaseCommand):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from django.apps import apps
from django.core.management import BaseCommand
from django.core.management import CommandError
from django.db import connections
from django.db import DatabaseError
from django.db import connections
from django.db.migrations.recorder import MigrationRecorder

from django_linear_migrations.apps import is_first_party_app_config
from django_linear_migrations.apps import MigrationDetails
from django_linear_migrations.apps import is_first_party_app_config
from django_linear_migrations.compat import ast_unparse


Expand Down
2 changes: 1 addition & 1 deletion tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from textwrap import dedent

import pytest
from django.test import override_settings
from django.test import TestCase
from django.test import override_settings

from django_linear_migrations.apps import check_max_migration_files
from tests.utils import empty_migration
Expand Down
2 changes: 1 addition & 1 deletion tests/test_create_max_migration_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import pytest
from django.core.management import call_command
from django.test import override_settings
from django.test import TestCase
from django.test import override_settings

from tests.utils import empty_migration

Expand Down
2 changes: 1 addition & 1 deletion tests/test_makemigrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import django
import pytest
from django.db import models
from django.test import override_settings
from django.test import TestCase
from django.test import override_settings

from tests.utils import run_command

Expand Down
2 changes: 1 addition & 1 deletion tests/test_rebase_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from django.core.management import CommandError
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
from django.test import override_settings
from django.test import SimpleTestCase
from django.test import TestCase
from django.test import override_settings

from django_linear_migrations.management.commands import rebase_migration as module
from tests.utils import empty_migration
Expand Down

0 comments on commit 6c665a8

Please sign in to comment.