Skip to content

Commit 5ef36c5

Browse files
authored
Add path signature for async views. (typeddjango#2085)
1 parent 3fe74d8 commit 5ef36c5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

django-stubs/urls/conf.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections.abc import Callable, Sequence
22
from types import ModuleType
3-
from typing import Any, overload
3+
from typing import Any, Coroutine, overload
44

55
from django.urls import URLPattern, URLResolver, _AnyURL
66
from django.utils.functional import _StrOrPromise
@@ -21,6 +21,13 @@ def path(
2121
route: _StrOrPromise, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] = ..., name: str = ...
2222
) -> URLPattern: ...
2323
@overload
24+
def path(
25+
route: _StrOrPromise,
26+
view: Callable[..., Coroutine[Any, Any, HttpResponseBase]],
27+
kwargs: dict[str, Any] = ...,
28+
name: str = ...,
29+
) -> URLPattern: ...
30+
@overload
2431
def path(route: _StrOrPromise, view: IncludedURLConf, kwargs: dict[str, Any] = ..., name: str = ...) -> URLResolver: ...
2532
@overload
2633
def path(
@@ -33,6 +40,13 @@ def re_path(
3340
route: _StrOrPromise, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] = ..., name: str = ...
3441
) -> URLPattern: ...
3542
@overload
43+
def re_path(
44+
route: _StrOrPromise,
45+
view: Callable[..., Coroutine[Any, Any, HttpResponseBase]],
46+
kwargs: dict[str, Any] = ...,
47+
name: str = ...,
48+
) -> URLPattern: ...
49+
@overload
3650
def re_path(
3751
route: _StrOrPromise, view: IncludedURLConf, kwargs: dict[str, Any] = ..., name: str = ...
3852
) -> URLResolver: ...

0 commit comments

Comments
 (0)