mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-91520 Update django stubs version to 6.0.9
Closes PY-91520 (cherry picked from commit 91065ac60b5b87595f0d978bcbe3b7dad7a54afb) IJ-MR-217716 GitOrigin-RevId: daa9b7472ef9951572459c536e5349e41b50e4fc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a7b8b0e4f5
commit
d10805b6fd
@@ -1,4 +1,5 @@
|
||||
import threading
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any
|
||||
|
||||
@@ -13,7 +14,9 @@ class Apps:
|
||||
apps_ready: bool
|
||||
ready_event: threading.Event
|
||||
loading: bool
|
||||
_pending_operations: dict[tuple[str, str], list]
|
||||
# Maps ("app_label", "modelname") tuples to lists of functions to be called when the corresponding model is ready.
|
||||
_pending_operations: defaultdict[tuple[str, str], list[Callable[[type[Model]], Any]]]
|
||||
_apps: dict[str, type[Any]]
|
||||
models_ready: bool
|
||||
ready: bool
|
||||
def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ()) -> None: ...
|
||||
@@ -35,7 +38,7 @@ class Apps:
|
||||
def set_installed_apps(self, installed: Iterable[str]) -> None: ...
|
||||
def unset_installed_apps(self) -> None: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ...
|
||||
def lazy_model_operation(self, function: Callable[..., Any], *model_keys: Any) -> None: ...
|
||||
def do_pending_operations(self, model: type[Model]) -> None: ...
|
||||
|
||||
apps: Apps
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.response import TemplateResponse
|
||||
|
||||
def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> TemplateResponse | None: ...
|
||||
def delete_selected(
|
||||
modeladmin: ModelAdmin[Any], request: HttpRequest, queryset: QuerySet[Any]
|
||||
) -> TemplateResponse | None: ...
|
||||
|
||||
@@ -6,20 +6,19 @@ from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.core.checks.messages import CheckMessage
|
||||
from typing_extensions import override
|
||||
|
||||
def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_dependencies(**kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_dependencies(**kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
class BaseModelAdminChecks:
|
||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check(self, admin_obj: BaseModelAdmin[Any], **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
class ModelAdminChecks(BaseModelAdminChecks):
|
||||
@override
|
||||
def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
class ModelAdminChecks(BaseModelAdminChecks): ...
|
||||
|
||||
class InlineModelAdminChecks(BaseModelAdminChecks):
|
||||
# We need this override because `InlineModelAdminChecks` rename `admin_obj` to `inline_obj` here
|
||||
@override
|
||||
def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore[override]
|
||||
def check(self, inline_obj: BaseModelAdmin[Any], **kwargs: object) -> list[CheckMessage]: ... # type: ignore[override]
|
||||
|
||||
def must_be(type: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...
|
||||
def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...
|
||||
def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ...
|
||||
def must_be(type: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ...
|
||||
def must_inherit_from(parent: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ...
|
||||
def refer_to_missing_field(field: str, option: str, obj: BaseModelAdmin[Any], id: str) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -27,11 +27,11 @@ class ListFilter:
|
||||
request: HttpRequest
|
||||
used_parameters: dict[str, object]
|
||||
def __init__(
|
||||
self, request: HttpRequest, params: dict[str, list[str]], model: type[Model], model_admin: ModelAdmin
|
||||
self, request: HttpRequest, params: dict[str, list[str]], model: type[Model], model_admin: ModelAdmin[Any]
|
||||
) -> None: ...
|
||||
def has_output(self) -> bool: ...
|
||||
def choices(self, changelist: ChangeList) -> Iterator[Mapping[str, object]]: ...
|
||||
def queryset(self, request: HttpRequest, queryset: QuerySet) -> QuerySet | None: ...
|
||||
def queryset(self, request: HttpRequest, queryset: QuerySet[Any]) -> QuerySet[Any] | None: ...
|
||||
def expected_parameters(self) -> list[str | None]: ...
|
||||
|
||||
class FacetsMixin:
|
||||
@@ -45,7 +45,9 @@ class SimpleListFilter(FacetsMixin, ListFilter):
|
||||
parameter_name: str | None
|
||||
lookup_choices: list[tuple[str, _StrOrPromise]]
|
||||
def value(self) -> str | None: ...
|
||||
def lookups(self, request: HttpRequest, model_admin: ModelAdmin) -> Iterable[tuple[str, _StrOrPromise]] | None: ...
|
||||
def lookups(
|
||||
self, request: HttpRequest, model_admin: ModelAdmin[Any]
|
||||
) -> Iterable[tuple[str, _StrOrPromise]] | None: ...
|
||||
@override
|
||||
def choices(self, changelist: ChangeList) -> Iterator[_ListFilterChoices]: ...
|
||||
|
||||
@@ -59,7 +61,7 @@ class FieldListFilter(FacetsMixin, ListFilter):
|
||||
request: HttpRequest,
|
||||
params: dict[str, list[str]],
|
||||
model: type[Model],
|
||||
model_admin: ModelAdmin,
|
||||
model_admin: ModelAdmin[Any],
|
||||
field_path: str,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
@@ -73,7 +75,7 @@ class FieldListFilter(FacetsMixin, ListFilter):
|
||||
request: HttpRequest,
|
||||
params: dict[str, list[str]],
|
||||
model: type[Model],
|
||||
model_admin: ModelAdmin,
|
||||
model_admin: ModelAdmin[Any],
|
||||
field_path: str,
|
||||
) -> FieldListFilter: ...
|
||||
@override
|
||||
@@ -90,10 +92,10 @@ class RelatedFieldListFilter(FieldListFilter):
|
||||
@property
|
||||
def include_empty_choice(self) -> bool: ...
|
||||
def field_admin_ordering(
|
||||
self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin
|
||||
self, field: RelatedField[Any, Any], request: HttpRequest, model_admin: ModelAdmin[Any]
|
||||
) -> _ListOrTuple[str]: ...
|
||||
def field_choices(
|
||||
self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin
|
||||
self, field: RelatedField[Any, Any], request: HttpRequest, model_admin: ModelAdmin[Any]
|
||||
) -> list[tuple[str, _StrOrPromise]]: ...
|
||||
|
||||
class BooleanFieldListFilter(FieldListFilter):
|
||||
@@ -122,7 +124,7 @@ class AllValuesFieldListFilter(FieldListFilter):
|
||||
lookup_val: str | None
|
||||
lookup_val_isnull: str | None
|
||||
empty_value_display: SafeString
|
||||
lookup_choices: QuerySet
|
||||
lookup_choices: QuerySet[Any]
|
||||
|
||||
class RelatedOnlyFieldListFilter(RelatedFieldListFilter): ...
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
|
||||
from typing import Any, type_check_only
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.contrib.admin.options import BaseModelAdmin, ModelAdmin
|
||||
from django.db.models import Model
|
||||
from django.db.models.fields import AutoField
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
@@ -29,17 +29,17 @@ class _PrepopulatedDict(TypedDict):
|
||||
|
||||
class AdminForm:
|
||||
prepopulated_fields: list[_PrepopulatedDict]
|
||||
model_admin: ModelAdmin | None
|
||||
model_admin: BaseModelAdmin[Any] | None
|
||||
readonly_fields: Sequence[str]
|
||||
form: ModelForm
|
||||
form: ModelForm[Any]
|
||||
fieldsets: list[tuple[Any, dict[str, list[str]]]]
|
||||
def __init__(
|
||||
self,
|
||||
form: ModelForm,
|
||||
form: ModelForm[Any],
|
||||
fieldsets: list[tuple[Any, dict[str, list[str]]]],
|
||||
prepopulated_fields: Mapping[str, Iterable[str]],
|
||||
readonly_fields: Sequence[str] | None = ...,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[Fieldset]: ...
|
||||
@property
|
||||
@@ -54,20 +54,20 @@ class AdminForm:
|
||||
def media(self) -> Media: ...
|
||||
|
||||
class Fieldset:
|
||||
form: ModelForm
|
||||
form: ModelForm[Any]
|
||||
classes: str
|
||||
description: str | None
|
||||
model_admin: ModelAdmin | None
|
||||
model_admin: BaseModelAdmin[Any] | None
|
||||
readonly_fields: Sequence[str]
|
||||
def __init__(
|
||||
self,
|
||||
form: ModelForm,
|
||||
form: ModelForm[Any],
|
||||
name: Any | None = ...,
|
||||
readonly_fields: Sequence[str] = ...,
|
||||
fields: Sequence[str] = ...,
|
||||
classes: Iterable[str] = ...,
|
||||
description: str | None = ...,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
) -> None: ...
|
||||
@cached_property
|
||||
def is_collapsible(self) -> bool: ...
|
||||
@@ -76,17 +76,17 @@ class Fieldset:
|
||||
def __iter__(self) -> Iterator[Fieldline]: ...
|
||||
|
||||
class Fieldline:
|
||||
form: ModelForm
|
||||
form: ModelForm[Any]
|
||||
fields: Sequence[str]
|
||||
has_visible_field: bool
|
||||
model_admin: ModelAdmin | None
|
||||
model_admin: BaseModelAdmin[Any] | None
|
||||
readonly_fields: Sequence[str]
|
||||
def __init__(
|
||||
self,
|
||||
form: ModelForm,
|
||||
form: ModelForm[Any],
|
||||
field: str | Sequence[str],
|
||||
readonly_fields: Sequence[str] | None = ...,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[AdminField | AdminReadonlyField]: ...
|
||||
def errors(self) -> SafeString: ...
|
||||
@@ -96,7 +96,7 @@ class AdminField:
|
||||
is_first: bool
|
||||
is_checkbox: bool
|
||||
is_readonly: bool
|
||||
def __init__(self, form: ModelForm, field: str, is_first: bool) -> None: ...
|
||||
def __init__(self, form: ModelForm[Any], field: str, is_first: bool) -> None: ...
|
||||
def label_tag(self) -> SafeString: ...
|
||||
def errors(self) -> SafeString: ...
|
||||
|
||||
@@ -110,18 +110,18 @@ class _FieldDictT(TypedDict):
|
||||
|
||||
class AdminReadonlyField:
|
||||
field: _FieldDictT
|
||||
form: ModelForm
|
||||
model_admin: ModelAdmin | None
|
||||
form: ModelForm[Any]
|
||||
model_admin: BaseModelAdmin[Any] | None
|
||||
is_first: bool
|
||||
is_checkbox: bool
|
||||
is_readonly: bool
|
||||
empty_value_display: Any
|
||||
def __init__(
|
||||
self,
|
||||
form: ModelForm,
|
||||
form: ModelForm[Any],
|
||||
field: Callable[[Model], Any] | str,
|
||||
is_first: bool,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
) -> None: ...
|
||||
def label_tag(self) -> SafeString: ...
|
||||
def get_admin_url(self, remote_field: ForeignObjectRel, remote_obj: Model) -> str: ...
|
||||
@@ -131,7 +131,7 @@ class InlineAdminFormSet:
|
||||
opts: Any
|
||||
formset: Any
|
||||
fieldsets: Any
|
||||
model_admin: ModelAdmin | None
|
||||
model_admin: ModelAdmin[Any] | None
|
||||
readonly_fields: Sequence[str]
|
||||
prepopulated_fields: dict[str, Any]
|
||||
classes: str
|
||||
@@ -146,7 +146,7 @@ class InlineAdminFormSet:
|
||||
fieldsets: Any,
|
||||
prepopulated_fields: dict[str, Any] | None = ...,
|
||||
readonly_fields: Sequence[str] | None = ...,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: ModelAdmin[Any] | None = ...,
|
||||
has_add_permission: bool = ...,
|
||||
has_change_permission: bool = ...,
|
||||
has_delete_permission: bool = ...,
|
||||
@@ -175,17 +175,17 @@ class InlineAdminForm(AdminForm):
|
||||
def __init__(
|
||||
self,
|
||||
formset: Any,
|
||||
form: ModelForm,
|
||||
form: ModelForm[Any],
|
||||
fieldsets: Any,
|
||||
prepopulated_fields: Any,
|
||||
original: bool | None,
|
||||
readonly_fields: Sequence[str] | None = ...,
|
||||
model_admin: ModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
view_on_site_url: str | None = ...,
|
||||
) -> None: ...
|
||||
@override
|
||||
def __iter__(self) -> Iterator[InlineFieldset]: ...
|
||||
def needs_explicit_pk_field(self) -> bool | AutoField: ...
|
||||
def needs_explicit_pk_field(self) -> bool | AutoField[Any, Any]: ...
|
||||
def pk_field(self) -> AdminField: ...
|
||||
def fk_field(self) -> AdminField: ...
|
||||
def deletion_field(self) -> AdminField: ...
|
||||
@@ -197,4 +197,4 @@ class InlineFieldset(Fieldset):
|
||||
def __iter__(self) -> Iterator[Fieldline]: ...
|
||||
|
||||
class AdminErrorList(forms.utils.ErrorList):
|
||||
def __init__(self, form: ModelForm, inline_formsets: Any) -> None: ...
|
||||
def __init__(self, form: ModelForm[Any], inline_formsets: Any) -> None: ...
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import datetime as dt
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, ClassVar, Literal, overload
|
||||
from uuid import UUID
|
||||
|
||||
from django.contrib.auth.models import _User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable
|
||||
|
||||
ADDITION: int
|
||||
CHANGE: int
|
||||
@@ -33,13 +37,13 @@ class LogEntryManager(models.Manager[LogEntry]):
|
||||
) -> list[LogEntry]: ...
|
||||
|
||||
class LogEntry(models.Model):
|
||||
action_time: models.DateTimeField
|
||||
user: models.ForeignKey
|
||||
content_type: models.ForeignKey
|
||||
object_id: models.TextField
|
||||
object_repr: models.CharField
|
||||
action_flag: models.PositiveSmallIntegerField
|
||||
change_message: models.TextField
|
||||
action_time: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime]
|
||||
user: models.ForeignKey[_User | Combinable, _User]
|
||||
content_type: models.ForeignKey[ContentType | Combinable | None, ContentType | None]
|
||||
object_id: models.TextField[str | Combinable | None, str | None]
|
||||
object_repr: models.CharField[str | int | Combinable, str]
|
||||
action_flag: models.PositiveSmallIntegerField[float | int | str | Combinable, int]
|
||||
change_message: models.TextField[str | Combinable, str]
|
||||
objects: ClassVar[LogEntryManager]
|
||||
def is_addition(self) -> bool: ...
|
||||
def is_change(self) -> bool: ...
|
||||
|
||||
@@ -112,20 +112,24 @@ class BaseModelAdmin(Generic[_ModelT], metaclass=MediaDefiningClass):
|
||||
def formfield_for_choice_field(
|
||||
self, db_field: Field[Any, Any], request: HttpRequest, **kwargs: Any
|
||||
) -> TypedChoiceField | None: ...
|
||||
def get_field_queryset(self, db: str | None, db_field: RelatedField, request: HttpRequest) -> QuerySet | None: ...
|
||||
def get_field_queryset(
|
||||
self, db: str | None, db_field: RelatedField[Any, Any], request: HttpRequest
|
||||
) -> QuerySet[Any] | None: ...
|
||||
def formfield_for_foreignkey(
|
||||
self, db_field: ForeignKey, request: HttpRequest, **kwargs: Any
|
||||
) -> ModelChoiceField | None: ...
|
||||
self, db_field: ForeignKey[Any, Any], request: HttpRequest, **kwargs: Any
|
||||
) -> ModelChoiceField[Any] | None: ...
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: ManyToManyField, request: HttpRequest, **kwargs: Any
|
||||
) -> ModelMultipleChoiceField | None: ...
|
||||
self, db_field: ManyToManyField[Any, Any], request: HttpRequest, **kwargs: Any
|
||||
) -> ModelMultipleChoiceField[Any] | None: ...
|
||||
def get_autocomplete_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ...
|
||||
def get_view_on_site_url(self, obj: _ModelT | None = ...) -> str | None: ...
|
||||
def get_empty_value_display(self) -> SafeString: ...
|
||||
def get_exclude(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str] | None: ...
|
||||
def get_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldGroups: ...
|
||||
def get_fieldsets(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldsetSpec: ...
|
||||
def get_inlines(self, request: HttpRequest, obj: _ModelT | None) -> _ListOrTuple[type[InlineModelAdmin]]: ...
|
||||
def get_inlines(
|
||||
self, request: HttpRequest, obj: _ModelT | None
|
||||
) -> _ListOrTuple[type[InlineModelAdmin[Any, Any]]]: ...
|
||||
def get_ordering(self, request: HttpRequest) -> _ListOrTuple[_OrderByFieldName]: ...
|
||||
def get_readonly_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str]: ...
|
||||
def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ...
|
||||
@@ -163,7 +167,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
paginator: ClassVar[type]
|
||||
preserve_filters: ClassVar[bool]
|
||||
show_facets: ClassVar[ShowFacets]
|
||||
inlines: ClassVar[_ListOrTuple[type[InlineModelAdmin]]]
|
||||
inlines: ClassVar[_ListOrTuple[type[InlineModelAdmin[Any, Any]]]]
|
||||
add_form_template: ClassVar[_TemplateForResponseT | None]
|
||||
change_form_template: ClassVar[_TemplateForResponseT | None]
|
||||
change_list_template: ClassVar[_TemplateForResponseT | None]
|
||||
@@ -180,7 +184,9 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
opts: Options[_ModelT]
|
||||
admin_site: AdminSite
|
||||
def __init__(self, model: type[_ModelT], admin_site: AdminSite) -> None: ...
|
||||
def get_inline_instances(self, request: HttpRequest, obj: _ModelT | None = ...) -> list[InlineModelAdmin]: ...
|
||||
def get_inline_instances(
|
||||
self, request: HttpRequest, obj: _ModelT | None = ...
|
||||
) -> list[InlineModelAdmin[Any, Any]]: ...
|
||||
def get_urls(self) -> list[URLPattern]: ...
|
||||
@property
|
||||
def urls(self) -> list[URLPattern]: ...
|
||||
@@ -202,11 +208,11 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
def get_paginator(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
queryset: QuerySet,
|
||||
queryset: QuerySet[Any],
|
||||
per_page: int,
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
) -> Paginator: ...
|
||||
) -> Paginator[Any]: ...
|
||||
def log_addition(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ...
|
||||
def log_change(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ...
|
||||
def log_deletions(self, request: HttpRequest, queryset: QuerySet[_ModelT]) -> list[LogEntry]: ...
|
||||
@@ -215,7 +221,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
def get_action_choices(
|
||||
self, request: HttpRequest, default_choices: list[tuple[str, str]] = ...
|
||||
) -> list[tuple[str, str]]: ...
|
||||
def get_action(self, action: Callable | str) -> tuple[Callable[..., str], str, str] | None: ...
|
||||
def get_action(self, action: Callable[..., Any] | str) -> tuple[Callable[..., str], str, str] | None: ...
|
||||
def get_list_display(self, request: HttpRequest) -> _ListDisplayT[_ModelT]: ...
|
||||
def get_list_display_links(
|
||||
self, request: HttpRequest, list_display: _ListDisplayT[_ModelT]
|
||||
@@ -224,13 +230,13 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
def get_list_select_related(self, request: HttpRequest) -> bool | _ListOrTuple[str]: ...
|
||||
def get_search_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ...
|
||||
def get_search_results(
|
||||
self, request: HttpRequest, queryset: QuerySet, search_term: str
|
||||
self, request: HttpRequest, queryset: QuerySet[Any], search_term: str
|
||||
) -> tuple[QuerySet[_ModelT], bool]: ...
|
||||
def get_preserved_filters(self, request: HttpRequest) -> str: ...
|
||||
def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> list[str]: ...
|
||||
def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet[_ModelT]: ...
|
||||
def construct_change_message(
|
||||
self, request: HttpRequest, form: forms.Form, formsets: Iterable[BaseFormSet], add: bool = ...
|
||||
self, request: HttpRequest, form: forms.Form, formsets: Iterable[BaseFormSet[Any]], add: bool = ...
|
||||
) -> list[dict[str, dict[str, list[str]]]]: ...
|
||||
def message_user(
|
||||
self,
|
||||
@@ -243,7 +249,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
def save_form(self, request: HttpRequest, form: Any, change: Any) -> Any: ...
|
||||
def save_model(self, request: HttpRequest, obj: _ModelT, form: Any, change: Any) -> None: ...
|
||||
def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ...
|
||||
def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ...
|
||||
def delete_queryset(self, request: HttpRequest, queryset: QuerySet[Any]) -> None: ...
|
||||
def save_formset(self, request: HttpRequest, form: Any, formset: Any, change: Any) -> None: ...
|
||||
def save_related(self, request: HttpRequest, form: Any, formsets: Any, change: Any) -> None: ...
|
||||
def render_change_form(
|
||||
@@ -260,7 +266,7 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
|
||||
def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
|
||||
def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ...
|
||||
# Probably FileResponse cannot come from ModelAdmin views
|
||||
def response_action(self, request: HttpRequest, queryset: QuerySet) -> HttpResponse | None: ...
|
||||
def response_action(self, request: HttpRequest, queryset: QuerySet[Any]) -> HttpResponse | None: ...
|
||||
def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ...
|
||||
def render_delete_form(self, request: HttpRequest, context: dict[str, Any]) -> HttpResponse: ...
|
||||
def get_inline_formsets(
|
||||
@@ -332,7 +338,9 @@ class InlineModelAdmin(BaseModelAdmin[Any], Generic[_ChildModelT, _ParentModelT]
|
||||
@override
|
||||
def get_fieldsets(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> _FieldsetSpec: ...
|
||||
@override
|
||||
def get_inlines(self, request: HttpRequest, obj: _ParentModelT | None) -> _ListOrTuple[type[InlineModelAdmin]]: ...
|
||||
def get_inlines(
|
||||
self, request: HttpRequest, obj: _ParentModelT | None
|
||||
) -> _ListOrTuple[type[InlineModelAdmin[Any, Any]]]: ...
|
||||
@override
|
||||
def get_readonly_fields(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> _ListOrTuple[str]: ...
|
||||
@override
|
||||
|
||||
@@ -20,7 +20,7 @@ all_sites: WeakSet[AdminSite]
|
||||
|
||||
_ViewType = TypeVar("_ViewType", bound=Callable[..., HttpResponseBase])
|
||||
_ModelT = TypeVar("_ModelT", bound=Model)
|
||||
_ActionCallback: TypeAlias = Callable[[ModelAdmin, HttpRequest, QuerySet], TemplateResponse | None]
|
||||
_ActionCallback: TypeAlias = Callable[[ModelAdmin[Any], HttpRequest, QuerySet[Any]], TemplateResponse | None]
|
||||
|
||||
class AdminSite:
|
||||
site_title: _StrOrPromise
|
||||
@@ -40,7 +40,7 @@ class AdminSite:
|
||||
empty_value_display: str
|
||||
final_catch_all_view: bool
|
||||
_empty_value_display: str
|
||||
_registry: dict[type[Model], ModelAdmin]
|
||||
_registry: dict[type[Model], ModelAdmin[Any]]
|
||||
_global_actions: dict[str, _ActionCallback]
|
||||
_actions: dict[str, _ActionCallback]
|
||||
def __init__(self, name: str = ...) -> None: ...
|
||||
@@ -84,4 +84,5 @@ class AdminSite:
|
||||
|
||||
class DefaultAdminSite(LazyObject[AdminSite]): ...
|
||||
|
||||
# site is actually an instance of DefaultAdminSite, but it proxies through to a AdminSite
|
||||
site: AdminSite
|
||||
|
||||
+4
-4
@@ -18,11 +18,11 @@ def paginator_number(cl: ChangeList, i: int) -> SafeString: ...
|
||||
def pagination(cl: ChangeList) -> dict[str, Any]: ...
|
||||
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def result_headers(cl: ChangeList) -> Iterator[dict[str, int | str | None]]: ...
|
||||
def items_for_result(cl: ChangeList, result: Model, form: ModelForm | None) -> Iterator[SafeString]: ...
|
||||
def items_for_result(cl: ChangeList, result: Model, form: ModelForm[Any] | None) -> Iterator[SafeString]: ...
|
||||
|
||||
class ResultList(list):
|
||||
form: ModelForm | None
|
||||
def __init__(self, form: ModelForm | None, *items: Any) -> None: ...
|
||||
class ResultList(list[Any]):
|
||||
form: ModelForm[Any] | None
|
||||
def __init__(self, form: ModelForm[Any] | None, *items: Any) -> None: ...
|
||||
|
||||
def results(cl: ChangeList) -> Iterator[ResultList]: ...
|
||||
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ from django.utils.safestring import SafeString
|
||||
|
||||
register: Any
|
||||
|
||||
def admin_urlname(value: Options, arg: SafeString) -> str: ...
|
||||
def admin_urlname(value: Options[Any], arg: SafeString) -> str: ...
|
||||
def admin_urlquote(value: int | str | UUID) -> int | str | UUID: ...
|
||||
def add_preserved_filters(
|
||||
context: dict[str, Options | str] | RequestContext,
|
||||
context: dict[str, Options[Any] | str] | RequestContext,
|
||||
url: str,
|
||||
popup: bool = ...,
|
||||
to_field: str | None = ...,
|
||||
|
||||
+2
-2
@@ -9,12 +9,12 @@ from typing_extensions import override
|
||||
|
||||
class InclusionAdminNode(InclusionNode):
|
||||
args: list[Any]
|
||||
func: Callable
|
||||
func: Callable[..., Any]
|
||||
kwargs: dict[str, Any]
|
||||
takes_context: bool
|
||||
template_name: str
|
||||
def __init__(
|
||||
self, parser: Parser, token: Token, func: Callable, template_name: str, takes_context: bool = ...
|
||||
self, parser: Parser, token: Token, func: Callable[..., Any], template_name: str, takes_context: bool = ...
|
||||
) -> None: ...
|
||||
@override
|
||||
def render(self, context: Context) -> SafeString: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from re import Pattern
|
||||
from typing import Any, Literal, overload, type_check_only
|
||||
from uuid import UUID
|
||||
|
||||
@@ -22,10 +23,11 @@ _T = TypeVar("_T")
|
||||
|
||||
QUOTE_MAP: dict[int, str]
|
||||
UNQUOTE_MAP: dict[str, str]
|
||||
UNQUOTE_RE: Pattern[str]
|
||||
|
||||
class FieldIsAForeignKeyColumnName(Exception): ...
|
||||
|
||||
def lookup_spawns_duplicates(opts: Options, lookup_path: str) -> bool: ...
|
||||
def lookup_spawns_duplicates(opts: Options[Any], lookup_path: str) -> bool: ...
|
||||
def get_last_value_from_parameters(parameters: dict[str, list[str] | str], key: str) -> str | None: ...
|
||||
@overload
|
||||
def prepare_lookup_value(key: str, value: list[str], separator: str = ...) -> list[str] | list[bool]: ...
|
||||
@@ -79,24 +81,24 @@ class _ModelFormatDict(TypedDict):
|
||||
verbose_name: str
|
||||
verbose_name_plural: str
|
||||
|
||||
def model_format_dict(obj: Model | type[Model] | QuerySet | Options[Model]) -> _ModelFormatDict: ...
|
||||
def model_ngettext(obj: Options | QuerySet, n: int | None = ...) -> str: ...
|
||||
def model_format_dict(obj: Model | type[Model] | QuerySet[Any] | Options[Model]) -> _ModelFormatDict: ...
|
||||
def model_ngettext(obj: Options[Any] | QuerySet[Any], n: int | None = ...) -> str: ...
|
||||
def lookup_field(
|
||||
name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ...
|
||||
name: Callable[..., Any] | str, obj: Model, model_admin: BaseModelAdmin[Any] | None = ...
|
||||
) -> tuple[Field[Any, Any] | None, str | None, Any]: ...
|
||||
@overload
|
||||
def label_for_field(
|
||||
name: Callable | str,
|
||||
name: Callable[..., Any] | str,
|
||||
model: type[Model],
|
||||
model_admin: BaseModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
return_attr: Literal[True] = True,
|
||||
form: BaseForm | None = ...,
|
||||
) -> tuple[str, Callable | str | None]: ...
|
||||
) -> tuple[str, Callable[..., Any] | str | None]: ...
|
||||
@overload
|
||||
def label_for_field(
|
||||
name: Callable | str,
|
||||
name: Callable[..., Any] | str,
|
||||
model: type[Model],
|
||||
model_admin: BaseModelAdmin | None = ...,
|
||||
model_admin: BaseModelAdmin[Any] | None = ...,
|
||||
return_attr: Literal[False] = False,
|
||||
form: BaseForm | None = ...,
|
||||
) -> str: ...
|
||||
@@ -112,5 +114,5 @@ def get_model_from_relation(field: Field[Any, Any] | reverse_related.ForeignObje
|
||||
def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ...
|
||||
def get_fields_from_path(model: type[Model], path: str) -> list[Field[Any, Any]]: ...
|
||||
def construct_change_message(
|
||||
form: Form, formsets: Iterable[BaseFormSet], add: bool
|
||||
form: Form, formsets: Iterable[BaseFormSet[Any]], add: bool
|
||||
) -> list[dict[str, dict[str, list[str]]]]: ...
|
||||
|
||||
+6
-4
@@ -1,3 +1,5 @@
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.db.models import Model
|
||||
@@ -5,11 +7,11 @@ from django.db.models.fields.related import ForeignKey
|
||||
from django.http.request import HttpRequest
|
||||
from django.views.generic.list import BaseListView
|
||||
|
||||
class AutocompleteJsonView(BaseListView):
|
||||
class AutocompleteJsonView(BaseListView[Any]):
|
||||
admin_site: AdminSite | None
|
||||
model_admin: ModelAdmin
|
||||
source_field: ForeignKey
|
||||
model_admin: ModelAdmin[Any]
|
||||
source_field: ForeignKey[Any, Any]
|
||||
term: str
|
||||
def serialize_result(self, obj: Model, to_field_name: str) -> dict[str, str]: ...
|
||||
def process_request(self, request: HttpRequest) -> tuple[str, ModelAdmin, ForeignKey, str]: ...
|
||||
def process_request(self, request: HttpRequest) -> tuple[str, ModelAdmin[Any], ForeignKey[Any, Any], str]: ...
|
||||
def has_perm(self, request: HttpRequest, obj: Model | None = ...) -> bool: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from collections.abc import Callable
|
||||
from typing import overload
|
||||
from typing import Any, overload
|
||||
|
||||
from django.utils.functional import _StrOrPromise
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
_C = TypeVar("_C", bound=Callable)
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
@overload
|
||||
def staff_member_required(
|
||||
@@ -13,4 +13,4 @@ def staff_member_required(
|
||||
@overload
|
||||
def staff_member_required(
|
||||
view_func: None = None, redirect_field_name: str | None = ..., login_url: _StrOrPromise = ...
|
||||
) -> Callable: ...
|
||||
) -> Callable[..., Any]: ...
|
||||
|
||||
@@ -22,11 +22,11 @@ class ChangeListSearchForm(forms.Form): ...
|
||||
class ChangeList:
|
||||
search_form_class: type[forms.Form]
|
||||
model: type[Model]
|
||||
opts: Options
|
||||
lookup_opts: Options
|
||||
root_queryset: QuerySet
|
||||
list_display: _ListDisplayT
|
||||
list_display_links: _ListDisplayT
|
||||
opts: Options[Any]
|
||||
lookup_opts: Options[Any]
|
||||
root_queryset: QuerySet[Any]
|
||||
list_display: _ListDisplayT[Any]
|
||||
list_display_links: _ListDisplayT[Any]
|
||||
list_filter: Sequence[_ListFilterT]
|
||||
date_hierarchy: Any
|
||||
search_fields: Sequence[str]
|
||||
@@ -34,7 +34,7 @@ class ChangeList:
|
||||
list_select_related: bool | Sequence[str]
|
||||
list_per_page: int
|
||||
list_max_show_all: int
|
||||
model_admin: ModelAdmin
|
||||
model_admin: ModelAdmin[Any]
|
||||
preserved_filters: str
|
||||
sortable_by: Sequence[str] | None
|
||||
page_num: int
|
||||
@@ -52,13 +52,13 @@ class ChangeList:
|
||||
queryset: Any
|
||||
title: str
|
||||
pk_attname: str
|
||||
formset: BaseFormSet | None
|
||||
formset: BaseFormSet[Any] | None
|
||||
def __init__(
|
||||
self,
|
||||
request: HttpRequest,
|
||||
model: type[Model],
|
||||
list_display: _ListDisplayT,
|
||||
list_display_links: _ListDisplayT,
|
||||
list_display: _ListDisplayT[Any],
|
||||
list_display_links: _ListDisplayT[Any],
|
||||
list_filter: Sequence[_ListFilterT],
|
||||
date_hierarchy: str | None,
|
||||
search_fields: Sequence[str],
|
||||
@@ -66,7 +66,7 @@ class ChangeList:
|
||||
list_per_page: int,
|
||||
list_max_show_all: int,
|
||||
list_editable: Sequence[str],
|
||||
model_admin: ModelAdmin,
|
||||
model_admin: ModelAdmin[Any],
|
||||
sortable_by: Sequence[str] | None,
|
||||
search_help_text: str | None,
|
||||
) -> None: ...
|
||||
@@ -82,14 +82,16 @@ class ChangeList:
|
||||
multi_page: bool
|
||||
paginator: Any
|
||||
def get_results(self, request: HttpRequest) -> None: ...
|
||||
def get_ordering_field(self, field_name: Callable | str) -> _OrderByFieldName | None: ...
|
||||
def get_ordering(self, request: HttpRequest, queryset: QuerySet) -> list[_OrderByFieldName]: ...
|
||||
def get_ordering_field(self, field_name: Callable[..., Any] | str) -> _OrderByFieldName | None: ...
|
||||
def get_ordering(self, request: HttpRequest, queryset: QuerySet[Any]) -> list[_OrderByFieldName]: ...
|
||||
def get_ordering_field_columns(self) -> dict[int, Literal["desc", "asc"]]: ...
|
||||
def get_queryset(self, request: HttpRequest, exclude_parameters: list[str | None] | None = ...) -> QuerySet: ...
|
||||
def get_queryset(
|
||||
self, request: HttpRequest, exclude_parameters: list[str | None] | None = ...
|
||||
) -> QuerySet[Any]: ...
|
||||
filter_specs: list[ListFilter]
|
||||
has_filters: bool
|
||||
has_active_filters: bool
|
||||
clear_all_filters_qs: str
|
||||
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
|
||||
def apply_select_related(self, qs: QuerySet[Any]) -> QuerySet[Any]: ...
|
||||
def has_related_field_in_list_display(self) -> bool: ...
|
||||
def url_for_result(self, result: Model) -> str: ...
|
||||
|
||||
@@ -92,7 +92,9 @@ class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
||||
@override
|
||||
def format_value(self, value: Any) -> str | None: ...
|
||||
@override
|
||||
def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...
|
||||
def value_from_datadict(
|
||||
self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str
|
||||
) -> Any: ...
|
||||
|
||||
class RelatedFieldWidgetWrapper(forms.Widget):
|
||||
template_name: str
|
||||
@@ -117,17 +119,19 @@ class RelatedFieldWidgetWrapper(forms.Widget):
|
||||
@override
|
||||
def is_hidden(self) -> bool: ...
|
||||
@property
|
||||
def choices(self) -> ModelChoiceIterator: ...
|
||||
def choices(self) -> ModelChoiceIterator[Any]: ...
|
||||
@choices.setter
|
||||
def choices(self, value: ModelChoiceIterator) -> None: ...
|
||||
def choices(self, value: ModelChoiceIterator[Any]) -> None: ...
|
||||
def get_related_url(self, info: tuple[str, str], action: str, *args: Any) -> str: ...
|
||||
@override
|
||||
def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ...
|
||||
@override
|
||||
def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ...
|
||||
def value_from_datadict(
|
||||
self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str
|
||||
) -> Any: ...
|
||||
@override
|
||||
def value_omitted_from_data(
|
||||
self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str
|
||||
self, data: Mapping[str, Any], files: Mapping[str, Iterable[File[Any]]], name: str
|
||||
) -> bool: ...
|
||||
@override
|
||||
def id_for_label(self, id_: str) -> str: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.utils.safestring import SafeString
|
||||
|
||||
docutils_is_available: bool
|
||||
|
||||
def get_view_name(view_func: Callable) -> str: ...
|
||||
def get_view_name(view_func: Callable[..., Any]) -> str: ...
|
||||
def parse_docstring(docstring: str) -> tuple[str, str, dict[str, str]]: ...
|
||||
def parse_rst(text: str, default_reference_context: Any, thing_being_parsed: Any | None = ...) -> SafeString: ...
|
||||
|
||||
@@ -25,9 +25,9 @@ def default_reference_role(
|
||||
content: Any | None = ...,
|
||||
) -> tuple[list[Any], list[Any]]: ...
|
||||
|
||||
named_group_matcher: Any
|
||||
unnamed_group_matcher: Any
|
||||
non_capturing_group_matcher: Any
|
||||
named_group_matcher: Pattern[str]
|
||||
unnamed_group_matcher: Pattern[str]
|
||||
non_capturing_group_matcher: Pattern[str]
|
||||
|
||||
def replace_metacharacters(pattern: str) -> str: ...
|
||||
def replace_named_groups(pattern: str) -> str: ...
|
||||
|
||||
@@ -3,6 +3,7 @@ from re import Pattern
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.auth.models import AbstractBaseUser, AnonymousUser
|
||||
from django.db.models import Model
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.options import Options
|
||||
from django.urls import _AnyURL
|
||||
@@ -17,7 +18,7 @@ class TemplateFilterIndexView(BaseAdminDocsView): ...
|
||||
class ViewIndexView(BaseAdminDocsView): ...
|
||||
class ViewDetailView(BaseAdminDocsView): ...
|
||||
|
||||
def user_has_model_view_permission(user: AbstractBaseUser | AnonymousUser, opts: Options) -> bool: ...
|
||||
def user_has_model_view_permission(user: AbstractBaseUser | AnonymousUser, opts: Options[Model]) -> bool: ...
|
||||
|
||||
class ModelIndexView(BaseAdminDocsView): ...
|
||||
class ModelDetailView(BaseAdminDocsView): ...
|
||||
@@ -27,5 +28,5 @@ def get_return_data_type(func_name: Any) -> str: ...
|
||||
def get_readable_field_data_type(field: Field[Any, Any] | str) -> str: ...
|
||||
def extract_views_from_urlpatterns(
|
||||
urlpatterns: Iterable[_AnyURL], base: str = ..., namespace: str | None = ...
|
||||
) -> list[tuple[Callable, Pattern[str], str | None, str | None]]: ...
|
||||
) -> list[tuple[Callable[..., Any], Pattern[str], str | None, str | None]]: ...
|
||||
def simplify_regex(pattern: str) -> str: ...
|
||||
|
||||
@@ -26,6 +26,6 @@ async def alogout(request: HttpRequest) -> None: ...
|
||||
def get_user_model() -> _UserModel: ...
|
||||
def get_user(request: HttpRequest | Client) -> _AnyUser: ...
|
||||
async def aget_user(request: HttpRequest | Client) -> _AnyUser: ...
|
||||
def get_permission_codename(action: str, opts: Options) -> str: ...
|
||||
def get_permission_codename(action: str, opts: Options[Any]) -> str: ...
|
||||
def update_session_auth_hash(request: HttpRequest, user: _User) -> None: ...
|
||||
async def aupdate_session_auth_hash(request: HttpRequest, user: _User) -> None: ...
|
||||
|
||||
@@ -12,8 +12,8 @@ from typing_extensions import override
|
||||
class GroupAdmin(admin.ModelAdmin[Group]):
|
||||
@override
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: ManyToManyField, request: HttpRequest | None = ..., **kwargs: Any
|
||||
) -> ModelMultipleChoiceField | None: ...
|
||||
self, db_field: ManyToManyField[Any, Any], request: HttpRequest | None = ..., **kwargs: Any
|
||||
) -> ModelMultipleChoiceField[Any] | None: ...
|
||||
|
||||
class UserAdmin(admin.ModelAdmin[_UserType]):
|
||||
change_user_password_template: Any
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import datetime as dt
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, ClassVar, Literal, overload
|
||||
|
||||
@@ -21,8 +22,8 @@ class AbstractBaseUser(models.Model):
|
||||
class Meta:
|
||||
abstract: ClassVar[bool]
|
||||
|
||||
password = models.CharField(max_length=128)
|
||||
last_login = models.DateTimeField(blank=True, null=True)
|
||||
password: models.CharField[str | int | Combinable, str]
|
||||
last_login: models.DateTimeField[str | dt.datetime | dt.date | Combinable | None, dt.datetime | None]
|
||||
is_active: bool | BooleanField[bool | Combinable, bool]
|
||||
backend: str # Set dynamically by authenticate(), used by login()
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_user_model(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_models_permissions(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_user_model(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_models_permissions(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -97,7 +97,7 @@ class AuthenticationForm(forms.Form):
|
||||
error_messages: _ErrorMessagesDict
|
||||
request: HttpRequest | None
|
||||
user_cache: _User | None
|
||||
username_field: models.Field
|
||||
username_field: models.Field[Any, Any]
|
||||
def __init__(self, request: HttpRequest | None = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def confirm_login_allowed(self, user: _User) -> None: ...
|
||||
def get_user(self) -> _User: ...
|
||||
@@ -130,14 +130,14 @@ class PasswordResetForm(forms.Form):
|
||||
extra_email_context: dict[str, str] | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class SetPasswordForm(SetPasswordMixin, forms.Form, Generic[_UserType]):
|
||||
class SetPasswordForm(SetPasswordMixin[_UserType], forms.Form, Generic[_UserType]):
|
||||
new_password1: forms.Field
|
||||
new_password2: forms.Field
|
||||
user: _UserType
|
||||
def __init__(self, user: _UserType, *args: Any, **kwargs: Any) -> None: ...
|
||||
def save(self, commit: bool = ...) -> _UserType: ...
|
||||
|
||||
class PasswordChangeForm(SetPasswordForm):
|
||||
class PasswordChangeForm(SetPasswordForm[_User]):
|
||||
old_password: forms.Field
|
||||
def clean_old_password(self) -> str: ...
|
||||
|
||||
@@ -154,5 +154,5 @@ class AdminPasswordChangeForm(forms.Form, Generic[_UserType]):
|
||||
@override
|
||||
def changed_data(self) -> list[str]: ...
|
||||
|
||||
class AdminUserCreationForm(SetUnusablePasswordMixin, UserCreationForm):
|
||||
class AdminUserCreationForm(SetUnusablePasswordMixin[_UserType], UserCreationForm[_UserType]):
|
||||
usable_password: forms.ChoiceField = ...
|
||||
|
||||
@@ -13,7 +13,7 @@ def check_password(
|
||||
password: str | None, encoded: str, setter: Callable[[str | None], Any] | None = ..., preferred: str = ...
|
||||
) -> bool: ...
|
||||
async def acheck_password(
|
||||
password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ...
|
||||
password: str | None, encoded: str, setter: Callable[..., Any] | None = ..., preferred: str = ...
|
||||
) -> bool: ...
|
||||
def make_password(password: str | None, salt: str | None = ..., hasher: str | BasePasswordHasher = ...) -> str: ...
|
||||
def get_hashers() -> list[BasePasswordHasher]: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Any, ClassVar, Literal
|
||||
|
||||
from django.contrib.auth.models import _AnyUser
|
||||
from django.http import HttpRequest, HttpResponseBase, HttpResponseRedirect
|
||||
from django.utils.deprecation import MiddlewareMixin, _AsyncGetResponseCallable, _GetResponseCallable
|
||||
from django.utils.deprecation import MiddlewareMixin, _AnyGetResponseCallable
|
||||
|
||||
def get_user(request: HttpRequest) -> _AnyUser: ...
|
||||
async def auser(request: HttpRequest) -> _AnyUser: ...
|
||||
@@ -32,9 +32,9 @@ class RemoteUserMiddleware:
|
||||
force_logout_if_no_header: ClassVar[bool]
|
||||
sync_capable: ClassVar[Literal[True]]
|
||||
async_capable: ClassVar[Literal[True]]
|
||||
get_response: _GetResponseCallable | _AsyncGetResponseCallable
|
||||
get_response: _AnyGetResponseCallable
|
||||
is_async: bool
|
||||
def __init__(self, get_response: _GetResponseCallable | _AsyncGetResponseCallable) -> None: ...
|
||||
def __init__(self, get_response: _AnyGetResponseCallable) -> None: ...
|
||||
def __call__(self, request: HttpRequest) -> HttpResponseBase | Awaitable[HttpResponseBase]: ...
|
||||
async def __acall__(self, request: HttpRequest) -> HttpResponseBase: ...
|
||||
def clean_username(self, username: str, request: HttpRequest) -> str: ...
|
||||
|
||||
@@ -26,5 +26,5 @@ class PermissionRequiredMixin(AccessMixin):
|
||||
|
||||
class UserPassesTestMixin(AccessMixin):
|
||||
def test_func(self) -> bool | None: ...
|
||||
def get_test_func(self) -> Callable: ...
|
||||
def get_test_func(self) -> Callable[..., Any]: ...
|
||||
def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import datetime as dt
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, ClassVar, Literal, TypeAlias
|
||||
|
||||
@@ -8,6 +9,7 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
from django.db.models import QuerySet
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.manager import EmptyManager
|
||||
from django.utils.functional import _StrOrPromise
|
||||
from typing_extensions import Never, Self, TypeVar
|
||||
@@ -36,9 +38,9 @@ class Permission(models.Model):
|
||||
content_type_id: int
|
||||
objects: ClassVar[PermissionManager]
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
codename = models.CharField(max_length=100)
|
||||
name: models.CharField[str | int | Combinable, str]
|
||||
content_type: models.ForeignKey[ContentType | Combinable, ContentType]
|
||||
codename: models.CharField[str | int | Combinable, str]
|
||||
def natural_key(self) -> tuple[str, str, str]: ...
|
||||
|
||||
class GroupManager(models.Manager[Group]):
|
||||
@@ -48,7 +50,7 @@ class GroupManager(models.Manager[Group]):
|
||||
class Group(models.Model):
|
||||
objects: ClassVar[GroupManager]
|
||||
|
||||
name = models.CharField(max_length=150)
|
||||
name: models.CharField[str | int | Combinable, str]
|
||||
permissions = models.ManyToManyField(Permission)
|
||||
def natural_key(self) -> tuple[str]: ...
|
||||
|
||||
@@ -75,7 +77,7 @@ class UserManager(BaseUserManager[_UserType]):
|
||||
) -> QuerySet[_UserType]: ...
|
||||
|
||||
class PermissionsMixin(models.Model):
|
||||
is_superuser = models.BooleanField()
|
||||
is_superuser: models.BooleanField[bool | Combinable, bool]
|
||||
groups = models.ManyToManyField(Group)
|
||||
user_permissions = models.ManyToManyField(Permission)
|
||||
|
||||
@@ -103,13 +105,13 @@ class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
||||
verbose_name: ClassVar[str]
|
||||
verbose_name_plural: ClassVar[str]
|
||||
|
||||
username = models.CharField(max_length=150)
|
||||
first_name = models.CharField(max_length=30, blank=True)
|
||||
last_name = models.CharField(max_length=150, blank=True)
|
||||
email = models.EmailField(blank=True)
|
||||
is_staff = models.BooleanField()
|
||||
is_active = models.BooleanField()
|
||||
date_joined = models.DateTimeField()
|
||||
username: models.CharField[str | int | Combinable, str]
|
||||
first_name: models.CharField[str | int | Combinable, str]
|
||||
last_name: models.CharField[str | int | Combinable, str]
|
||||
email: models.EmailField[str | Combinable, str]
|
||||
is_staff: models.BooleanField[bool | Combinable, bool]
|
||||
is_active: models.BooleanField[bool | Combinable, bool]
|
||||
date_joined: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime]
|
||||
|
||||
objects: ClassVar[UserManager[Self]]
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class LoginView(RedirectURLMixin, FormView[_AuthForm]):
|
||||
redirect_authenticated_user: bool
|
||||
extra_context: Mapping[str, Any] | None
|
||||
|
||||
class LogoutView(RedirectURLMixin, TemplateView):
|
||||
class LogoutView(RedirectURLMixin, TemplateView[HttpResponse]):
|
||||
next_page: str | None
|
||||
redirect_field_name: str
|
||||
extra_context: Mapping[str, Any] | None
|
||||
@@ -61,8 +61,8 @@ INTERNAL_RESET_SESSION_TOKEN: str
|
||||
class PasswordResetDoneView(PasswordContextMixin, TemplateView):
|
||||
title: _StrOrPromise
|
||||
|
||||
class PasswordResetConfirmView(PasswordContextMixin, FormView[SetPasswordForm]):
|
||||
form_class: type[SetPasswordForm]
|
||||
class PasswordResetConfirmView(PasswordContextMixin, FormView[SetPasswordForm[_User]]):
|
||||
form_class: type[SetPasswordForm[_User]]
|
||||
post_reset_login: bool
|
||||
post_reset_login_backend: str | None
|
||||
reset_url_token: str
|
||||
|
||||
@@ -9,10 +9,10 @@ class GenericInlineModelAdminChecks(InlineModelAdminChecks):
|
||||
def _check_exclude_of_parent_model(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ...
|
||||
def _check_relation(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ...
|
||||
|
||||
class GenericInlineModelAdmin(InlineModelAdmin):
|
||||
class GenericInlineModelAdmin(InlineModelAdmin[Any, Any]):
|
||||
ct_field: str
|
||||
ct_fk_field: str
|
||||
formset: type[BaseGenericInlineFormSet] # type: ignore[assignment]
|
||||
formset: type[BaseGenericInlineFormSet[Any, Any]] # type: ignore[assignment]
|
||||
|
||||
class GenericStackedInline(GenericInlineModelAdmin):
|
||||
template: str
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_generic_foreign_keys(
|
||||
app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: Any
|
||||
app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
def check_model_name_lengths(
|
||||
app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: Any
|
||||
app_configs: Sequence[AppConfig] | None, *, databases: Sequence[str] | None = ..., **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.db.models.sql.where import WhereNode
|
||||
from django.utils.functional import cached_property
|
||||
from typing_extensions import override
|
||||
|
||||
class GenericForeignKey(FieldCacheMixin, Field):
|
||||
class GenericForeignKey(FieldCacheMixin, Field[Any, Any]):
|
||||
# django-stubs implementation only fields
|
||||
_pyi_private_set_type: Any | Combinable
|
||||
_pyi_private_get_type: Any
|
||||
@@ -56,7 +56,7 @@ class GenericForeignKey(FieldCacheMixin, Field):
|
||||
model: type[Model] | None = None,
|
||||
) -> ContentType: ...
|
||||
def get_prefetch_querysets(
|
||||
self, instances: list[Model] | QuerySet, querysets: list[QuerySet] | None = None
|
||||
self, instances: list[Model] | QuerySet[Any], querysets: list[QuerySet[Any]] | None = None
|
||||
) -> tuple[list[Model], Callable[..., Any], Callable[..., Any], bool, str, bool]: ...
|
||||
@override
|
||||
def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> Any | None: ... # type: ignore[override]
|
||||
@@ -105,8 +105,8 @@ class GenericRelation(ForeignObject[Any, Any]):
|
||||
def get_content_type(self) -> ContentType: ...
|
||||
@override
|
||||
def get_extra_restriction(self, alias: str | None, remote_alias: str) -> WhereNode: ...
|
||||
def bulk_related_objects(self, objs: list[Model], using: str = "default") -> QuerySet: ...
|
||||
def bulk_related_objects(self, objs: list[Model], using: str = "default") -> QuerySet[Any]: ...
|
||||
|
||||
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ...
|
||||
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor[Any]): ...
|
||||
|
||||
def create_generic_related_manager(superclass: Any, rel: Any) -> type[Any]: ... # GenericRelatedObjectManager
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.forms.models import BaseModelFormSet, ModelForm
|
||||
from typing_extensions import TypeVar, override
|
||||
|
||||
_M = TypeVar("_M", bound=Model)
|
||||
_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm)
|
||||
_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm[Any], default=ModelForm[_M]) # ONLY use together with _M
|
||||
|
||||
class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]):
|
||||
instance: Any
|
||||
@@ -32,7 +32,7 @@ class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]):
|
||||
def generic_inlineformset_factory(
|
||||
model: type[_M],
|
||||
form: type[_ModelFormT] = ...,
|
||||
formset: Any = ...,
|
||||
formset: type[BaseGenericInlineFormSet[Any, Any]] = ...,
|
||||
ct_field: str = ...,
|
||||
fk_field: str = ...,
|
||||
fields: Any | None = ...,
|
||||
|
||||
@@ -2,6 +2,7 @@ from typing import Any, ClassVar
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
class ContentTypeManager(models.Manager[ContentType]):
|
||||
@@ -14,8 +15,8 @@ class ContentTypeManager(models.Manager[ContentType]):
|
||||
|
||||
class ContentType(models.Model):
|
||||
id: int
|
||||
app_label = models.CharField(max_length=100)
|
||||
model = models.CharField(max_length=100)
|
||||
app_label: models.CharField[str | int | Combinable, str]
|
||||
model: models.CharField[str | int | Combinable, str]
|
||||
objects: ClassVar[ContentTypeManager]
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@@ -23,5 +24,5 @@ class ContentType(models.Model):
|
||||
def app_labeled_name(self) -> str: ...
|
||||
def model_class(self) -> type[Model] | None: ...
|
||||
def get_object_for_this_type(self, using: str | None = None, **kwargs: Any) -> Model: ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet[Any]: ...
|
||||
def natural_key(self) -> tuple[str, str]: ...
|
||||
|
||||
@@ -16,7 +16,7 @@ _PrefetchedQuerySetsT = TypeVar(
|
||||
# This will be specialized to a `LiteralString` in the plugin for further processing and validation
|
||||
_ToAttrT = TypeVar("_ToAttrT", bound=str, covariant=True, default=str)
|
||||
|
||||
class GenericPrefetch(Prefetch, Generic[_LookupT, _PrefetchedQuerySetsT, _ToAttrT]):
|
||||
class GenericPrefetch(Prefetch[Any, Any, Any], Generic[_LookupT, _PrefetchedQuerySetsT, _ToAttrT]):
|
||||
def __init__(self, lookup: _LookupT, querysets: _PrefetchedQuerySetsT, to_attr: _ToAttrT | None = None) -> None: ...
|
||||
@override
|
||||
def __getstate__(self) -> dict[str, Any]: ...
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from django.contrib.sites.models import Site
|
||||
from django.db import models
|
||||
from django.db.models.expressions import Combinable
|
||||
|
||||
class FlatPage(models.Model):
|
||||
url: models.CharField
|
||||
title: models.CharField
|
||||
content: models.TextField
|
||||
enable_comments: models.BooleanField
|
||||
template_name: models.CharField
|
||||
registration_required: models.BooleanField
|
||||
sites: models.ManyToManyField[Site, Site]
|
||||
url: models.CharField[str | int | Combinable, str]
|
||||
title: models.CharField[str | int | Combinable, str]
|
||||
content: models.TextField[str | Combinable, str]
|
||||
enable_comments: models.BooleanField[bool | Combinable, bool]
|
||||
template_name: models.CharField[str | int | Combinable, str]
|
||||
registration_required: models.BooleanField[bool | Combinable, bool]
|
||||
sites = models.ManyToManyField(Site)
|
||||
def get_absolute_url(self) -> str: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
|
||||
class FlatPageSitemap(Sitemap): ...
|
||||
class FlatPageSitemap(Sitemap[FlatPage]): ...
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ class ST_Polygon(Func):
|
||||
def __init__(self, expr: Any) -> None: ...
|
||||
@cached_property
|
||||
@override
|
||||
def output_field(self) -> GeometryField: ...
|
||||
def output_field(self) -> GeometryField[Any, Any]: ...
|
||||
|
||||
class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
|
||||
name: str
|
||||
|
||||
@@ -22,9 +22,9 @@ from django.utils.functional import _StrOrPromise
|
||||
from typing_extensions import TypeVar, override
|
||||
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST")
|
||||
_ST = TypeVar("_ST", contravariant=True)
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT")
|
||||
_GT = TypeVar("_GT", covariant=True)
|
||||
|
||||
class SRIDCacheEntry(NamedTuple):
|
||||
units: Any
|
||||
@@ -204,7 +204,7 @@ class ExtentField(Field[Any, Any]):
|
||||
@override
|
||||
def get_internal_type(self) -> str: ...
|
||||
|
||||
class RasterField(BaseSpatialField):
|
||||
class RasterField(BaseSpatialField[_ST, _GT]):
|
||||
@override
|
||||
def db_type(self, connection: Any) -> Any: ...
|
||||
def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ...
|
||||
|
||||
+50
-34
@@ -20,18 +20,26 @@ class GeoFuncMixin:
|
||||
def name(self) -> str: ...
|
||||
@cached_property
|
||||
def geo_field(self) -> Any: ...
|
||||
# `as_sql` drops `template`/`arg_joiner` from `Func.as_sql`, matching runtime.
|
||||
def as_sql(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: BaseDatabaseWrapper,
|
||||
function: str | None = None,
|
||||
**extra_context: Any,
|
||||
) -> _AsSqlType: ...
|
||||
def resolve_expression(
|
||||
self,
|
||||
*args: Any,
|
||||
**kwargs: Any,
|
||||
) -> Any: ...
|
||||
|
||||
class GeoFunc(GeoFuncMixin, Func): ...
|
||||
class GeoFunc(GeoFuncMixin, Func): ... # type: ignore[misc]
|
||||
|
||||
class GeomOutputGeoFunc(GeoFunc):
|
||||
@cached_property
|
||||
@override
|
||||
def output_field(self) -> GeometryField: ...
|
||||
def output_field(self) -> GeometryField[Any, Any]: ...
|
||||
|
||||
class SQLiteDecimalToFloatMixin:
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
@@ -44,17 +52,21 @@ class Area(OracleToleranceMixin, GeoFunc):
|
||||
arity: int
|
||||
@cached_property
|
||||
@override
|
||||
def output_field(self) -> AreaField: ...
|
||||
def output_field(self) -> AreaField[Any, Any]: ...
|
||||
@override
|
||||
def as_sql( # type: ignore[override]
|
||||
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any
|
||||
) -> _AsSqlType: ...
|
||||
@override
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class Azimuth(GeoFunc):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
class AsGeoJSON(GeoFunc):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(
|
||||
self, expression: Any, bbox: bool = False, crs: bool = False, precision: int = 8, **extra: Any
|
||||
) -> None: ...
|
||||
@@ -62,48 +74,48 @@ class AsGeoJSON(GeoFunc):
|
||||
|
||||
class AsGML(GeoFunc):
|
||||
geom_param_pos: Any
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(self, expression: Any, version: int = 2, precision: int = 8, **extra: Any) -> None: ...
|
||||
def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class AsKML(GeoFunc):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(self, expression: Any, precision: int = 8, **extra: Any) -> None: ...
|
||||
|
||||
class AsSVG(GeoFunc):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(self, expression: Any, relative: bool = False, precision: int = 8, **extra: Any) -> None: ...
|
||||
|
||||
class AsWKB(GeoFunc):
|
||||
output_field: ClassVar[BinaryField]
|
||||
output_field: ClassVar[BinaryField[Any, Any]]
|
||||
arity: int
|
||||
|
||||
class AsWKT(GeoFunc):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
arity: int
|
||||
|
||||
class BoundingCircle(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class BoundingCircle(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
def __init__(self, expression: Any, num_seg: int = 48, **extra: Any) -> None: ...
|
||||
@override
|
||||
def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class Centroid(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
|
||||
class ClosestPoint(GeomOutputGeoFunc):
|
||||
arity: int
|
||||
geom_param_pos: tuple[int, int]
|
||||
|
||||
class Difference(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class Difference(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
class DistanceResultMixin:
|
||||
@cached_property
|
||||
def output_field(self) -> DistanceField: ...
|
||||
def output_field(self) -> DistanceField[Any, Any]: ...
|
||||
def source_is_geography(self) -> Any: ...
|
||||
|
||||
class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
|
||||
class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): # type: ignore[misc]
|
||||
geom_param_pos: Any
|
||||
spheroid: Any
|
||||
def __init__(self, expr1: Any, expr2: Any, spheroid: Any | None = None, **extra: Any) -> None: ...
|
||||
@@ -127,39 +139,43 @@ class FromWKB(GeoFunc):
|
||||
class FromWKT(FromWKB): ...
|
||||
|
||||
class GeoHash(GeoFunc):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(self, expression: Any, precision: Any | None = None, **extra: Any) -> None: ...
|
||||
def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class GeometryDistance(GeoFunc):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
arity: int
|
||||
function: str
|
||||
arg_joiner: str
|
||||
geom_param_pos: Any
|
||||
|
||||
class Intersection(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
class GeometryType(GeoFuncMixin, StandardTransform):
|
||||
class GeometryType(GeoFuncMixin, StandardTransform): # type: ignore[misc]
|
||||
lookup_name: str
|
||||
output_field: ClassVar[CharField]
|
||||
output_field: ClassVar[CharField[Any, Any]]
|
||||
def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class IsEmpty(GeoFuncMixin, StandardTransform):
|
||||
class IsEmpty(GeoFuncMixin, StandardTransform): # type: ignore[misc]
|
||||
lookup_name: str
|
||||
output_field: ClassVar[BooleanField]
|
||||
output_field: ClassVar[BooleanField[Any, Any]]
|
||||
|
||||
class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform):
|
||||
class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform): # type: ignore[misc]
|
||||
lookup_name: str
|
||||
output_field: ClassVar[BooleanField]
|
||||
output_field: ClassVar[BooleanField[Any, Any]]
|
||||
@override
|
||||
def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
|
||||
spheroid: Any
|
||||
def __init__(self, expr1: Any, spheroid: bool = True, **extra: Any) -> None: ...
|
||||
@override
|
||||
def as_sql( # type: ignore[override]
|
||||
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any
|
||||
) -> _AsSqlType: ...
|
||||
def as_postgresql(
|
||||
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any
|
||||
) -> _AsSqlType: ...
|
||||
@@ -167,25 +183,25 @@ class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class LineLocatePoint(GeoFunc):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
class MakeValid(GeomOutputGeoFunc): ...
|
||||
|
||||
class MemSize(GeoFunc):
|
||||
output_field: ClassVar[IntegerField]
|
||||
output_field: ClassVar[IntegerField[Any, Any]]
|
||||
arity: int
|
||||
|
||||
class NumGeometries(GeoFunc):
|
||||
output_field: ClassVar[IntegerField]
|
||||
output_field: ClassVar[IntegerField[Any, Any]]
|
||||
arity: int
|
||||
|
||||
class NumPoints(GeoFunc):
|
||||
output_field: ClassVar[IntegerField]
|
||||
output_field: ClassVar[IntegerField[Any, Any]]
|
||||
arity: int
|
||||
|
||||
class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
|
||||
class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
def as_postgresql(
|
||||
self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any
|
||||
@@ -193,7 +209,7 @@ class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
|
||||
@override
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
|
||||
class Reverse(GeoFunc):
|
||||
@@ -202,13 +218,13 @@ class Reverse(GeoFunc):
|
||||
class Rotate(GeomOutputGeoFunc):
|
||||
def __init__(self, expression: Any, angle: Any, origin: Any | None = None, **extra: Any) -> None: ...
|
||||
|
||||
class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc):
|
||||
class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
def __init__(self, expression: Any, x: Any, y: Any, z: float = 0.0, **extra: Any) -> None: ...
|
||||
|
||||
class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc):
|
||||
class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
def __init__(self, expression: Any, *args: Any, **extra: Any) -> None: ...
|
||||
|
||||
class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
@@ -219,6 +235,6 @@ class Translate(Scale):
|
||||
@override
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ...
|
||||
|
||||
class Union(OracleToleranceMixin, GeomOutputGeoFunc):
|
||||
class Union(OracleToleranceMixin, GeomOutputGeoFunc): # type: ignore[misc]
|
||||
arity: int
|
||||
geom_param_pos: Any
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.models import Lookup, Transform
|
||||
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType
|
||||
from typing_extensions import override
|
||||
|
||||
class RasterBandTransform(Transform): ...
|
||||
class RasterBandTransform(Transform):
|
||||
@override
|
||||
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override]
|
||||
|
||||
class GISLookup(Lookup):
|
||||
sql_template: Any
|
||||
@@ -87,7 +92,7 @@ class OverlapsLookup(GISLookup):
|
||||
class RelateLookup(GISLookup):
|
||||
lookup_name: str
|
||||
sql_template: str
|
||||
pattern_regex: Any
|
||||
pattern_regex: Pattern[str]
|
||||
@override
|
||||
def process_rhs(self, compiler: Any, connection: Any) -> Any: ...
|
||||
|
||||
|
||||
+8
-3
@@ -1,9 +1,14 @@
|
||||
from typing import Any
|
||||
|
||||
from django.db import models
|
||||
from typing_extensions import override
|
||||
from typing_extensions import TypeVar, override
|
||||
|
||||
class AreaField(models.FloatField):
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST", contravariant=True)
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT", covariant=True)
|
||||
|
||||
class AreaField(models.FloatField[_ST, _GT]):
|
||||
geo_field: Any
|
||||
def __init__(self, geo_field: Any) -> None: ...
|
||||
@override
|
||||
@@ -14,7 +19,7 @@ class AreaField(models.FloatField):
|
||||
@override
|
||||
def get_internal_type(self) -> Any: ...
|
||||
|
||||
class DistanceField(models.FloatField):
|
||||
class DistanceField(models.FloatField[_ST, _GT]):
|
||||
geo_field: Any
|
||||
def __init__(self, geo_field: Any) -> None: ...
|
||||
@override
|
||||
|
||||
@@ -21,4 +21,4 @@ class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin):
|
||||
@override
|
||||
def rss_attributes(self) -> dict[str, str]: ...
|
||||
|
||||
class Feed(BaseFeed): ...
|
||||
class Feed(BaseFeed[Any, Any]): ...
|
||||
|
||||
@@ -24,7 +24,7 @@ class TransformPoint(list[Sequence[float]]):
|
||||
|
||||
class GDALRaster(GDALRasterBase):
|
||||
destructor: Any
|
||||
def __init__(self, ds_input: str | Path | bytes | dict | c_void_p, write: bool = ...) -> None: ...
|
||||
def __init__(self, ds_input: str | Path | bytes | dict[str, Any] | c_void_p, write: bool = ...) -> None: ...
|
||||
@override
|
||||
def __del__(self) -> None: ...
|
||||
@property
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Any
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
from typing_extensions import override
|
||||
|
||||
class KMLSitemap(Sitemap):
|
||||
class KMLSitemap(Sitemap[Any]):
|
||||
geo_format: str
|
||||
locations: Any
|
||||
def __init__(self, locations: Any | None = ...) -> None: ...
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@ from .mixins import OrderableAggMixin
|
||||
class ArrayAgg(OrderableAggMixin, Aggregate):
|
||||
@property
|
||||
@override
|
||||
def output_field(self) -> ArrayField: ...
|
||||
def output_field(self) -> ArrayField[Any, Any]: ...
|
||||
@override
|
||||
def resolve_expression(
|
||||
self,
|
||||
@@ -33,13 +33,13 @@ class BitOr(Aggregate): ...
|
||||
class BitXor(Aggregate): ...
|
||||
|
||||
class BoolAnd(Aggregate):
|
||||
output_field: ClassVar[BooleanField]
|
||||
output_field: ClassVar[BooleanField[Any, Any]]
|
||||
|
||||
class BoolOr(Aggregate):
|
||||
output_field: ClassVar[BooleanField]
|
||||
output_field: ClassVar[BooleanField[Any, Any]]
|
||||
|
||||
class JSONBAgg(OrderableAggMixin, Aggregate):
|
||||
output_field: ClassVar[JSONField]
|
||||
output_field: ClassVar[JSONField[Any, Any]]
|
||||
@override
|
||||
def resolve_expression(
|
||||
self,
|
||||
@@ -53,7 +53,7 @@ class JSONBAgg(OrderableAggMixin, Aggregate):
|
||||
def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override]
|
||||
|
||||
class StringAgg(OrderableAggMixin, Aggregate):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(
|
||||
self,
|
||||
expression: BaseExpression | Combinable | str,
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ from typing import Any, ClassVar
|
||||
from django.db.models import Aggregate, FloatField, IntegerField
|
||||
|
||||
class StatAggregate(Aggregate):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
def __init__(
|
||||
self, y: Any, x: Any, output_field: Any | None = ..., filter: Any | None = ..., default: Any | None = ...
|
||||
) -> None: ...
|
||||
@@ -19,7 +19,7 @@ class RegrAvgX(StatAggregate): ...
|
||||
class RegrAvgY(StatAggregate): ...
|
||||
|
||||
class RegrCount(StatAggregate):
|
||||
output_field: ClassVar[IntegerField] # type: ignore[assignment]
|
||||
output_field: ClassVar[IntegerField[Any, Any]] # type: ignore[assignment]
|
||||
|
||||
class RegrIntercept(StatAggregate): ...
|
||||
class RegrR2(StatAggregate): ...
|
||||
|
||||
@@ -13,4 +13,4 @@ class ArraySubquery(Subquery):
|
||||
def __init__(self, queryset: Query | QuerySet[Any] | Subquery, **kwargs: Any) -> None: ...
|
||||
@cached_property
|
||||
@override
|
||||
def output_field(self) -> ArrayField: ...
|
||||
def output_field(self) -> ArrayField[Any, Any]: ...
|
||||
|
||||
@@ -16,9 +16,9 @@ from django.utils.functional import _StrOrPromise
|
||||
from typing_extensions import TypeVar, override
|
||||
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST")
|
||||
_ST = TypeVar("_ST", contravariant=True)
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT")
|
||||
_GT = TypeVar("_GT", covariant=True)
|
||||
|
||||
class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST, _GT]):
|
||||
_pyi_private_set_type: Sequence[Any] | Combinable
|
||||
@@ -26,13 +26,13 @@ class ArrayField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[_ST,
|
||||
|
||||
empty_strings_allowed: bool
|
||||
default_error_messages: ClassVar[_ErrorMessagesDict]
|
||||
base_field: Field
|
||||
base_field: Field[Any, Any]
|
||||
size: int | None
|
||||
default_validators: list[_ValidatorCallable]
|
||||
from_db_value: Any
|
||||
def __init__(
|
||||
self,
|
||||
base_field: Field,
|
||||
base_field: Field[Any, Any],
|
||||
size: int | None = None,
|
||||
*,
|
||||
verbose_name: _StrOrPromise | None = ...,
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
from django.db.models.fields import CharField, EmailField, TextField
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
class CICharField(CharField): ...
|
||||
class CIEmailField(EmailField): ...
|
||||
class CITextField(TextField): ...
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST", contravariant=True)
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT", covariant=True)
|
||||
|
||||
class CICharField(CharField[_ST, _GT]): ...
|
||||
class CIEmailField(EmailField[_ST, _GT]): ...
|
||||
class CITextField(TextField[_ST, _GT]): ...
|
||||
|
||||
__all__ = ["CICharField", "CIEmailField", "CITextField"]
|
||||
|
||||
@@ -13,7 +13,7 @@ class HStoreField(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field[Any
|
||||
def get_transform(self, name: str) -> Any: ...
|
||||
|
||||
class KeyTransform(Transform):
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
|
||||
def __init__(self, key_name: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
@override
|
||||
@@ -24,9 +24,9 @@ class KeyTransformFactory:
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> KeyTransform: ...
|
||||
|
||||
class KeysTransform(Transform):
|
||||
output_field: ClassVar[ArrayField]
|
||||
output_field: ClassVar[ArrayField[Any, Any]]
|
||||
|
||||
class ValuesTransform(Transform):
|
||||
output_field: ClassVar[ArrayField]
|
||||
output_field: ClassVar[ArrayField[Any, Any]]
|
||||
|
||||
__all__ = ["HStoreField"]
|
||||
|
||||
+13
-13
@@ -31,7 +31,7 @@ _RangeT = TypeVar("_RangeT", bound=Range[Any])
|
||||
|
||||
class RangeField(CheckPostgresInstalledMixin, models.Field[Any, _RangeT]):
|
||||
empty_strings_allowed: bool
|
||||
base_field: type[models.Field]
|
||||
base_field: type[models.Field[Any, Any]]
|
||||
range_type: type[_RangeT]
|
||||
def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ...
|
||||
@override
|
||||
@@ -46,23 +46,23 @@ class ContinuousRangeField(RangeField[_RangeT]):
|
||||
def __init__(self, *args: Any, default_bounds: str = "[)", **kwargs: Any) -> None: ...
|
||||
|
||||
class IntegerRangeField(RangeField[NumericRange]):
|
||||
base_field: type[models.IntegerField]
|
||||
base_field: type[models.IntegerField[Any, Any]]
|
||||
form_field: type[forms.IntegerRangeField]
|
||||
|
||||
class BigIntegerRangeField(RangeField[NumericRange]):
|
||||
base_field: type[models.BigIntegerField]
|
||||
base_field: type[models.BigIntegerField[Any, Any]]
|
||||
form_field: type[forms.IntegerRangeField]
|
||||
|
||||
class DecimalRangeField(ContinuousRangeField[NumericRange]):
|
||||
base_field: type[models.DecimalField]
|
||||
base_field: type[models.DecimalField[Any, Any]]
|
||||
form_field: type[forms.DecimalRangeField]
|
||||
|
||||
class DateTimeRangeField(ContinuousRangeField[DateTimeTZRange]):
|
||||
base_field: type[models.DateTimeField]
|
||||
base_field: type[models.DateTimeField[Any, Any]]
|
||||
form_field: type[forms.DateTimeRangeField]
|
||||
|
||||
class DateRangeField(RangeField[DateRange]):
|
||||
base_field: type[models.DateField]
|
||||
base_field: type[models.DateField[Any, Any]]
|
||||
form_field: type[forms.DateRangeField]
|
||||
|
||||
class DateTimeRangeContains(PostgresOperatorLookup): ...
|
||||
@@ -81,27 +81,27 @@ class AdjacentToLookup(PostgresOperatorLookup): ...
|
||||
class RangeStartsWith(models.Transform):
|
||||
@property
|
||||
@override
|
||||
def output_field(self) -> models.Field: ...
|
||||
def output_field(self) -> models.Field[Any, Any]: ...
|
||||
|
||||
class RangeEndsWith(models.Transform):
|
||||
@property
|
||||
@override
|
||||
def output_field(self) -> models.Field: ...
|
||||
def output_field(self) -> models.Field[Any, Any]: ...
|
||||
|
||||
class IsEmpty(models.Transform):
|
||||
output_field: ClassVar[models.BooleanField]
|
||||
output_field: ClassVar[models.BooleanField[Any, Any]]
|
||||
|
||||
class LowerInclusive(models.Transform):
|
||||
output_field: ClassVar[models.BooleanField]
|
||||
output_field: ClassVar[models.BooleanField[Any, Any]]
|
||||
|
||||
class LowerInfinite(models.Transform):
|
||||
output_field: ClassVar[models.BooleanField]
|
||||
output_field: ClassVar[models.BooleanField[Any, Any]]
|
||||
|
||||
class UpperInclusive(models.Transform):
|
||||
output_field: ClassVar[models.BooleanField]
|
||||
output_field: ClassVar[models.BooleanField[Any, Any]]
|
||||
|
||||
class UpperInfinite(models.Transform):
|
||||
output_field: ClassVar[models.BooleanField]
|
||||
output_field: ClassVar[models.BooleanField[Any, Any]]
|
||||
|
||||
__all__ = [
|
||||
"BigIntegerRangeField",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from typing import ClassVar
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from django.db.models import DateTimeField, Func, UUIDField
|
||||
|
||||
class RandomUUID(Func):
|
||||
output_field: ClassVar[UUIDField]
|
||||
output_field: ClassVar[UUIDField[Any, Any]]
|
||||
|
||||
class TransactionNow(Func):
|
||||
output_field: ClassVar[DateTimeField]
|
||||
output_field: ClassVar[DateTimeField[Any, Any]]
|
||||
|
||||
@@ -7,12 +7,17 @@ from django.db.models.expressions import Combinable, CombinedExpression, Func, V
|
||||
from django.db.models.lookups import Lookup
|
||||
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType
|
||||
from psycopg.adapt import Dumper
|
||||
from typing_extensions import Self, override
|
||||
from typing_extensions import Self, TypeVar, override
|
||||
|
||||
from .utils import CheckPostgresInstalledMixin
|
||||
|
||||
_Expression: TypeAlias = str | Combinable | SearchQueryCombinable
|
||||
|
||||
# __set__ value type
|
||||
_ST = TypeVar("_ST", contravariant=True)
|
||||
# __get__ return type
|
||||
_GT = TypeVar("_GT", covariant=True)
|
||||
|
||||
class UTF8Dumper(Dumper):
|
||||
@override
|
||||
def dump(self, obj: object) -> bytes: ...
|
||||
@@ -31,8 +36,8 @@ class SearchVectorExact(Lookup):
|
||||
@override
|
||||
def as_sql(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ...
|
||||
|
||||
class SearchVectorField(CheckPostgresInstalledMixin, Field[Any, Any]): ...
|
||||
class SearchQueryField(CheckPostgresInstalledMixin, Field[Any, Any]): ...
|
||||
class SearchVectorField(CheckPostgresInstalledMixin, Field[_ST, _GT]): ...
|
||||
class SearchQueryField(CheckPostgresInstalledMixin, Field[_ST, _GT]): ...
|
||||
|
||||
class SearchConfig(Expression):
|
||||
config: _Expression | None
|
||||
@@ -47,7 +52,7 @@ class SearchVector(SearchVectorCombinable, Func):
|
||||
config: _Expression | None
|
||||
function: str
|
||||
arg_joiner: str
|
||||
output_field: ClassVar[SearchVectorField]
|
||||
output_field: ClassVar[SearchVectorField[Any, Any]]
|
||||
def __init__(
|
||||
self, *expressions: _Expression, config: _Expression | None = None, weight: Any | None = None
|
||||
) -> None: ...
|
||||
@@ -79,7 +84,7 @@ class SearchQueryCombinable:
|
||||
def __rand__(self, other: SearchQueryCombinable) -> Self: ...
|
||||
|
||||
class SearchQuery(SearchQueryCombinable, Func): # type: ignore[misc]
|
||||
output_field: ClassVar[SearchQueryField]
|
||||
output_field: ClassVar[SearchQueryField[Any, Any]]
|
||||
SEARCH_TYPES: dict[str, str]
|
||||
def __init__(
|
||||
self,
|
||||
@@ -112,7 +117,7 @@ class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: i
|
||||
) -> None: ...
|
||||
|
||||
class SearchRank(Func):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
def __init__(
|
||||
self,
|
||||
vector: SearchVector | _Expression,
|
||||
@@ -125,7 +130,7 @@ class SearchRank(Func):
|
||||
class SearchHeadline(Func):
|
||||
function: str
|
||||
template: str
|
||||
output_field: ClassVar[TextField]
|
||||
output_field: ClassVar[TextField[Any, Any]]
|
||||
def __init__(
|
||||
self,
|
||||
expression: _Expression,
|
||||
@@ -151,11 +156,11 @@ class SearchHeadline(Func):
|
||||
) -> _AsSqlType: ...
|
||||
|
||||
class TrigramBase(Func):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
def __init__(self, expression: _Expression, string: str, **extra: Any) -> None: ...
|
||||
|
||||
class TrigramWordBase(Func):
|
||||
output_field: ClassVar[FloatField]
|
||||
output_field: ClassVar[FloatField[Any, Any]]
|
||||
def __init__(self, string: str, expression: _Expression, **extra: Any) -> None: ...
|
||||
|
||||
class TrigramSimilarity(TrigramBase): ...
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.redirects.models import Redirect
|
||||
|
||||
class RedirectAdmin(admin.ModelAdmin):
|
||||
class RedirectAdmin(admin.ModelAdmin[Redirect]):
|
||||
list_display: Any
|
||||
list_filter: ClassVar[Any]
|
||||
search_fields: ClassVar[Any]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from django.contrib.sites.models import Site
|
||||
from django.db import models
|
||||
from django.db.models.expressions import Combinable
|
||||
|
||||
class Redirect(models.Model):
|
||||
site: models.ForeignKey
|
||||
old_path: models.CharField
|
||||
new_path: models.CharField
|
||||
site: models.ForeignKey[Site | Combinable, Site]
|
||||
old_path: models.CharField[str | int | Combinable, str]
|
||||
new_path: models.CharField[str | int | Combinable, str]
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
from datetime import datetime
|
||||
import datetime as dt
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from django.contrib.sessions.backends.base import SessionBase
|
||||
from django.db import models
|
||||
from django.db.models.expressions import Combinable
|
||||
from typing_extensions import Self, TypeVar
|
||||
|
||||
_T = TypeVar("_T", bound=AbstractBaseSession)
|
||||
|
||||
class BaseSessionManager(models.Manager[_T]):
|
||||
def encode(self, session_dict: dict[str, Any]) -> str: ...
|
||||
def save(self, session_key: str, session_dict: dict[str, Any], expire_date: datetime) -> _T: ...
|
||||
def save(self, session_key: str, session_dict: dict[str, Any], expire_date: dt.datetime) -> _T: ...
|
||||
|
||||
class AbstractBaseSession(models.Model):
|
||||
session_key = models.CharField(primary_key=True)
|
||||
session_data = models.TextField()
|
||||
expire_date = models.DateTimeField()
|
||||
session_key: models.CharField[str | int | Combinable, str]
|
||||
session_data: models.TextField[str | Combinable, str]
|
||||
expire_date: models.DateTimeField[str | dt.datetime | dt.date | Combinable, dt.datetime]
|
||||
objects: ClassVar[BaseSessionManager[Self]]
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -21,7 +21,7 @@ class Sitemap(Generic[_ItemT]):
|
||||
def items(self) -> Iterable[_ItemT]: ...
|
||||
def location(self, item: _ItemT) -> str: ...
|
||||
@property
|
||||
def paginator(self) -> Paginator: ...
|
||||
def paginator(self) -> Paginator[_ItemT]: ...
|
||||
def get_languages_for_item(self, item: _ItemT) -> list[str]: ...
|
||||
def get_protocol(self, protocol: str | None = None) -> str: ...
|
||||
def get_domain(self, site: Site | RequestSite | None = None) -> str: ...
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
from django.http.request import HttpRequest
|
||||
from django.template.response import TemplateResponse
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
_C = TypeVar("_C", bound=Callable)
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
@dataclass
|
||||
class SitemapIndexItem:
|
||||
@@ -16,14 +17,14 @@ class SitemapIndexItem:
|
||||
def x_robots_tag(func: _C) -> _C: ...
|
||||
def index(
|
||||
request: HttpRequest,
|
||||
sitemaps: dict[str, type[Sitemap] | Sitemap],
|
||||
sitemaps: dict[str, type[Sitemap[Any]] | Sitemap[Any]],
|
||||
template_name: str = ...,
|
||||
content_type: str = ...,
|
||||
sitemap_url_name: str = ...,
|
||||
) -> TemplateResponse: ...
|
||||
def sitemap(
|
||||
request: HttpRequest,
|
||||
sitemaps: dict[str, type[Sitemap] | Sitemap],
|
||||
sitemaps: dict[str, type[Sitemap[Any]] | Sitemap[Any]],
|
||||
section: str | None = ...,
|
||||
template_name: str = ...,
|
||||
content_type: str = ...,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
class SiteAdmin(admin.ModelAdmin):
|
||||
class SiteAdmin(admin.ModelAdmin[Site]):
|
||||
list_display: Any
|
||||
search_fields: ClassVar[Any]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_site_id(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_site_id(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.expressions import Combinable
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
SITE_CACHE: Any
|
||||
@@ -13,8 +14,8 @@ class SiteManager(models.Manager[Site]):
|
||||
class Site(models.Model):
|
||||
objects: ClassVar[SiteManager]
|
||||
|
||||
domain = models.CharField(max_length=100)
|
||||
name = models.CharField(max_length=50)
|
||||
domain: models.CharField[str | int | Combinable, str]
|
||||
name: models.CharField[str | int | Combinable, str]
|
||||
def natural_key(self) -> tuple[str]: ...
|
||||
|
||||
def clear_site_cache(sender: type[Site], **kwargs: Any) -> None: ...
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
|
||||
E005: Error
|
||||
|
||||
def check_finders(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_storages(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_finders(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_storages(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -2,9 +2,9 @@ from collections.abc import Callable, Iterator
|
||||
from re import Match
|
||||
from typing import Any, TypeAlias
|
||||
|
||||
from _typeshed import StrPath
|
||||
from django.core.files.base import File
|
||||
from django.core.files.storage import FileSystemStorage, Storage
|
||||
from django.utils._os import _PathCompatible
|
||||
from django.utils.functional import LazyObject
|
||||
from typing_extensions import override
|
||||
|
||||
@@ -12,10 +12,10 @@ _PostProcessT: TypeAlias = Iterator[tuple[str, str, bool] | tuple[str, None, Run
|
||||
|
||||
class StaticFilesStorage(FileSystemStorage):
|
||||
def __init__(
|
||||
self, location: _PathCompatible | None = None, base_url: str | None = None, *args: Any, **kwargs: Any
|
||||
self, location: StrPath | None = None, base_url: str | None = None, *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
@override
|
||||
def path(self, name: _PathCompatible) -> str: ...
|
||||
def path(self, name: StrPath) -> str: ...
|
||||
|
||||
class HashedFilesMixin:
|
||||
default_template: str
|
||||
@@ -25,12 +25,12 @@ class HashedFilesMixin:
|
||||
hashed_files: Any
|
||||
keep_intermediate_files: bool
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def file_hash(self, name: str, content: File | None = None) -> str | None: ...
|
||||
def hashed_name(self, name: str, content: File | None = None, filename: str | None = None) -> str: ...
|
||||
def file_hash(self, name: str, content: File[Any] | None = None) -> str | None: ...
|
||||
def hashed_name(self, name: str, content: File[Any] | None = None, filename: str | None = None) -> str: ...
|
||||
def url(self, name: str, force: bool = False) -> str: ...
|
||||
def url_converter(
|
||||
self, name: str, hashed_files: dict[str, Any], template: str | None = None
|
||||
) -> Callable[[Match], str]: ...
|
||||
) -> Callable[[Match[str]], str]: ...
|
||||
def post_process(self, paths: dict[str, Any], dry_run: bool = False, **options: Any) -> _PostProcessT: ...
|
||||
def clean_name(self, name: str) -> str: ...
|
||||
def hash_key(self, name: str) -> str: ...
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ DEFAULT_TIMEOUT: Any
|
||||
MEMCACHE_MAX_KEY_LENGTH: int
|
||||
|
||||
def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ...
|
||||
def get_key_func(key_func: Callable | str | None) -> Callable: ...
|
||||
def get_key_func(key_func: Callable[..., Any] | str | None) -> Callable[..., Any]: ...
|
||||
|
||||
class BaseCache:
|
||||
_missing_key: object
|
||||
@@ -21,7 +21,7 @@ class BaseCache:
|
||||
_cull_frequency: int
|
||||
key_prefix: str
|
||||
version: int
|
||||
key_func: Callable
|
||||
key_func: Callable[..., Any]
|
||||
def __init__(self, params: dict[str, Any]) -> None: ...
|
||||
def get_backend_timeout(self, timeout: float | None = ...) -> float | None: ...
|
||||
def make_key(self, key: Any, version: int | None = None) -> str: ...
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class RedisCacheClient:
|
||||
parser_class: str | type[BaseParser] | None = None,
|
||||
**options: Any,
|
||||
) -> None: ...
|
||||
def get_client(self, key: _Key | None = None, *, write: bool = False) -> Redis: ...
|
||||
def get_client(self, key: _Key | None = None, *, write: bool = False) -> Redis[Any]: ...
|
||||
def add(self, key: _Key, value: Any, timeout: _Expiry | None) -> bool: ...
|
||||
def get(self, key: _Key, default: Any) -> Any: ...
|
||||
def set(self, key: _Key, value: Any, timeout: _Expiry | None) -> None: ...
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
|
||||
E001: Error
|
||||
|
||||
def check_async_unsafe(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_async_unsafe(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error, Warning
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
|
||||
E001: Error
|
||||
|
||||
def check_default_cache_is_configured(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_cache_location_not_exposed(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_file_based_cache_is_absolute(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_default_cache_is_configured(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
def check_cache_location_not_exposed(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
def check_file_based_cache_is_absolute(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Any
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
from django.core.checks.messages import Error
|
||||
|
||||
def migrate_and_makemigrations_autodetector(**kwargs: Any) -> list[Error]: ...
|
||||
def migrate_and_makemigrations_autodetector(**kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_csrf_trusted_origins(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_csrf_trusted_origins(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from django.core.checks import CheckMessage
|
||||
|
||||
def check_database_backends(databases: Iterable[str] | None = None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_database_backends(databases: Iterable[str] | None = None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_setting_file_upload_temp_dir(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_setting_file_upload_temp_dir(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_all_models(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_lazy_references(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_all_models(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_lazy_references(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -40,8 +40,8 @@ class _ProcessedCheckCallable(Protocol[_C]):
|
||||
__call__: _C
|
||||
|
||||
class CheckRegistry:
|
||||
registered_checks: set[_ProcessedCheckCallable]
|
||||
deployment_checks: set[_ProcessedCheckCallable]
|
||||
registered_checks: set[_ProcessedCheckCallable[_CheckCallable]]
|
||||
deployment_checks: set[_ProcessedCheckCallable[_CheckCallable]]
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def register(self, check: _C, *tags: str, **kwargs: Any) -> _ProcessedCheckCallable[_C]: ...
|
||||
@@ -58,7 +58,7 @@ class CheckRegistry:
|
||||
) -> list[CheckMessage]: ...
|
||||
def tag_exists(self, tag: str, include_deployment_checks: bool = False) -> bool: ...
|
||||
def tags_available(self, deployment_checks: bool = False) -> set[str]: ...
|
||||
def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable]: ...
|
||||
def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable[_CheckCallable]]: ...
|
||||
|
||||
registry: CheckRegistry = ...
|
||||
register = registry.register
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error, Warning
|
||||
from django.core.checks.messages import CheckMessage, Error, Warning
|
||||
|
||||
CROSS_ORIGIN_OPENER_POLICY_VALUES: set[str]
|
||||
REFERRER_POLICY_VALUES: set[str]
|
||||
@@ -27,18 +26,22 @@ E024: Error
|
||||
W025: Warning
|
||||
E026: Error
|
||||
|
||||
def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_xframe_options_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_sts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_sts_include_subdomains(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_sts_preload(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_content_type_nosniff(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_ssl_redirect(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_secret_key(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_secret_key_fallbacks(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_debug(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_xframe_deny(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_allowed_hosts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_referrer_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning | Error]: ...
|
||||
def check_cross_origin_opener_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_csp_settings(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_xframe_options_middleware(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
def check_sts(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_sts_include_subdomains(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_sts_preload(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_content_type_nosniff(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_ssl_redirect(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_secret_key(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_secret_key_fallbacks(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_debug(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_xframe_deny(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_allowed_hosts(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_referrer_policy(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_cross_origin_opener_policy(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
def check_csp_settings(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Error, Warning
|
||||
from django.core.checks.messages import CheckMessage, Warning
|
||||
|
||||
W003: Warning
|
||||
W016: Warning
|
||||
|
||||
def check_csrf_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_csrf_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_csrf_failure_view(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_csrf_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_csrf_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_csrf_failure_view(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import Warning
|
||||
from django.core.checks.messages import CheckMessage, Warning
|
||||
|
||||
def add_session_cookie_message(message: str) -> str: ...
|
||||
|
||||
@@ -16,5 +15,5 @@ W013: Warning
|
||||
W014: Warning
|
||||
W015: Warning
|
||||
|
||||
def check_session_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_session_cookie_httponly(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def check_session_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_session_cookie_httponly(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
def check_templates(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_templates(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
|
||||
from . import Error
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
|
||||
E001: Error
|
||||
E002: Error
|
||||
E003: Error
|
||||
E004: Error
|
||||
|
||||
def check_setting_language_code(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_setting_languages(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_setting_languages_bidi(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_language_settings_consistent(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_setting_language_code(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_setting_languages(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_setting_languages_bidi(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_language_settings_consistent(
|
||||
app_configs: Sequence[AppConfig] | None, **kwargs: object
|
||||
) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -2,13 +2,13 @@ from collections.abc import Sequence
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.checks.messages import CheckMessage, Error, Warning
|
||||
from django.core.checks.messages import CheckMessage, Error
|
||||
from django.urls import _AnyURL
|
||||
|
||||
def check_url_config(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ...
|
||||
def check_url_config(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def check_resolver(resolver: _AnyURL) -> list[CheckMessage]: ...
|
||||
def check_url_namespaces_unique(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Warning]: ...
|
||||
def get_warning_for_invalid_pattern(pattern: Any) -> list[Error]: ...
|
||||
def check_url_settings(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_url_namespaces_unique(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def get_warning_for_invalid_pattern(pattern: Any) -> list[CheckMessage]: ...
|
||||
def check_url_settings(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
def E006(name: str) -> Error: ...
|
||||
def check_custom_error_handlers(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ...
|
||||
def check_custom_error_handlers(app_configs: Sequence[AppConfig] | None, **kwargs: object) -> list[CheckMessage]: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import IO
|
||||
|
||||
from _typeshed import StrPath
|
||||
from django.core.files import File
|
||||
from django.utils._os import _PathCompatible
|
||||
|
||||
class ImageFile(File[bytes]):
|
||||
@property
|
||||
@@ -9,6 +9,4 @@ class ImageFile(File[bytes]):
|
||||
@property
|
||||
def height(self) -> int: ...
|
||||
|
||||
def get_image_dimensions(
|
||||
file_or_path: _PathCompatible | IO[bytes], close: bool = False
|
||||
) -> tuple[int | None, int | None]: ...
|
||||
def get_image_dimensions(file_or_path: StrPath | IO[bytes], close: bool = False) -> tuple[int | None, int | None]: ...
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
from datetime import datetime
|
||||
from typing import IO, Any
|
||||
|
||||
from _typeshed import StrPath
|
||||
from django.core.files.base import File
|
||||
from django.utils._os import _PathCompatible
|
||||
|
||||
class Storage:
|
||||
def open(self, name: str, mode: str = "rb") -> File: ...
|
||||
def open(self, name: str, mode: str = "rb") -> File[Any]: ...
|
||||
def save(self, name: str | None, content: IO[Any], max_length: int | None = None) -> str: ...
|
||||
def is_name_available(self, name: str, max_length: int | None = None) -> bool: ...
|
||||
def get_valid_name(self, name: str) -> str: ...
|
||||
def get_alternative_name(self, file_root: str, file_ext: str) -> str: ...
|
||||
def get_available_name(self, name: str, max_length: int | None = None) -> str: ...
|
||||
def generate_filename(self, filename: _PathCompatible) -> str: ...
|
||||
def generate_filename(self, filename: StrPath) -> str: ...
|
||||
def path(self, name: str) -> str: ...
|
||||
def delete(self, name: str) -> None: ...
|
||||
def exists(self, name: str) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.utils._os import _PathCompatible
|
||||
from _typeshed import StrPath
|
||||
from django.utils.deconstruct import _Deconstructible
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
@@ -8,16 +8,16 @@ from .mixins import StorageSettingsMixin
|
||||
class FileSystemStorage(_Deconstructible, Storage, StorageSettingsMixin):
|
||||
def __init__(
|
||||
self,
|
||||
location: _PathCompatible | None = None,
|
||||
location: StrPath | None = None,
|
||||
base_url: str | None = None,
|
||||
file_permissions_mode: int | None = None,
|
||||
directory_permissions_mode: int | None = None,
|
||||
allow_overwrite: bool = False,
|
||||
) -> None: ...
|
||||
@cached_property
|
||||
def base_location(self) -> _PathCompatible: ...
|
||||
def base_location(self) -> StrPath: ...
|
||||
@cached_property
|
||||
def location(self) -> _PathCompatible: ...
|
||||
def location(self) -> StrPath: ...
|
||||
@cached_property
|
||||
def base_url(self) -> str: ...
|
||||
@cached_property
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from django.utils._os import _PathCompatible
|
||||
from _typeshed import StrPath
|
||||
from django.utils.deconstruct import _Deconstructible
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
@@ -8,15 +8,15 @@ from .mixins import StorageSettingsMixin
|
||||
class InMemoryStorage(_Deconstructible, Storage, StorageSettingsMixin):
|
||||
def __init__(
|
||||
self,
|
||||
location: _PathCompatible | None = None,
|
||||
location: StrPath | None = None,
|
||||
base_url: str | None = None,
|
||||
file_permissions_mode: int | None = None,
|
||||
directory_permissions_mode: int | None = None,
|
||||
) -> None: ...
|
||||
@cached_property
|
||||
def base_location(self) -> _PathCompatible: ...
|
||||
def base_location(self) -> StrPath: ...
|
||||
@cached_property
|
||||
def location(self) -> _PathCompatible: ...
|
||||
def location(self) -> StrPath: ...
|
||||
@cached_property
|
||||
def base_url(self) -> str: ...
|
||||
@cached_property
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
from typing import IO
|
||||
from typing import IO, Any
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.utils.functional import cached_property
|
||||
from typing_extensions import Self, override
|
||||
from typing_extensions import Self, TypeVar, override
|
||||
|
||||
class UploadedFile(File):
|
||||
# `typing.AnyStr` is deprecated from 3.16+, so we define our own equivalent constrained TypeVar.
|
||||
_AnyStr = TypeVar("_AnyStr", str, bytes)
|
||||
|
||||
class UploadedFile(File[_AnyStr]):
|
||||
content_type: str | None
|
||||
charset: str | None
|
||||
content_type_extra: dict[str, bytes] | None
|
||||
@@ -14,7 +17,7 @@ class UploadedFile(File):
|
||||
name: str | None
|
||||
def __init__(
|
||||
self,
|
||||
file: IO | None = None,
|
||||
file: IO[_AnyStr] | None = None,
|
||||
name: str | None = None,
|
||||
content_type: str | None = None,
|
||||
size: int | None = None,
|
||||
@@ -22,7 +25,7 @@ class UploadedFile(File):
|
||||
content_type_extra: dict[str, bytes] | None = None,
|
||||
) -> None: ...
|
||||
|
||||
class TemporaryUploadedFile(UploadedFile):
|
||||
class TemporaryUploadedFile(UploadedFile[Any]):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
@@ -33,11 +36,11 @@ class TemporaryUploadedFile(UploadedFile):
|
||||
) -> None: ...
|
||||
def temporary_file_path(self) -> str: ...
|
||||
|
||||
class InMemoryUploadedFile(UploadedFile):
|
||||
class InMemoryUploadedFile(UploadedFile[Any]):
|
||||
field_name: str | None
|
||||
def __init__(
|
||||
self,
|
||||
file: IO,
|
||||
file: IO[Any],
|
||||
field_name: str | None,
|
||||
name: str | None,
|
||||
content_type: str | None,
|
||||
|
||||
@@ -31,7 +31,7 @@ class FileUploadHandler:
|
||||
content_length: int,
|
||||
boundary: str,
|
||||
encoding: str | None = None,
|
||||
) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ...
|
||||
) -> tuple[QueryDict, MultiValueDict[str, UploadedFile[Any]]] | None: ...
|
||||
def new_file(
|
||||
self,
|
||||
field_name: str,
|
||||
@@ -42,7 +42,7 @@ class FileUploadHandler:
|
||||
content_type_extra: dict[str, bytes] | None = None,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ...
|
||||
def file_complete(self, file_size: int) -> UploadedFile | None: ...
|
||||
def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ...
|
||||
def upload_complete(self) -> None: ...
|
||||
def upload_interrupted(self) -> None: ...
|
||||
|
||||
@@ -61,7 +61,7 @@ class TemporaryFileUploadHandler(FileUploadHandler):
|
||||
@override
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ...
|
||||
@override
|
||||
def file_complete(self, file_size: int) -> UploadedFile | None: ...
|
||||
def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ...
|
||||
@override
|
||||
def upload_interrupted(self) -> None: ...
|
||||
|
||||
@@ -76,7 +76,7 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
content_length: int,
|
||||
boundary: str,
|
||||
encoding: str | None = None,
|
||||
) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ...
|
||||
) -> tuple[QueryDict, MultiValueDict[str, UploadedFile[Any]]] | None: ...
|
||||
@override
|
||||
def new_file(
|
||||
self,
|
||||
@@ -90,7 +90,7 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
@override
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ...
|
||||
@override
|
||||
def file_complete(self, file_size: int) -> UploadedFile | None: ...
|
||||
def file_complete(self, file_size: int) -> UploadedFile[Any] | None: ...
|
||||
|
||||
def load_handler(path: str, *args: Any, **kwargs: Any) -> FileUploadHandler: ...
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from collections.abc import Iterator
|
||||
from typing import IO, Any, AnyStr, Generic
|
||||
|
||||
from django.utils._os import _PathCompatible
|
||||
from _typeshed import StrPath
|
||||
|
||||
def validate_file_name(name: _PathCompatible, allow_relative_path: bool = False) -> _PathCompatible: ...
|
||||
def validate_file_name(name: StrPath, allow_relative_path: bool = False) -> StrPath: ...
|
||||
|
||||
class FileProxyMixin(Generic[AnyStr]):
|
||||
file: IO[AnyStr] | None
|
||||
|
||||
@@ -2,6 +2,7 @@ from collections.abc import Awaitable, Callable, Iterator, Mapping, Sequence
|
||||
from logging import Logger
|
||||
from typing import IO, Any, TypeAlias
|
||||
|
||||
from _typeshed import ExcInfo
|
||||
from django.core.files import uploadedfile
|
||||
from django.core.handlers import base
|
||||
from django.http.request import HttpRequest, _ImmutableQueryDict
|
||||
@@ -35,7 +36,7 @@ class ASGIRequest(HttpRequest):
|
||||
POST: _ImmutableQueryDict
|
||||
@property
|
||||
@override
|
||||
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override]
|
||||
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile[Any]]: ... # type: ignore[override]
|
||||
@cached_property
|
||||
@override
|
||||
def COOKIES(self) -> dict[str, str]: ... # type: ignore[override]
|
||||
@@ -62,7 +63,7 @@ class ASGIHandler(base.BaseHandler):
|
||||
self, scope: Mapping[str, Any], body_file: IO[bytes]
|
||||
) -> tuple[ASGIRequest, None] | tuple[None, HttpResponseBase]: ...
|
||||
def handle_uncaught_exception(
|
||||
self, request: HttpRequest, resolver: URLResolver, exc_info: Any
|
||||
self, request: HttpRequest, resolver: URLResolver, exc_info: ExcInfo
|
||||
) -> HttpResponseBase: ...
|
||||
async def send_response(self, response: HttpResponseBase, send: _SendCallback) -> None: ...
|
||||
@classmethod
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import Any
|
||||
|
||||
from _typeshed import ExcInfo
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseBase
|
||||
from django.urls.resolvers import URLResolver
|
||||
@@ -12,4 +12,4 @@ def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse
|
||||
def get_exception_response(
|
||||
request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception
|
||||
) -> HttpResponse: ...
|
||||
def handle_uncaught_exception(request: HttpRequest, resolver: URLResolver, exc_info: Any) -> HttpResponse: ...
|
||||
def handle_uncaught_exception(request: HttpRequest, resolver: URLResolver, exc_info: ExcInfo) -> HttpResponse: ...
|
||||
|
||||
@@ -35,7 +35,7 @@ class WSGIRequest(HttpRequest):
|
||||
def COOKIES(self) -> dict[str, str]: ... # type: ignore[override]
|
||||
@property
|
||||
@override
|
||||
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile]: ... # type: ignore[override]
|
||||
def FILES(self) -> MultiValueDict[str, uploadedfile.UploadedFile[Any]]: ... # type: ignore[override]
|
||||
|
||||
class WSGIHandler(base.BaseHandler):
|
||||
request_class: type[WSGIRequest]
|
||||
|
||||
@@ -26,7 +26,7 @@ class CommandParser(ArgumentParser):
|
||||
def error(self, message: str) -> Any: ...
|
||||
|
||||
def handle_default_options(options: Namespace) -> None: ...
|
||||
def no_translations(handle_func: Callable) -> Callable: ...
|
||||
def no_translations(handle_func: Callable[..., Any]) -> Callable[..., Any]: ...
|
||||
|
||||
class DjangoHelpFormatter(HelpFormatter):
|
||||
show_last: set[str]
|
||||
@@ -42,7 +42,7 @@ class OutputWrapper(TextIOBase):
|
||||
def style_func(self, style_func: Callable[[str], str] | None) -> None: ...
|
||||
ending: str
|
||||
def __init__(self, out: TextIO, ending: str = "\n") -> None: ...
|
||||
def __getattr__(self, name: str) -> Callable: ...
|
||||
def __getattr__(self, name: str) -> Callable[..., Any]: ...
|
||||
@override
|
||||
def flush(self) -> None: ...
|
||||
@override
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from _typeshed import StrPath
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils._os import _PathCompatible
|
||||
from typing_extensions import override
|
||||
|
||||
def has_bom(fn: Path) -> bool: ...
|
||||
def is_dir_writable(path: _PathCompatible) -> bool: ...
|
||||
def is_dir_writable(path: StrPath) -> bool: ...
|
||||
|
||||
class Command(BaseCommand):
|
||||
program: str
|
||||
@@ -15,4 +15,4 @@ class Command(BaseCommand):
|
||||
has_errors: bool
|
||||
@override
|
||||
def handle(self, **options: Any) -> None: ...
|
||||
def compile_messages(self, locations: list[tuple[_PathCompatible, _PathCompatible]]) -> None: ...
|
||||
def compile_messages(self, locations: list[tuple[StrPath, StrPath]]) -> None: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class EmptyPage(InvalidPage): ...
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@type_check_only
|
||||
class _SupportsPagination(Protocol[_T], Sized, Iterable):
|
||||
class _SupportsPagination(Protocol[_T], Sized, Iterable[_T]):
|
||||
@overload
|
||||
def __getitem__(self, index: int, /) -> _T: ...
|
||||
@overload
|
||||
|
||||
@@ -19,7 +19,7 @@ def unregister_serializer(format: str) -> None: ...
|
||||
def get_serializer(format: str) -> type[Serializer] | BadSerializer: ...
|
||||
def get_serializer_formats() -> list[str]: ...
|
||||
def get_public_serializer_formats() -> list[str]: ...
|
||||
def get_deserializer(format: str) -> Callable | type[Deserializer]: ...
|
||||
def get_deserializer(format: str) -> Callable[..., Any] | type[Deserializer]: ...
|
||||
def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ...
|
||||
def deserialize(format: str, stream_or_string: Any, **options: Any) -> Iterator[DeserializedObject]: ...
|
||||
def sort_dependencies(app_list: Iterable[Any], allow_cycles: bool = False) -> list[type[Model]]: ...
|
||||
|
||||
@@ -82,8 +82,8 @@ class DeserializedObject:
|
||||
|
||||
def build_instance(Model: type[Model], data: dict[str, Any], db: str) -> Model: ...
|
||||
def deserialize_m2m_values(
|
||||
field: ManyToManyField, field_value: Iterable[Any], using: str | None, handle_forward_references: bool
|
||||
field: ManyToManyField[Any, Any], field_value: Iterable[Any], using: str | None, handle_forward_references: bool
|
||||
) -> Sequence[Any] | object: ...
|
||||
def deserialize_fk_value(
|
||||
field: ForeignKey, field_value: Any, using: str | None, handle_forward_references: bool
|
||||
field: ForeignKey[Any, Any], field_value: Any, using: str | None, handle_forward_references: bool
|
||||
) -> Any | object: ...
|
||||
|
||||
@@ -153,10 +153,10 @@ class FileExtensionValidator(_Deconstructible):
|
||||
message: _StrOrPromise | None = None,
|
||||
code: str | None = None,
|
||||
) -> None: ...
|
||||
def __call__(self, value: File) -> None: ...
|
||||
def __call__(self, value: File[Any]) -> None: ...
|
||||
|
||||
def get_available_image_extensions() -> Sequence[str]: ...
|
||||
def validate_image_file_extension(value: File) -> None: ...
|
||||
def validate_image_file_extension(value: File[Any]) -> None: ...
|
||||
|
||||
class ProhibitNullCharactersValidator(_Deconstructible):
|
||||
message: _StrOrPromise
|
||||
|
||||
@@ -56,7 +56,7 @@ class BaseDatabaseIntrospection:
|
||||
def installed_models(self, tables: list[str]) -> set[type[Model]]: ...
|
||||
def sequence_list(self) -> list[dict[str, str]]: ...
|
||||
def get_sequences(
|
||||
self, cursor: CursorWrapper, table_name: str, table_fields: Iterable[Field] = ()
|
||||
self, cursor: CursorWrapper, table_name: str, table_fields: Iterable[Field[Any, Any]] = ()
|
||||
) -> list[_SequenceDict]: ...
|
||||
def get_relations(self, cursor: CursorWrapper, table_name: str) -> dict[str, tuple[str, str]]: ...
|
||||
def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str | None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from collections.abc import Container, Iterator
|
||||
from re import Pattern
|
||||
from typing import Any, Literal
|
||||
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
@@ -13,7 +14,7 @@ from .validation import DatabaseValidation
|
||||
|
||||
version: Any
|
||||
django_conversions: Any
|
||||
server_version_re: Any
|
||||
server_version_re: Pattern[str]
|
||||
|
||||
class CursorWrapper:
|
||||
codes_for_integrityerror: Any
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections.abc import Callable, Iterable
|
||||
from datetime import date, datetime
|
||||
from re import Pattern
|
||||
from sqlite3 import dbapi2 as Database
|
||||
from types import ModuleType
|
||||
from typing import Any
|
||||
@@ -41,7 +42,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
|
||||
def is_in_memory_db(self) -> bool: ...
|
||||
|
||||
FORMAT_QMARK_REGEX: Any
|
||||
FORMAT_QMARK_REGEX: Pattern[str]
|
||||
|
||||
class SQLiteCursorWrapper(Database.Cursor):
|
||||
@override
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from os import PathLike
|
||||
|
||||
from _typeshed import StrPath
|
||||
from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
|
||||
@@ -7,4 +6,4 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||
connection: DatabaseWrapper
|
||||
|
||||
@staticmethod
|
||||
def is_in_memory_db(database_name: str | PathLike[str]) -> bool: ...
|
||||
def is_in_memory_db(database_name: StrPath) -> bool: ...
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
from re import Pattern
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
from django.db.backends.base.introspection import BaseDatabaseIntrospection
|
||||
@@ -18,7 +19,7 @@ class FieldInfo(NamedTuple):
|
||||
pk: bool
|
||||
has_json_constraint: bool
|
||||
|
||||
field_size_re: Any
|
||||
field_size_re: Pattern[str]
|
||||
|
||||
def get_field_size(name: str) -> int | None: ...
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user