Skip to content

Commit 6aa0c78

Browse files
🚨 Update to modern syntax using 'ruff check --fix'
1 parent b53851f commit 6aa0c78

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

mozilla_django_oidc_db/backends.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import logging
4-
from typing import Any, cast
4+
from typing import Any, cast, override
55

66
from django.contrib.auth import get_user_model
77
from django.contrib.auth.models import (
@@ -14,7 +14,6 @@
1414

1515
import requests
1616
from mozilla_django_oidc.auth import OIDCAuthenticationBackend as BaseBackend
17-
from typing_extensions import override
1817

1918
from .config import dynamic_setting, lookup_config
2019
from .exceptions import MissingInitialisation

mozilla_django_oidc_db/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
settings that are still defined in the django settings layer.
77
"""
88

9-
from typing import Any, Generic, Protocol, TypeVar, overload
9+
from typing import Any, Generic, Protocol, Self, TypeVar, Unpack, overload
1010

1111
from django.core.exceptions import (
1212
BadRequest,
1313
)
1414
from django.http import HttpRequest
1515

1616
from mozilla_django_oidc.utils import import_from_settings
17-
from typing_extensions import Self, TypedDict, Unpack
17+
from typing_extensions import TypedDict
1818

1919
from .constants import CONFIG_IDENTIFIER_SESSION_KEY
2020
from .models import OIDCClient
@@ -74,7 +74,7 @@ class DynamicSettingKwargs(TypedDict, Generic[T], total=False):
7474
default: T
7575

7676

77-
class dynamic_setting(Generic[T]):
77+
class dynamic_setting[T]:
7878
"""
7979
Descriptor to lazily access settings while explicitly defining them.
8080

mozilla_django_oidc_db/middleware.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from typing import Any
1+
from typing import Any, override
22

33
from django.urls import reverse
44

55
from mozilla_django_oidc.middleware import SessionRefresh as BaseSessionRefresh
6-
from typing_extensions import override
76

87
from .config import (
98
BadRequest,

mozilla_django_oidc_db/plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
from abc import abstractmethod
5-
from typing import Any, Protocol, TypeAlias, runtime_checkable
5+
from typing import Any, Protocol, runtime_checkable
66

77
from django.contrib.auth import get_user_model
88
from django.contrib.auth.models import AbstractUser, AnonymousUser
@@ -109,7 +109,7 @@ def verify_claims(self, claims: JSONObject) -> bool:
109109
...
110110

111111

112-
OIDCPlugin: TypeAlias = AbstractUserOIDCPluginProtocol | AnonymousUserOIDCPluginProtocol
112+
type OIDCPlugin = AbstractUserOIDCPluginProtocol | AnonymousUserOIDCPluginProtocol
113113

114114

115115
admin_callback_view = AdminCallbackView.as_view()

mozilla_django_oidc_db/typing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from __future__ import annotations
22

3-
from collections.abc import Sequence
4-
from typing import Protocol, TypeAlias
3+
from collections.abc import MutableMapping, Sequence
4+
from typing import Protocol
55

66
from django.http import HttpRequest, HttpResponseBase
77

8-
JSONPrimitive: TypeAlias = str | int | float | bool | None
9-
JSONValue: TypeAlias = "JSONPrimitive | list[JSONValue] | JSONObject"
10-
JSONObject: TypeAlias = dict[str, JSONValue]
8+
type JSONPrimitive = str | int | float | bool | None
9+
type JSONValue = JSONPrimitive | list[JSONValue] | JSONObject
10+
type JSONObject = MutableMapping[str, JSONValue]
1111

12-
ClaimPath: TypeAlias = Sequence[str]
12+
type ClaimPath = Sequence[str]
1313

1414

1515
class DjangoView(Protocol):

0 commit comments

Comments
 (0)