Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyR committed Jun 7, 2024
1 parent 4b7a635 commit 482dd61
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lint:
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/ --statistics --count
poetry run flake8 . --extend-ignore=D,E501,W601 --extend-exclude=docs/,tests/ --statistics --count

test:
poetry run python ./runtests.py
1 change: 0 additions & 1 deletion rest_framework_filters/backends.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from contextlib import contextmanager

from django.http import QueryDict
from django_filters import compat
from django_filters.rest_framework import backends
from rest_framework.exceptions import ValidationError

Expand Down
10 changes: 6 additions & 4 deletions rest_framework_filters/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ def fset(self, value):

def get_queryset(self, request):
queryset = super(BaseRelatedFilter, self).get_queryset(request)
assert queryset is not None, \
"Expected `.get_queryset()` for related filter '%s.%s' to " \
"return a `QuerySet`, but got `None`." \
% (self.parent.__class__.__name__, self.field_name)
if queryset is None:
raise ValueError(
"Expected `.get_queryset()` for related filter '%s.%s' to return a `QuerySet`, but got `None`."
% (self.parent.__class__.__name__, self.field_name)
)

return queryset


Expand Down
2 changes: 1 addition & 1 deletion rest_framework_filters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def lookups_for_transform(transform):
if issubclass(lookup, Transform):

# type match indicates recursion.
if type(transform) == lookup:
if type(transform) is lookup:
continue

sub_transform = lookup(transform)
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'tests.testapp',
)

SECRET_KEY = 'testsecretkey'
SECRET_KEY = 'testsecretkey' # noqa

TEMPLATES = [
{
Expand Down

0 comments on commit 482dd61

Please sign in to comment.