Skip to content

Commit 969ed8d

Browse files
authored
5.0: Update django.contrib.sitemaps, django.contrib.staticfiles (typeddjango#2076)
1 parent e4c05b4 commit 969ed8d

File tree

16 files changed

+31
-41
lines changed

16 files changed

+31
-41
lines changed

django-stubs/contrib/sitemaps/__init__.pyi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ from django.core.paginator import Paginator
88
from django.db.models.base import Model
99
from django.db.models.query import QuerySet
1010

11-
PING_URL: str
12-
13-
class SitemapNotFound(Exception): ...
14-
15-
def ping_google(sitemap_url: str | None = ..., ping_url: str = ..., sitemap_uses_https: bool = ...) -> None: ...
16-
1711
_ItemT = TypeVar("_ItemT")
1812

1913
class Sitemap(Generic[_ItemT]):

django-stubs/contrib/sitemaps/management/__init__.pyi

Whitespace-only changes.

django-stubs/contrib/sitemaps/management/commands/__init__.pyi

Whitespace-only changes.

django-stubs/contrib/sitemaps/management/commands/ping_google.pyi

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from typing import NoReturn
22

3+
from django.db.models.base import ModelBase
34
from django.http.request import HttpRequest
45

56
class RequestSite:
67
name: str
78
domain: str
89
def __init__(self, request: HttpRequest) -> None: ...
9-
def save(self, force_insert: bool = ..., force_update: bool = ...) -> NoReturn: ...
10+
def save(self, force_insert: bool | tuple[ModelBase, ...] = ..., force_update: bool = ...) -> NoReturn: ...
1011
def delete(self) -> NoReturn: ...

django-stubs/contrib/staticfiles/checks.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ from collections.abc import Sequence
22
from typing import Any
33

44
from django.apps.config import AppConfig
5-
from django.core.checks.messages import CheckMessage
5+
from django.core.checks.messages import CheckMessage, Error
6+
7+
E005: Error
68

79
def check_finders(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> list[CheckMessage]: ...
10+
def check_storages(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> list[CheckMessage]: ...

django-stubs/contrib/staticfiles/finders.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class BaseFinder:
1717
class FileSystemFinder(BaseFinder):
1818
locations: list[tuple[str, str]]
1919
storages: dict[str, Any]
20-
def __init__(self, app_names: Sequence[str] = ..., *args: Any, **kwargs: Any) -> None: ...
20+
def __init__(self, app_names: Sequence[str] | None = ..., *args: Any, **kwargs: Any) -> None: ...
2121
def find_location(self, root: str, path: str, prefix: str | None = ...) -> str | None: ...
2222
@overload
2323
def find(self, path: str, all: Literal[False] = ...) -> str | None: ...

django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from typing import Any
22

33
from django.core.files.storage import Storage
44
from django.core.management.base import BaseCommand
5+
from django.utils.functional import cached_property
56

67
class Command(BaseCommand):
78
copied_files: Any
@@ -10,7 +11,7 @@ class Command(BaseCommand):
1011
post_processed_files: Any
1112
storage: Any
1213
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
13-
@property
14+
@cached_property
1415
def local(self) -> bool: ...
1516
interactive: Any
1617
verbosity: Any
@@ -21,6 +22,7 @@ class Command(BaseCommand):
2122
post_process: Any
2223
def set_options(self, **options: Any) -> None: ...
2324
def collect(self) -> dict[str, list[str]]: ...
25+
def handle(self, **options: Any) -> str | None: ...
2426
def log(self, msg: str, level: int = ...) -> None: ...
2527
def is_local_storage(self) -> bool: ...
2628
def clear_dir(self, path: str) -> None: ...
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from typing import Any
2+
13
from django.core.management.base import LabelCommand
24

3-
class Command(LabelCommand): ...
5+
class Command(LabelCommand):
6+
def handle_label(self, path: str, **options: Any) -> str | None: ... # type: ignore[override]

django-stubs/contrib/staticfiles/storage.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from collections.abc import Callable, Iterator
2+
from re import Match
23
from typing import Any
34

45
from django.core.files.base import File
@@ -23,10 +24,12 @@ class HashedFilesMixin:
2324
hashed_files: Any
2425
keep_intermediate_files: bool
2526
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
26-
def file_hash(self, name: str, content: File = ...) -> str: ...
27+
def file_hash(self, name: str, content: File | None = ...) -> str | None: ...
2728
def hashed_name(self, name: str, content: File | None = ..., filename: str | None = ...) -> str: ...
2829
def url(self, name: str, force: bool = ...) -> str: ...
29-
def url_converter(self, name: str, hashed_files: dict[str, Any], template: str = ...) -> Callable: ...
30+
def url_converter(
31+
self, name: str, hashed_files: dict[str, Any], template: str | None = ...
32+
) -> Callable[[Match], str]: ...
3033
def post_process(self, paths: dict[str, Any], dry_run: bool = ..., **options: Any) -> _PostProcessT: ...
3134
def clean_name(self, name: str) -> str: ...
3235
def hash_key(self, name: str) -> str: ...
@@ -40,7 +43,7 @@ class ManifestFilesMixin(HashedFilesMixin):
4043
manifest_storage: Storage | None
4144
hashed_files: dict[str, str]
4245
manifest_hash: str
43-
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
46+
def __init__(self, *args: Any, manifest_storage: Storage | None = ..., **kwargs: Any) -> None: ...
4447
def read_manifest(self) -> str: ...
4548
def load_manifest(self) -> dict[str, Any]: ...
4649
def save_manifest(self) -> None: ...

0 commit comments

Comments
 (0)