diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0a59d99..839ab38 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -34,4 +34,4 @@ jobs: - name: Security run: make bandit - name: Testing - run: make tests + run: make test diff --git a/Makefile b/Makefile index 2dbf2c5..9561c53 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ lint: - poetry run black . - poetry run isort . - poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,**/migrations/*,**/south_migrations/*,tests/ --statistics --count + poetry run black --check . + poetry run isort --check-only . + poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,tests/ --statistics --count bandit: poetry run bandit -c pyproject.toml -r . diff --git a/pyproject.toml b/pyproject.toml index ef77166..d4fc863 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,25 +8,25 @@ license = "MIT" readme = "README.md" # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - 'Development Status :: 5 - Production/Stable', + # How mature is this project? Common values are + # 3 - Alpha + # 4 - Beta + # 5 - Production/Stable + 'Development Status :: 5 - Production/Stable', - # Indicate who your project is intended for - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Libraries :: Python Modules', + # Indicate who your project is intended for + 'Intended Audience :: Developers', + 'Topic :: Software Development :: Libraries :: Python Modules', - # Pick your license as you wish (should match "license" above) - 'License :: OSI Approved :: MIT', + # Pick your license as you wish (should match "license" above) + 'License :: OSI Approved :: MIT', - # Supported Languages - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.12', - 'Framework :: Django', + # Supported Languages + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.12', + 'Framework :: Django', ] packages = [ { include = "rest_framework_filters" }, @@ -63,6 +63,9 @@ packaging = "24.1" requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +[tool.isort] +profile = "black" + [tool.bandit] exclude_dirs = [ './tests/', diff --git a/rest_framework_filters/filters.py b/rest_framework_filters/filters.py index 6283091..1886462 100644 --- a/rest_framework_filters/filters.py +++ b/rest_framework_filters/filters.py @@ -2,8 +2,10 @@ from django.utils.module_loading import import_string from django_filters.rest_framework.filters import * # noqa -from django_filters.rest_framework.filters import (ModelChoiceFilter, - ModelMultipleChoiceFilter) +from django_filters.rest_framework.filters import ( + ModelChoiceFilter, + ModelMultipleChoiceFilter, +) ALL_LOOKUPS = "__all__" diff --git a/tests/related/data.py b/tests/related/data.py index 056268e..eb390af 100644 --- a/tests/related/data.py +++ b/tests/related/data.py @@ -37,7 +37,8 @@ def setUpTestData(cls): cls.postD(b) b = Blog.objects.create(pk=5, name="Blog AB") - cls.postA(b), cls.postB(b) + cls.postA(b) + cls.postB(b) b = Blog.objects.create(pk=6, name="Blog AC") cls.postA(b), cls.postC(b) diff --git a/tests/test_complex_ops.py b/tests/test_complex_ops.py index a5f5013..27c2109 100644 --- a/tests/test_complex_ops.py +++ b/tests/test_complex_ops.py @@ -6,9 +6,11 @@ from django.test import TestCase from rest_framework.serializers import ValidationError -from rest_framework_filters.complex_ops import (ComplexOp, - combine_complex_queryset, - decode_complex_ops) +from rest_framework_filters.complex_ops import ( + ComplexOp, + combine_complex_queryset, + decode_complex_ops, +) from tests.testapp import models diff --git a/tests/test_filtering.py b/tests/test_filtering.py index fb399da..cdc9100 100644 --- a/tests/test_filtering.py +++ b/tests/test_filtering.py @@ -3,12 +3,33 @@ from rest_framework_filters import FilterSet, filters -from .testapp.filters import (AccountFilter, CFilter, CoverFilter, - CustomerFilter, NoteFilter, NoteFilterWithAlias, - NoteFilterWithRelatedAlias, PageFilter, - PersonFilter, PostFilter, UserFilter) -from .testapp.models import (A, Account, B, C, Cover, Customer, Note, Page, - Person, Post, Tag, User) +from .testapp.filters import ( + AccountFilter, + CFilter, + CoverFilter, + CustomerFilter, + NoteFilter, + NoteFilterWithAlias, + NoteFilterWithRelatedAlias, + PageFilter, + PersonFilter, + PostFilter, + UserFilter, +) +from .testapp.models import ( + A, + Account, + B, + C, + Cover, + Customer, + Note, + Page, + Person, + Post, + Tag, + User, +) class LocalTagFilter(FilterSet): diff --git a/tests/test_filterset.py b/tests/test_filterset.py index 797434b..7d32aed 100644 --- a/tests/test_filterset.py +++ b/tests/test_filterset.py @@ -9,11 +9,17 @@ from rest_framework.views import APIView from rest_framework_filters import FilterSet, filters -from rest_framework_filters.filterset import (FilterSetMetaclass, - SubsetDisabledMixin) - -from .testapp.filters import (AFilter, NoteFilter, NoteFilterWithAlias, - PersonFilter, PostFilter, TagFilter, UserFilter) +from rest_framework_filters.filterset import FilterSetMetaclass, SubsetDisabledMixin + +from .testapp.filters import ( + AFilter, + NoteFilter, + NoteFilterWithAlias, + PersonFilter, + PostFilter, + TagFilter, + UserFilter, +) from .testapp.models import Note, Person, Post, Tag, User factory = APIRequestFactory() diff --git a/tests/testapp/filters.py b/tests/testapp/filters.py index 7b41df0..46e1c2d 100644 --- a/tests/testapp/filters.py +++ b/tests/testapp/filters.py @@ -4,8 +4,21 @@ from rest_framework_filters.filters import AutoFilter, RelatedFilter from rest_framework_filters.filterset import FilterSet -from .models import (A, Account, B, Blog, C, Cover, Customer, Note, Page, - Person, Post, Tag, User) +from .models import ( + A, + Account, + B, + Blog, + C, + Cover, + Customer, + Note, + Page, + Person, + Post, + Tag, + User, +) class DFUserFilter(django_filters.FilterSet):