Skip to content

Commit

Permalink
Make "default_storage" produce a "Storage" object
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brianhelba committed Sep 7, 2023
1 parent 390cbab commit bb6a032
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django-stubs/core/files/storage/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions scripts/stubtest/allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bb6a032

Please sign in to comment.