Skip to content

Commit bb6a032

Browse files
committed
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.
1 parent 390cbab commit bb6a032

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

django-stubs/core/files/storage/__init__.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ def get_storage_class(import_path: str | None = ...) -> type[Storage]: ...
2424
class DefaultStorage(LazyObject): ...
2525

2626
storages: StorageHandler
27-
default_storage: DefaultStorage
27+
# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage
28+
default_storage: Storage

scripts/stubtest/allowlist.txt

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ django.contrib.auth.migrations.*
1414
django.contrib.flatpages.migrations.*
1515
django.contrib.contenttypes.migrations.*
1616

17+
# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage
18+
django.core.files.storage.default_storage
19+
1720
# BaseArchive abstract methods that take no argument, but typed with arguments to match the Archive and TarArchive Implementations
1821
django.utils.archive.BaseArchive.list
1922
django.utils.archive.BaseArchive.extract

0 commit comments

Comments
 (0)