Skip to content

Commit 986f45b

Browse files
committed
chore: removed redundant if sys.version_info...
1 parent 01c1f34 commit 986f45b

File tree

5 files changed

+10
-32
lines changed

5 files changed

+10
-32
lines changed

aioauth/response_type.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,12 @@
88
----
99
"""
1010

11-
import sys
12-
from typing import Generic, Tuple
11+
from typing import Generic, Tuple, get_args
1312

1413
from .requests import Request
1514
from .types import UserType
1615
from .storage import BaseStorage
1716

18-
if sys.version_info >= (3, 8):
19-
from typing import get_args
20-
else:
21-
from typing_extensions import get_args
22-
2317
from .utils import generate_token
2418
from .errors import (
2519
InvalidClientError,

aioauth/server.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717
----
1818
"""
1919

20-
import sys
2120
from dataclasses import asdict
2221
from http import HTTPStatus
23-
from typing import Any, Dict, Generic, List, Optional, Tuple, Type, Union
22+
from typing import Any, Dict, Generic, List, Optional, Tuple, Type, Union, get_args
2423

2524
from .requests import Request
2625
from .types import UserType
2726
from .storage import BaseStorage
2827

2928

30-
if sys.version_info >= (3, 8):
31-
from typing import get_args
32-
else:
33-
from typing_extensions import get_args
34-
3529
from .collections import HTTPHeaderDict
3630
from .constances import default_headers
3731
from .errors import (

aioauth/storage.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
from .types import UserType
2121

2222
if sys.version_info >= (3, 11):
23-
from typing import Unpack, NotRequired
23+
from typing import Unpack, NotRequired, TypedDict
2424
else:
25-
from typing_extensions import Unpack, NotRequired
26-
27-
if sys.version_info >= (3, 11):
28-
from typing import TypedDict
29-
else:
30-
from typing_extensions import TypedDict as _TypedDict
25+
from typing_extensions import (
26+
TypedDict as _TypedDict,
27+
Unpack,
28+
NotRequired,
29+
)
3130

3231
# NOTE: workaround for Python < 3.11
3332
# https://github.com/python/cpython/issues/89026

aioauth/types.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
import sys
12-
from typing import Any
12+
from typing import Any, Literal
1313

1414
if sys.version_info >= (3, 13):
1515
from typing import TypeVar
@@ -21,11 +21,6 @@
2121
else:
2222
from typing_extensions import TypeAlias
2323

24-
if sys.version_info >= (3, 8):
25-
from typing import Literal
26-
else:
27-
from typing_extensions import Literal
28-
2924

3025
ErrorType: TypeAlias = Literal[
3126
"invalid_request",

tests/classes.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33

44
from typing import Dict, List, Optional, Type
5+
from functools import cached_property
56

67
from dataclasses import replace, dataclass
78

@@ -23,11 +24,6 @@
2324
)
2425
from aioauth.types import GrantType, ResponseType
2526

26-
if sys.version_info >= (3, 8):
27-
from functools import cached_property
28-
else:
29-
from backports.cached_property import cached_property
30-
3127
if sys.version_info >= (3, 11):
3228
from typing import Unpack
3329
else:

0 commit comments

Comments
 (0)