Skip to content

Commit 56d5789

Browse files
committed
I really dont like this
1 parent 86e0a82 commit 56d5789

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/async_utils/_internal_types.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@
3939

4040
TYPE_CHECKING = False
4141
if TYPE_CHECKING:
42-
from typing import Protocol
4342

44-
class CoroCacheDeco(Protocol):
43+
class CoroCacheDeco(t.Protocol):
4544
def __call__[**P, R](self, c: CoroLike[P, R], /) -> CoroFunc[P, R]: ...
4645

47-
class TaskCacheDeco(Protocol):
46+
class TaskCacheDeco(t.Protocol):
4847
def __call__[**P, R](self, c: TaskCoroFunc[P, R], /) -> TaskFunc[P, R]: ...
4948

5049

@@ -56,9 +55,8 @@ def __getattr__(name: str):
5655
return p
5756

5857
if name == "CoroCacheDeco":
59-
from typing import Protocol
6058

61-
class CoroCacheDeco(Protocol):
59+
class CoroCacheDeco(t.Protocol):
6260
def __call__[**P, R](
6361
self, c: CoroLike[P, R], /
6462
) -> CoroFunc[P, R]: ...
@@ -67,9 +65,8 @@ def __call__[**P, R](
6765
return CoroCacheDeco
6866

6967
if name == "TaskCacheDeco":
70-
from typing import Protocol
7168

72-
class TaskCacheDeco(Protocol):
69+
class TaskCacheDeco(t.Protocol):
7370
def __call__[**P, R](
7471
self, c: TaskCoroFunc[P, R], /
7572
) -> TaskFunc[P, R]: ...

src/async_utils/_typings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
TYPE_CHECKING = False
3030
if TYPE_CHECKING:
31-
from typing import Any, Concatenate, Literal, Never, Self
31+
from typing import Any, Concatenate, Literal, Never, Protocol, Self
3232
else:
3333

3434
def __getattr__(name: str):
35-
if name in {"Any", "Concatenate", "Literal", "Never", "Self"}:
35+
if name in {"Any", "Concatenate", "Literal", "Never", "Protocol", "Self"}:
3636
import typing
3737

3838
return getattr(typing, name)
@@ -41,4 +41,4 @@ def __getattr__(name: str):
4141
raise AttributeError(msg)
4242

4343

44-
__all__ = ("TYPE_CHECKING", "Any", "Concatenate", "Literal", "Never", "Self")
44+
__all__ = ("TYPE_CHECKING", "Any", "Concatenate", "Literal", "Never", "Protocol", "Self")

0 commit comments

Comments
 (0)