Skip to content

Commit

Permalink
Resolved flake8 errors (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dxw authored May 6, 2024
1 parent 3d44a4b commit e63a13f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
extend-ignore =
# break before binary operators
W503,
# line length
E501
1 change: 0 additions & 1 deletion waffle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import TYPE_CHECKING

import django
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest

Expand Down
4 changes: 2 additions & 2 deletions waffle/management/commands/waffle_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def handle(self, *args: Any, **options: Any) -> None:
for username in options['user']:
try:
user_instance = UserModel.objects.get(
Q(**{UserModel.USERNAME_FIELD: username}) |
Q(**{UserModel.EMAIL_FIELD: username})
Q(**{UserModel.USERNAME_FIELD: username})
| Q(**{UserModel.EMAIL_FIELD: username})
)
user_hash.add(user_instance)
except UserModel.DoesNotExist:
Expand Down
2 changes: 1 addition & 1 deletion waffle/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


if TYPE_CHECKING:
from waffle.models import _BaseModelType, AbstractBaseFlag, AbstractBaseSample, AbstractBaseSwitch
from waffle.models import _BaseModelType, AbstractBaseFlag, AbstractBaseSample, AbstractBaseSwitch # noqa: F401
else:
_BaseModelType = TypeVar("_BaseModelType")

Expand Down
4 changes: 2 additions & 2 deletions waffle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def _is_active_for_user(self, request: HttpRequest) -> bool | None:
def _is_active_for_language(self, request: HttpRequest) -> bool | None:
if self.languages:
languages = [ln.strip() for ln in self.languages.split(',')]
if (hasattr(request, 'LANGUAGE_CODE') and
request.LANGUAGE_CODE in languages):
if (hasattr(request, 'LANGUAGE_CODE')
and request.LANGUAGE_CODE in languages):
return True
return None

Expand Down
2 changes: 1 addition & 1 deletion waffle/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def test_flag_is_not_active_for_none_requests(self):
def test_is_active_for_user_when_everyone_is_active(self):
flag = get_waffle_flag_model().objects.create(name='test-flag')
flag.everyone = True
self.assertEqual(flag.is_active_for_user(User()), True)
self.assertEqual(flag.is_active_for_user(User()), True)
1 change: 0 additions & 1 deletion waffle/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
get_waffle_sample_model,
get_waffle_switch_model,
)
from waffle.models import Switch, Sample


__all__ = ['override_flag', 'override_sample', 'override_switch']
Expand Down

0 comments on commit e63a13f

Please sign in to comment.