Skip to content

Commit c9387e5

Browse files
authored
Update core.files.storages for Django 5.1 (#2558)
From django/django@0b33a3a: * `django.core.files.storage.filesystem.FileSystemStorage.__init__` updated From django/django@e42defb: * `django.core.files.storage.base.Storage.is_name_available` added From django/django@f72f420: * `django.test.signals.file_storage_changed` removed * `django.core.files.storage.GET_STORAGE_CLASS_DEPRECATED_MSG` removed * `django.core.files.storage.__all__` changed * `django.core.files.storage.get_storage_class` removed
1 parent d7bdfa1 commit c9387e5

File tree

5 files changed

+2
-16
lines changed

5 files changed

+2
-16
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@ __all__ = (
1111
"Storage",
1212
"DefaultStorage",
1313
"default_storage",
14-
"get_storage_class",
1514
"InvalidStorageError",
1615
"StorageHandler",
1716
"storages",
1817
)
1918

20-
GET_STORAGE_CLASS_DEPRECATED_MSG: str
21-
22-
def get_storage_class(import_path: str | None = None) -> type[Storage]: ...
23-
2419
class DefaultStorage(LazyObject): ...
2520

2621
storages: StorageHandler

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ from django.utils._os import _PathCompatible
77
class Storage:
88
def open(self, name: str, mode: str = "rb") -> File: ...
99
def save(self, name: str | None, content: IO[Any], max_length: int | None = None) -> str: ...
10+
def is_name_available(self, name: str, max_length: int | None = None) -> bool: ...
1011
def get_valid_name(self, name: str) -> str: ...
1112
def get_alternative_name(self, file_root: str, file_ext: str) -> str: ...
1213
def get_available_name(self, name: str, max_length: int | None = None) -> str: ...

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class FileSystemStorage(_Deconstructible, Storage, StorageSettingsMixin):
1515
base_url: str | None = None,
1616
file_permissions_mode: int | None = None,
1717
directory_permissions_mode: int | None = None,
18+
allow_overwrite: bool = False,
1819
) -> None: ...
1920
@cached_property
2021
def base_location(self) -> _PathCompatible: ...

django-stubs/test/signals.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ def storages_changed(*, setting: str, **kwargs: Any) -> None: ...
1414
def clear_serializers_cache(*, setting: str, **kwargs: Any) -> None: ...
1515
def language_changed(*, setting: str, **kwargs: Any) -> None: ...
1616
def localize_settings_changed(*, setting: str, **kwargs: Any) -> None: ...
17-
def file_storage_changed(*, setting: str, **kwargs: Any) -> None: ...
1817
def complex_setting_changed(*, setting: str, enter: bool, **kwargs: Any) -> None: ...
1918
def root_urlconf_changed(*, setting: str, **kwargs: Any) -> None: ...
2019
def static_storage_changed(*, setting: str, **kwargs: Any) -> None: ...

scripts/stubtest/allowlist_todo_django51.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ django.contrib.postgres.fields.CIText
5757
django.contrib.postgres.fields.citext.CIText
5858
django.contrib.postgres.indexes.BTreeIndex.__init__
5959
django.contrib.postgres.indexes.OpClass.constraint_validation_compatible
60-
django.core.files.storage.FileSystemStorage.__init__
61-
django.core.files.storage.FileSystemStorage.is_name_available
62-
django.core.files.storage.GET_STORAGE_CLASS_DEPRECATED_MSG
63-
django.core.files.storage.Storage.is_name_available
64-
django.core.files.storage.__all__
65-
django.core.files.storage.base.Storage.is_name_available
66-
django.core.files.storage.filesystem.FileSystemStorage.__init__
67-
django.core.files.storage.filesystem.FileSystemStorage.is_name_available
68-
django.core.files.storage.get_storage_class
6960
django.core.signing.Signer.__init__
7061
django.db.backends.base.operations.BaseDatabaseOperations.bulk_insert_sql
7162
django.db.backends.base.operations.BaseDatabaseOperations.force_group_by
@@ -118,7 +109,6 @@ django.test.selenium.SeleniumTestCase.set_emulated_media
118109
django.test.selenium.SeleniumTestCase.small_screen_size
119110
django.test.selenium.SeleniumTestCase.take_screenshot
120111
django.test.selenium.screenshot_cases
121-
django.test.signals.file_storage_changed
122112
django.test.signals.form_renderer_changed
123113
django.test.utils.garbage_collect
124114
django.urls.resolvers.whitespace_set

0 commit comments

Comments
 (0)