From bb6a032c56b1708c3af147c355262fdb2ff57058 Mon Sep 17 00:00:00 2001
From: Brian Helba <brian.helba@kitware.com>
Date: Wed, 30 Aug 2023 10:49:36 -0400
Subject: [PATCH] Make "default_storage" produce a "Storage" object

The actual "DefaultStorage" storage class is a "LazyObject" proxy, which ought
to be a generic "LazyObject[Storage]", but doesn't support functionality as a
proxy. Currently, "default_storage" doesn't have a useful annotation.
---
 django-stubs/core/files/storage/__init__.pyi | 3 ++-
 scripts/stubtest/allowlist.txt               | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/django-stubs/core/files/storage/__init__.pyi b/django-stubs/core/files/storage/__init__.pyi
index 6759361da..abd413d8b 100644
--- a/django-stubs/core/files/storage/__init__.pyi
+++ b/django-stubs/core/files/storage/__init__.pyi
@@ -24,4 +24,5 @@ def get_storage_class(import_path: str | None = ...) -> type[Storage]: ...
 class DefaultStorage(LazyObject): ...
 
 storages: StorageHandler
-default_storage: DefaultStorage
+# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage
+default_storage: Storage
diff --git a/scripts/stubtest/allowlist.txt b/scripts/stubtest/allowlist.txt
index 7258cc982..c4e2afa65 100644
--- a/scripts/stubtest/allowlist.txt
+++ b/scripts/stubtest/allowlist.txt
@@ -14,6 +14,9 @@ django.contrib.auth.migrations.*
 django.contrib.flatpages.migrations.*
 django.contrib.contenttypes.migrations.*
 
+# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage
+django.core.files.storage.default_storage
+
 # BaseArchive abstract methods that take no argument, but typed with arguments to match the Archive and TarArchive Implementations
 django.utils.archive.BaseArchive.list
 django.utils.archive.BaseArchive.extract