Skip to content

Commit 0d165cf

Browse files
committed
[channels] Make URLRouter.routes a Collection
`list` is invariant, which made this type inconvenient in practice. Each of the routes is either a pattern or another router.
1 parent aa70a2f commit 0d165cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stubs/channels/channels/routing.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Collection
12
from typing import Any, type_check_only
23

34
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope
@@ -19,9 +20,9 @@ class _ExtendedURLPattern(URLPattern):
1920
callback: _ASGIApplicationProtocol | URLRouter
2021

2122
class URLRouter:
22-
routes: list[_ExtendedURLPattern | URLRouter]
23+
routes: Collection[_ExtendedURLPattern | URLRouter]
2324

24-
def __init__(self, routes: list[_ExtendedURLPattern | URLRouter]) -> None: ...
25+
def __init__(self, routes: Collection[_ExtendedURLPattern | URLRouter]) -> None: ...
2526
async def __call__(self, scope: Scope, receive: ASGIReceiveCallable, send: ASGISendCallable) -> None: ...
2627

2728
class ChannelNameRouter:

0 commit comments

Comments
 (0)