Skip to content

Commit a274502

Browse files
committed
chore: update type imports to use collections.abc for Callable
1 parent 50fcf5b commit a274502

11 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
branches: ["master"]
99

1010
permissions:
11-
contents: read
11+
contents: read
1212

1313
jobs:
1414
tests:

cachium/_decorators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from __future__ import annotations
22

33
from asyncio import iscoroutinefunction
4+
from collections.abc import Callable
45
from functools import wraps
5-
from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeVar, cast
6+
from typing import TYPE_CHECKING, Any, Protocol, TypeVar, cast
67

78
from typing_extensions import ParamSpec
89

cachium/_helpers.py

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

33
import inspect
4-
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, TypeVar, final, get_args, get_type_hints
4+
from typing import TYPE_CHECKING, Any, NamedTuple, TypeVar, final, get_args, get_type_hints
55

66
from typing_extensions import ParamSpec
77

88
from cachium._errors import NoKwargsError
99

1010
if TYPE_CHECKING:
11-
from collections.abc import Iterable, Mapping, Sequence
11+
from collections.abc import Callable, Iterable, Mapping, Sequence
1212

1313
P = ParamSpec("P")
1414
T = TypeVar("T")

cachium/key_builders/_abc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import TYPE_CHECKING, Any
55

66
if TYPE_CHECKING:
7-
from typing_extensions import TypeAlias
7+
from typing import TypeAlias
88

99
TCacheKey: TypeAlias = str
1010

cachium/key_builders/_default.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import inspect
4-
from typing import TYPE_CHECKING, Any, Callable
4+
from typing import TYPE_CHECKING, Any
55

66
from typing_extensions import override
77

@@ -11,6 +11,8 @@
1111
from ._abc import KeyBuilder
1212

1313
if TYPE_CHECKING:
14+
from collections.abc import Callable
15+
1416
from cachium.serializers import Serializer
1517

1618
from ._abc import TCacheKey

cachium/storages/ttl_map.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from asyncio import Condition as AsyncCondition
77
from datetime import timedelta
88
from threading import Condition
9-
from typing import TYPE_CHECKING, Callable
9+
from typing import TYPE_CHECKING
1010

1111
from ttlru_map import TTLMap
1212
from typing_extensions import override
@@ -16,6 +16,7 @@
1616
from ._abc import BaseAsyncLock, BaseAsyncStorage, BaseLock, BaseStorage, Result, TValue
1717

1818
if TYPE_CHECKING:
19+
from collections.abc import Callable
1920
from types import TracebackType
2021

2122
from typing_extensions import Self

tests/functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Callable, NamedTuple
1+
from collections.abc import Callable
2+
from typing import Any, NamedTuple
23

34

45
class CallInfo(NamedTuple):

tests/test__default_key_builder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from __future__ import annotations
22

33
import inspect
4-
from typing import Any, Callable
4+
from typing import TYPE_CHECKING, Any
55

66
import pytest
77

88
from cachium.key_builders import DefaultKeyBuilder
99
from cachium.serializers import StrSerializer
1010
from tests.functions import TestFunctions, func1
1111

12+
if TYPE_CHECKING:
13+
from collections.abc import Callable
14+
1215
_TEST_FILE = inspect.getfile(func1)
1316

1417

tests/test__get_arg_default_value.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import inspect
2-
from typing import Any, Callable
2+
from collections.abc import Callable
3+
from typing import Any
34

45
import pytest
56

tests/test__get_kwarg_default_value.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import inspect
2-
from typing import Any, Callable
2+
from collections.abc import Callable
3+
from typing import Any
34

45
import pytest
56

0 commit comments

Comments
 (0)