Skip to content

Commit 76f69aa

Browse files
simwr872sobolevn
andauthored
Fix django.urls.base.reverse after 5.2 (#2595)
Co-authored-by: simwr872 <simwr872> Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent fd4333a commit 76f69aa

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

django-stubs/urls/base.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
from collections.abc import Callable, Sequence
2-
from typing import Any, Literal
1+
from collections.abc import Callable, Mapping, Sequence
2+
from typing import Any, Literal, TypeAlias
33

4+
from django.http.request import QueryDict
45
from django.http.response import HttpResponseBase
56
from django.urls.resolvers import ResolverMatch
67

8+
# https://github.com/python/typeshed/blob/87f599dc8312ac67b941b5f2b47274534a1a2d3a/stdlib/urllib/parse.pyi#L136-L138
9+
_QueryType: TypeAlias = (
10+
Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]]
11+
)
12+
713
def resolve(path: str, urlconf: str | None = ...) -> ResolverMatch: ...
814
def reverse(
915
viewname: Callable[..., HttpResponseBase] | str | None,
1016
urlconf: str | None = ...,
1117
args: Sequence[Any] | None = ...,
1218
kwargs: dict[str, Any] | None = ...,
1319
current_app: str | None = ...,
20+
*,
21+
query: QueryDict | _QueryType | None = ...,
22+
fragment: str | None = ...,
1423
) -> str: ...
1524

1625
reverse_lazy: Any

scripts/stubtest/allowlist_todo_django52.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ django.template.loader_tags.construct_relative_path
282282
django.test.client.FakePayload.read
283283
django.test.client.FakePayload.write
284284
django.test.runner.ParallelTestSuite.handle_event
285-
django.urls.base.reverse
286-
django.urls.reverse
287285
django.utils.deprecation.DeprecationInstanceCheck
288286
django.utils.deprecation.RemovedInDjango61Warning
289287
django.utils.feedgenerator.RssFeed.add_stylesheets

0 commit comments

Comments
 (0)