Skip to content

Commit

Permalink
base.pyi: use base class HttpResponseBase (#2459)
Browse files Browse the repository at this point in the history
* base.pyi: use base class HttpResponseBase

Previously, this was only a `Callable` but 125f31a restricted the last parameter to `HttpResponse` which is unnecessarily strict, as it does not cover things like `StreamingHttpResponse` and its descendant `FileResponse` among others – while _view_ functions can return these as well. They have a common base class `HttpResponseBase` – I guess this would be a better choice here.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Update django-stubs/urls/base.pyi

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent 2b3b079 commit ea16b44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django-stubs/urls/base.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from collections.abc import Callable, Sequence
from typing import Any, Literal

from django.http.response import HttpResponse
from django.http.response import HttpResponseBase
from django.urls.resolvers import ResolverMatch

def resolve(path: str, urlconf: str | None = ...) -> ResolverMatch: ...
def reverse(
viewname: Callable[..., HttpResponse] | str | None,
viewname: Callable[..., HttpResponseBase] | str | None,
urlconf: str | None = ...,
args: Sequence[Any] | None = ...,
kwargs: dict[str, Any] | None = ...,
Expand Down

0 comments on commit ea16b44

Please sign in to comment.