Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[channels] Weaken a couple of other list parameter types
  • Loading branch information
cjwatson committed Nov 25, 2025
commit 79675e2f027b9bf2c516c6d3e5d90f5084d796dd
5 changes: 3 additions & 2 deletions stubs/channels/channels/utils.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from collections.abc import Awaitable, Callable
from collections.abc import Awaitable, Callable, Sequence
from typing import Any, Protocol, type_check_only
from typing_extensions import TypeAlias

from asgiref.typing import ASGIApplication, ASGIReceiveCallable

def name_that_thing(thing: object) -> str: ...
async def await_many_dispatch(
consumer_callables: list[Callable[[], Awaitable[ASGIReceiveCallable]]], dispatch: Callable[[dict[str, Any]], Awaitable[None]]
consumer_callables: Sequence[Callable[[], Awaitable[ASGIReceiveCallable]]],
dispatch: Callable[[dict[str, Any]], Awaitable[None]],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the return value of dispatch is ignored, it can be an arbitrary value and doesn't have to be None:

Suggested change
dispatch: Callable[[dict[str, Any]], Awaitable[None]],
dispatch: Callable[[dict[str, Any]], Awaitable[object]],

) -> None: ...

# Defines a generic ASGI middleware protocol.
Expand Down
10 changes: 8 additions & 2 deletions stubs/channels/channels/worker.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
from collections.abc import Collection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.


from asgiref.server import StatelessServer
from channels.layers import BaseChannelLayer
from channels.utils import _ChannelApplication

class Worker(StatelessServer):
channels: list[str]
channels: Collection[str]
channel_layer: BaseChannelLayer

def __init__(
self, application: _ChannelApplication, channels: list[str], channel_layer: BaseChannelLayer, max_applications: int = 1000
self,
application: _ChannelApplication,
channels: Collection[str],
channel_layer: BaseChannelLayer,
max_applications: int = 1000,
) -> None: ...
async def handle(self) -> None: ...
async def listener(self, channel: str) -> None: ...