Skip to content

Commit

Permalink
Upgrade isort
Browse files Browse the repository at this point in the history
  • Loading branch information
apragacz committed May 8, 2023
1 parent d4b1712 commit 7dd2aeb
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
8 changes: 2 additions & 6 deletions requirements/requirements-dev.lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ flake8-comprehensions==3.12.0
# via -r requirements/requirements-test.lock.txt
flake8-debugger==4.1.2
# via -r requirements/requirements-test.lock.txt
flake8-isort==5.0.3
flake8-isort==6.0.0
# via -r requirements/requirements-test.lock.txt
flake8-print==5.0.0
# via -r requirements/requirements-test.lock.txt
Expand Down Expand Up @@ -182,7 +182,7 @@ ipython==8.12.2
# via
# -r requirements/requirements-dev.in
# ipdb
isort[pyproject]==4.3.21
isort[pyproject]==5.12.0
# via
# -r requirements/requirements-test.lock.txt
# flake8-isort
Expand Down Expand Up @@ -426,10 +426,6 @@ stevedore==5.0.0
# via
# -r requirements/requirements-test.lock.txt
# doc8
toml==0.10.2
# via
# -r requirements/requirements-test.lock.txt
# isort
tomli==2.0.1
# via
# -r requirements/requirements-test.lock.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-test.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flake8-isort
flake8-pyproject
flake8-print
flake8-tuple
isort[pyproject]<5.0
isort[pyproject]
pylint

# type checking
Expand Down
6 changes: 2 additions & 4 deletions requirements/requirements-test.lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ flake8-comprehensions==3.12.0
# via -r requirements/requirements-test.in
flake8-debugger==4.1.2
# via -r requirements/requirements-test.in
flake8-isort==5.0.3
flake8-isort==6.0.0
# via -r requirements/requirements-test.in
flake8-print==5.0.0
# via -r requirements/requirements-test.in
Expand All @@ -115,7 +115,7 @@ importlib-resources==5.12.0
# via keyring
iniconfig==2.0.0
# via pytest
isort[pyproject]==4.3.21
isort[pyproject]==5.12.0
# via
# -r requirements/requirements-test.in
# flake8-isort
Expand Down Expand Up @@ -269,8 +269,6 @@ sqlparse==0.4.4
# django
stevedore==5.0.0
# via doc8
toml==0.10.2
# via isort
tomli==2.0.1
# via
# build
Expand Down
6 changes: 4 additions & 2 deletions rest_registration/auth_token_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ def get_app_names(self) -> Sequence[str]:
]

def provide_token(self, user: 'AbstractBaseUser') -> AuthToken:
from rest_framework.authtoken.models import Token # noqa: E501 pylint: disable=import-outside-toplevel
from rest_framework.authtoken.models import \
Token # noqa: E501 pylint: disable=import-outside-toplevel

token_obj, _ = Token.objects.get_or_create(user=user)
return AuthToken(token_obj.key)

def revoke_token(
self, user: 'AbstractBaseUser', *,
token: Optional[AuthToken] = None) -> None:
from rest_framework.authtoken.models import Token # noqa: E501 pylint: disable=import-outside-toplevel
from rest_framework.authtoken.models import \
Token # noqa: E501 pylint: disable=import-outside-toplevel

try:
token_obj = Token.objects.get(user_id=user.pk) # type: Token
Expand Down
4 changes: 3 additions & 1 deletion rest_registration/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
class _BaseCheckCodeMixin(CheckCode): # noqa: E501 pylint: disable=abstract-method

def get_app_name(self) -> str:
from rest_registration.apps import RestRegistrationConfig # noqa: E501 pylint: disable=import-outside-toplevel, cyclic-import
from rest_registration.apps import \
RestRegistrationConfig # noqa: E501 pylint: disable=import-outside-toplevel, cyclic-import

return RestRegistrationConfig.name


Expand Down
1 change: 0 additions & 1 deletion rest_registration/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

if TYPE_CHECKING:
from django_stubs_ext import StrOrPromise

# mypy uses typing_extensions by default (Py 3.8); when importing from typing
# one will get the following error message in mypy:
#
Expand Down
1 change: 1 addition & 0 deletions rest_registration/utils/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

if TYPE_CHECKING:
from typing import Optional

from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db.models import Field, ForeignObjectRel
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def user(db, email_change, password_change):

@pytest.fixture()
def user_token_obj(user):
from rest_framework.authtoken.models import Token # noqa: E501 pylint: disable=import-outside-toplevel
from rest_framework.authtoken.models import \
Token # noqa: E501 pylint: disable=import-outside-toplevel

return Token.objects.create(user=user)

Expand Down

0 comments on commit 7dd2aeb

Please sign in to comment.