Skip to content

Commit 0f45154

Browse files
committed
Add type_check_only for channels consumer and testing http
1 parent abfcada commit 0f45154

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

stubs/channels/channels/consumer.pyi

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Awaitable
2-
from typing import Any, ClassVar, Protocol
2+
from typing import Any, ClassVar, Protocol, type_check_only
33

44
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope, WebSocketScope
55
from channels.auth import UserLazyObject
@@ -8,10 +8,12 @@ from channels.layers import BaseChannelLayer
88
from django.contrib.sessions.backends.base import SessionBase
99
from django.utils.functional import LazyObject
1010

11+
@type_check_only
1112
class _LazySession(SessionBase, LazyObject): # type: ignore[misc]
1213
_wrapped: SessionBase
1314

1415
# Base ASGI Scope definition
16+
@type_check_only
1517
class _ChannelScope(WebSocketScope, total=False):
1618
# Channel specific
1719
channel: str
@@ -24,7 +26,7 @@ class _ChannelScope(WebSocketScope, total=False):
2426
user: UserLazyObject | None
2527

2628
def get_handler_name(message: dict[str, Any]) -> str: ...
27-
29+
@type_check_only
2830
class _ASGIApplicationProtocol(Protocol):
2931
consumer_class: Any
3032
consumer_initkwargs: dict[str, Any]

stubs/channels/channels/testing/http.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from channels.testing.application import ApplicationCommunicator
55
from channels.utils import _ChannelApplication
66

77
# HTTP test-specific response type
8+
@type_check_only
89
class _HTTPTestResponse(TypedDict, total=False):
910
status: int
1011
headers: Iterable[tuple[bytes, bytes]]

0 commit comments

Comments
 (0)