Skip to content

Commit 2725796

Browse files
committed
fix: replace Dict type with built-in dict type.
1 parent cba4132 commit 2725796

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

src/joserfc/_rfc7515/registry.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22
import warnings
3-
from typing import Dict
43
from .model import JWSAlgModel
54
from ..errors import UnsupportedAlgorithmError, SecurityWarning
65
from ..registry import (
@@ -30,7 +29,7 @@ class JWSRegistry:
3029
"""
3130

3231
default_header_registry: HeaderRegistryDict = JWS_HEADER_REGISTRY
33-
algorithms: Dict[str, JWSAlgModel] = {}
32+
algorithms: dict[str, JWSAlgModel] = {}
3433
recommended: list[str] = []
3534

3635
def __init__(

src/joserfc/_rfc7519/claims.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import datetime
66
import calendar
77
from json import JSONEncoder
8-
from typing import Dict, Any, Type
8+
from typing import Any, Type
99
from ..util import to_bytes
1010
from ..errors import InsecureClaimError
1111

@@ -25,7 +25,7 @@
2525
re.DOTALL,
2626
)
2727

28-
Claims = Dict[str, Any]
28+
Claims = dict[str, Any]
2929

3030

3131
def convert_claims(claims: Claims, encoder_cls: Type[JSONEncoder] | None = None) -> bytes:

src/joserfc/jws.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import overload, TypeVar, Any, Dict
2+
from typing import overload, TypeVar, Any
33
from ._rfc7515.model import (
44
JWSAlgModel,
55
HeaderMember as HeaderMember,
@@ -330,7 +330,7 @@ def find_key(obj: HeaderMember) -> Key:
330330
return flattened_obj
331331

332332

333-
DetachValue = TypeVar("DetachValue", str, Dict[str, Any])
333+
DetachValue = TypeVar("DetachValue", str, dict[str, Any])
334334

335335

336336
def detach_content(value: DetachValue) -> DetachValue:

src/joserfc/registry.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
2-
from typing import Any, Dict, Callable, Union
2+
from typing import Any, Callable, Union
33
from .errors import (
44
MissingHeaderError,
55
MissingCritHeaderError,
66
UnsupportedHeaderError,
77
InvalidHeaderValueError,
88
)
99

10-
Header = Dict[str, Any]
10+
Header = dict[str, Any]
1111

1212

1313
def is_str(value: str) -> None:
@@ -39,7 +39,7 @@ def is_list_str(values: list[str]) -> None:
3939
raise ValueError("must be a list[str]")
4040

4141

42-
def is_jwk(value: Dict[str, Any]) -> None:
42+
def is_jwk(value: dict[str, Any]) -> None:
4343
if not isinstance(value, dict):
4444
raise ValueError("must be a JWK")
4545

@@ -61,7 +61,7 @@ def not_support(_: Any) -> None:
6161

6262

6363
Validate = Callable[[Any], None]
64-
_value_validators: Dict[str, Validate] = {
64+
_value_validators: dict[str, Validate] = {
6565
"str": is_str,
6666
"list[str]": is_list_str,
6767
"int": is_int,
@@ -85,7 +85,7 @@ def __init__(self, description: str, validate: str | Validate, required: bool =
8585

8686

8787
#: Define header parameters for JWS and JWE
88-
HeaderRegistryDict = Dict[str, HeaderParameter]
88+
HeaderRegistryDict = dict[str, HeaderParameter]
8989

9090

9191
class KeyParameter:
@@ -110,8 +110,8 @@ def __init__(self, description: str, use: str, private: bool | None):
110110

111111

112112
#: Define parameters for JWK
113-
KeyParameterRegistryDict = Dict[str, KeyParameter]
114-
KeyOperationRegistryDict = Dict[str, KeyOperation]
113+
KeyParameterRegistryDict = dict[str, KeyParameter]
114+
KeyOperationRegistryDict = dict[str, KeyOperation]
115115

116116
#: Basic JWS header registry
117117
JWS_HEADER_REGISTRY: HeaderRegistryDict = {

0 commit comments

Comments
 (0)