From 3cba61598a41483f8b691d49447348a24fa58387 Mon Sep 17 00:00:00 2001 From: Gabriel Dugny Date: Mon, 26 Jun 2023 10:20:38 +0200 Subject: [PATCH] fixes from MR review --- django-stubs/utils/decorators.pyi | 2 +- django-stubs/utils/functional.pyi | 3 ++- scripts/stubtest/allowlist.txt | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/django-stubs/utils/decorators.pyi b/django-stubs/utils/decorators.pyi index 531db35f3..8014356e4 100644 --- a/django-stubs/utils/decorators.pyi +++ b/django-stubs/utils/decorators.pyi @@ -16,7 +16,7 @@ def decorator_from_middleware_with_args(middleware_class: type) -> Callable: ... def decorator_from_middleware(middleware_class: type) -> Callable: ... def make_middleware_decorator(middleware_class: type[MiddlewareMixin]) -> Callable: ... @type_check_only -class AsyncGetResponseCallable(Protocol): +class _AsyncGetResponseCallable(Protocol): def __call__(self, __request: HttpRequest) -> Awaitable[HttpResponseBase]: ... def sync_and_async_middleware(func: _CallableType) -> _CallableType: ... diff --git a/django-stubs/utils/functional.pyi b/django-stubs/utils/functional.pyi index d9a11068b..3fb7e81c3 100644 --- a/django-stubs/utils/functional.pyi +++ b/django-stubs/utils/functional.pyi @@ -64,7 +64,8 @@ class LazyObject: def __delattr__(self, name: str) -> None: ... def __reduce__(self) -> tuple[Callable, tuple[Model]]: ... def __copy__(self) -> LazyObject: ... - def __deepcopy__(self, memo: dict[int, Any]) -> LazyObject: ... + # TODO: Deepcopy can return a LazyObject or a wrapped object, but we'll need to make LazyObject generic first + def __deepcopy__(self, memo: dict[int, Any]) -> Any: ... __bytes__: Callable __bool__: Callable __dir__: Callable diff --git a/scripts/stubtest/allowlist.txt b/scripts/stubtest/allowlist.txt index b545f8089..3a42ee3b1 100644 --- a/scripts/stubtest/allowlist.txt +++ b/scripts/stubtest/allowlist.txt @@ -34,10 +34,6 @@ django.utils.datastructures.ImmutableList.remove django.utils.datastructures.ImmutableList.sort django.utils.datastructures.ImmutableList.reverse -# Django-stubs protocol (XXX not used internally, check usage/issues) -django.utils.decorators.AsyncGetResponseCallable -django.utils.deprecation.GetResponseCallable - # Promise is lazy, see notes in .pyi django.utils.functional.Promise.__add__ django.utils.functional.Promise.__deepcopy__