mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
third iteration of stubs
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
*.egg-info
|
||||
__pycache__/
|
||||
out/
|
||||
/test_sqlite.py
|
||||
/test_sqlite.py
|
||||
/django
|
||||
@@ -1,5 +1,4 @@
|
||||
from functools import partial
|
||||
from typing import Any, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.db.migrations.state import AppConfigStub
|
||||
@@ -15,12 +14,15 @@ class Apps:
|
||||
apps_ready: bool = ...
|
||||
loading: bool = ...
|
||||
def __init__(
|
||||
self, installed_apps: Union[List[AppConfigStub], Tuple] = ...
|
||||
self,
|
||||
installed_apps: Optional[
|
||||
Union[List[AppConfigStub], List[str], Tuple]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
models_ready: bool = ...
|
||||
ready: bool = ...
|
||||
def populate(
|
||||
self, installed_apps: Union[List[AppConfigStub], Tuple, List[str]] = ...
|
||||
self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...
|
||||
) -> None: ...
|
||||
def check_apps_ready(self) -> None: ...
|
||||
def check_models_ready(self) -> None: ...
|
||||
@@ -36,7 +38,7 @@ class Apps:
|
||||
require_ready: bool = ...,
|
||||
) -> Type[Model]: ...
|
||||
def register_model(self, app_label: str, model: Type[Model]) -> None: ...
|
||||
def is_installed(self, app_name: Any): ...
|
||||
def is_installed(self, app_name: str) -> bool: ...
|
||||
def get_containing_app_config(
|
||||
self, object_name: str
|
||||
) -> Optional[AppConfig]: ...
|
||||
@@ -44,13 +46,15 @@ class Apps:
|
||||
self, app_label: str, model_name: str
|
||||
) -> Type[Model]: ...
|
||||
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ...
|
||||
def set_available_apps(self, available: Any) -> None: ...
|
||||
def set_available_apps(self, available: List[str]) -> None: ...
|
||||
def unset_available_apps(self) -> None: ...
|
||||
def set_installed_apps(self, installed: List[str]) -> None: ...
|
||||
def set_installed_apps(
|
||||
self, installed: Union[List[str], Tuple[str]]
|
||||
) -> None: ...
|
||||
def unset_installed_apps(self) -> None: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def lazy_model_operation(
|
||||
self, function: partial, *model_keys: Any
|
||||
self, function: Callable, *model_keys: Any
|
||||
) -> None: ...
|
||||
def do_pending_operations(self, model: Type[Model]) -> None: ...
|
||||
|
||||
|
||||
@@ -1,11 +1,108 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.utils.functional import LazyObject
|
||||
|
||||
ENVIRONMENT_VARIABLE: str
|
||||
|
||||
class LazySettings(LazyObject):
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __getattr__(
|
||||
self, name: str
|
||||
) -> Optional[
|
||||
Union[
|
||||
Callable,
|
||||
Dict[int, None],
|
||||
Dict[int, str],
|
||||
Dict[str, Callable],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Union[Callable, Dict[str, int], str]],
|
||||
Dict[str, Union[Dict[str, int], int, str]],
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Optional[str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], Dict[str, None], int, str]
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], bool, str]],
|
||||
Dict[str, Union[List[str], str]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Union[List[str], str]], Dict[str, str]],
|
||||
],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
List[Dict[str, Union[Dict[str, List[Any]], List[Any], bool, str]]],
|
||||
List[Dict[str, Union[Dict[str, Tuple[str]], List[str], str]]],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[Any, Any], bool, str]],
|
||||
Dict[str, Union[Dict[str, bool], bool, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, List[Tuple[str, Dict[str, str]]]], str],
|
||||
],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str, Union[Dict[str, List[str]], List[str], bool, str]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Tuple[str, str]], List[str], bool, str],
|
||||
],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, bool], str]],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[str, Union[Dict[str, str], str]],
|
||||
]
|
||||
],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
List[int],
|
||||
Tuple[Tuple[str, str], Tuple[str, str]],
|
||||
Tuple[str, str],
|
||||
Type[Any],
|
||||
float,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
]: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def configure(self, default_settings: Any = ..., **options: Any) -> Any: ...
|
||||
@@ -27,8 +124,136 @@ class UserSettingsHolder:
|
||||
def __init__(
|
||||
self, default_settings: Union[Settings, UserSettingsHolder]
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __getattr__(
|
||||
self, name: str
|
||||
) -> Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Dict[Any, Any], Dict[str, None], int, str]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], bool, str]],
|
||||
Dict[str, Union[List[str], str]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], str]], Dict[str, str]
|
||||
],
|
||||
],
|
||||
int,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, str],
|
||||
List[Dict[str, Union[Dict[str, List[str]], List[str], bool, str]]],
|
||||
List[Dict[str, Union[Dict[str, Tuple[str]], List[str], bool, str]]],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
List[int],
|
||||
float,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
]: ...
|
||||
def __setattr__(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[
|
||||
Union[
|
||||
Callable,
|
||||
Dict[int, None],
|
||||
Dict[int, str],
|
||||
Dict[str, Callable],
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Dict[str, Union[List[str], bool, str]]],
|
||||
int,
|
||||
]
|
||||
],
|
||||
],
|
||||
Dict[str, Optional[str]],
|
||||
Dict[str, Union[Dict[str, Optional[str]], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[Callable, Dict[str, int], str]],
|
||||
Dict[str, Union[Dict[str, int], int, str]],
|
||||
],
|
||||
],
|
||||
List[
|
||||
Dict[str, Union[Dict[str, List[Any]], List[Any], bool, str]]
|
||||
],
|
||||
List[Dict[str, Union[Dict[str, Tuple[str]], List[str], str]]],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[Any, Any], bool, str]],
|
||||
Dict[str, Union[Dict[str, bool], bool, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, List[Tuple[str, Dict[str, str]]]], str
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, List[str]], List[str], bool, str],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Tuple[str, str]], List[str], bool, str
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, bool], str]],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[str, Union[Dict[str, str], str]],
|
||||
]
|
||||
],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
List[int],
|
||||
Tuple[Tuple[str, str], Tuple[str, str]],
|
||||
Tuple[str],
|
||||
Type[Any],
|
||||
bytes,
|
||||
Settings,
|
||||
UserSettingsHolder,
|
||||
float,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
],
|
||||
) -> None: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def is_overridden(self, setting: str) -> bool: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from typing import Any, Callable, Optional, Tuple, Union
|
||||
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import include as include
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
@@ -11,8 +12,14 @@ handler500: Any
|
||||
def url(
|
||||
regex: str,
|
||||
view: Optional[
|
||||
Union[Tuple[None, None, None], Tuple[str, str, str], Callable]
|
||||
Union[Callable, Tuple[None, None, None], Tuple[str, str, str]]
|
||||
],
|
||||
kwargs: Any = ...,
|
||||
kwargs: Optional[
|
||||
Union[
|
||||
Dict[str, Dict[str, Sitemap]],
|
||||
Dict[str, Union[Dict[str, Type[Sitemap]], str]],
|
||||
Dict[str, Union[int, str]],
|
||||
]
|
||||
] = ...,
|
||||
name: Optional[str] = ...,
|
||||
) -> Union[URLResolver, URLPattern]: ...
|
||||
) -> Union[URLPattern, URLResolver]: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
def i18n_patterns(
|
||||
*urls: Any, prefix_default_language: bool = ...
|
||||
) -> Union[List[URLPattern], List[List[Any]], List[URLResolver]]: ...
|
||||
) -> Union[List[List[Any]], List[URLPattern], List[URLResolver]]: ...
|
||||
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ...
|
||||
|
||||
urlpatterns: Any
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.db.models.base import Model
|
||||
from django.db.models.fields import BooleanField, DateField, Field
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.related import RelatedField
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
|
||||
@@ -48,7 +47,7 @@ class FieldListFilter(ListFilter):
|
||||
title: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
field: Union[Field, reverse_related.ForeignObjectRel],
|
||||
field: Union[Field, mixins.FieldCacheMixin],
|
||||
request: WSGIRequest,
|
||||
params: Dict[str, str],
|
||||
model: Type[Model],
|
||||
@@ -65,11 +64,11 @@ class FieldListFilter(ListFilter):
|
||||
test: Callable,
|
||||
list_filter_class: Type[
|
||||
Union[
|
||||
BooleanFieldListFilter,
|
||||
AllValuesFieldListFilter,
|
||||
BooleanFieldListFilter,
|
||||
ChoicesFieldListFilter,
|
||||
DateFieldListFilter,
|
||||
RelatedFieldListFilter,
|
||||
ChoicesFieldListFilter,
|
||||
]
|
||||
],
|
||||
take_priority: bool = ...,
|
||||
@@ -77,7 +76,7 @@ class FieldListFilter(ListFilter):
|
||||
@classmethod
|
||||
def create(
|
||||
cls,
|
||||
field: Union[Field, reverse_related.ForeignObjectRel],
|
||||
field: Union[Field, mixins.FieldCacheMixin],
|
||||
request: WSGIRequest,
|
||||
params: Dict[str, str],
|
||||
model: Type[Model],
|
||||
@@ -115,7 +114,7 @@ class RelatedFieldListFilter(FieldListFilter):
|
||||
field: FieldCacheMixin,
|
||||
request: WSGIRequest,
|
||||
model_admin: ModelAdmin,
|
||||
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
|
||||
) -> List[Tuple[str, str]]: ...
|
||||
def choices(self, changelist: Any) -> None: ...
|
||||
|
||||
class BooleanFieldListFilter(FieldListFilter):
|
||||
@@ -209,4 +208,4 @@ class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
|
||||
used_parameters: Dict[Any, Any]
|
||||
def field_choices(
|
||||
self, field: RelatedField, request: WSGIRequest, model_admin: ModelAdmin
|
||||
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
|
||||
) -> List[Tuple[str, str]]: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ from django import forms
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.db.models.fields import AutoField
|
||||
from django.forms.utils import ErrorDict
|
||||
from django.forms.widgets import Media
|
||||
from django.forms.widgets import Media, Widget
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
ACTION_CHECKBOX_NAME: str
|
||||
@@ -77,7 +77,7 @@ class Fieldline:
|
||||
readonly_fields: Optional[Any] = ...,
|
||||
model_admin: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[Union[AdminReadonlyField, AdminField]]: ...
|
||||
def __iter__(self) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
|
||||
def errors(self) -> SafeText: ...
|
||||
|
||||
class AdminField:
|
||||
@@ -133,7 +133,14 @@ class InlineAdminFormSet:
|
||||
has_view_permission: bool = ...,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[InlineAdminForm]: ...
|
||||
def fields(self) -> Iterator[Dict[str, Any]]: ...
|
||||
def fields(
|
||||
self
|
||||
) -> Iterator[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, bool], bool, str]],
|
||||
Dict[str, Union[bool, Widget, str]],
|
||||
]
|
||||
]: ...
|
||||
def inline_formset_data(self) -> str: ...
|
||||
@property
|
||||
def forms(self): ...
|
||||
|
||||
@@ -18,18 +18,19 @@ class LogEntryManager(models.Manager):
|
||||
self,
|
||||
user_id: int,
|
||||
content_type_id: int,
|
||||
object_id: Union[str, UUID, int],
|
||||
object_id: Union[int, str, UUID],
|
||||
object_repr: str,
|
||||
action_flag: int,
|
||||
change_message: Union[
|
||||
List[Dict[str, Dict[str, Union[str, List[str]]]]],
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
str,
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Dict[str, List[str]]], Dict[str, Dict[str, str]]
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
Dict[str, Dict[str, Union[List[str], str]]],
|
||||
Dict[str, Dict[str, str]],
|
||||
]
|
||||
],
|
||||
str,
|
||||
] = ...,
|
||||
) -> LogEntry: ...
|
||||
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.contrib.admin.filters import SimpleListFilter
|
||||
from django.contrib.admin.models import LogEntry
|
||||
from django.contrib.admin.sites import AdminSite, DefaultAdminSite
|
||||
from django.contrib.admin.views.main import ChangeList
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import Paginator
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import CharField, Field
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.related import (ForeignKey, ManyToManyField,
|
||||
RelatedField)
|
||||
from django.db.models.query import QuerySet
|
||||
from django.forms.fields import Field, TypedChoiceField
|
||||
from django.forms.models import ModelChoiceField
|
||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||
from django.forms.widgets import Media
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.http.response import (HttpResponse, HttpResponseBase,
|
||||
HttpResponseRedirect, JsonResponse)
|
||||
from django.urls.resolvers import URLPattern
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
IS_POPUP_VAR: str
|
||||
@@ -27,7 +31,7 @@ VERTICAL: Any
|
||||
def get_content_type_for_model(
|
||||
obj: Union[Type[Model], Model]
|
||||
) -> ContentType: ...
|
||||
def get_ul_class(radio_style: Any): ...
|
||||
def get_ul_class(radio_style: int) -> str: ...
|
||||
|
||||
class IncorrectLookupParameters(Exception): ...
|
||||
|
||||
@@ -58,42 +62,66 @@ class BaseModelAdmin:
|
||||
self, db_field: Field, request: WSGIRequest, **kwargs: Any
|
||||
) -> Optional[Field]: ...
|
||||
def formfield_for_choice_field(
|
||||
self, db_field: CharField, request: WSGIRequest, **kwargs: Any
|
||||
self, db_field: Field, request: WSGIRequest, **kwargs: Any
|
||||
) -> TypedChoiceField: ...
|
||||
def get_field_queryset(
|
||||
self, db: None, db_field: ForeignKey, request: WSGIRequest
|
||||
) -> None: ...
|
||||
self, db: None, db_field: RelatedField, request: WSGIRequest
|
||||
) -> Optional[QuerySet]: ...
|
||||
def formfield_for_foreignkey(
|
||||
self, db_field: ForeignKey, request: WSGIRequest, **kwargs: Any
|
||||
) -> Optional[ModelChoiceField]: ...
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: Any, request: Any, **kwargs: Any
|
||||
): ...
|
||||
self, db_field: ManyToManyField, request: WSGIRequest, **kwargs: Any
|
||||
) -> ModelMultipleChoiceField: ...
|
||||
def get_autocomplete_fields(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> None: ...
|
||||
def get_view_on_site_url(
|
||||
self, obj: Optional[Model] = ...
|
||||
) -> Optional[str]: ...
|
||||
def get_empty_value_display(self) -> SafeText: ...
|
||||
def get_exclude(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> None: ...
|
||||
def get_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> List[str]: ...
|
||||
) -> Union[List[Union[Callable, str]], Tuple[str, str]]: ...
|
||||
def get_fieldsets(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Union[
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
Union[
|
||||
Dict[str, List[Any]],
|
||||
Dict[str, List[Union[Callable, str]]],
|
||||
Dict[str, List[str]],
|
||||
Dict[str, Tuple[str, str]],
|
||||
],
|
||||
]
|
||||
],
|
||||
Tuple[Tuple[None, Dict[str, Tuple[Tuple[str, str]]]]],
|
||||
List[Tuple[None, Dict[str, List[str]]]],
|
||||
Tuple[
|
||||
Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]],
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
|
||||
Dict[str, Union[Tuple[str, str], Tuple[str]]],
|
||||
],
|
||||
],
|
||||
],
|
||||
]: ...
|
||||
def get_ordering(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
|
||||
def get_readonly_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Tuple: ...
|
||||
) -> Union[List[str], Tuple]: ...
|
||||
def get_prepopulated_fields(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> Dict[Any, Any]: ...
|
||||
) -> Dict[str, Tuple[str]]: ...
|
||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
||||
def get_sortable_by(self, request: WSGIRequest) -> Tuple[str]: ...
|
||||
def lookup_allowed(self, lookup: Any, value: Any): ...
|
||||
def get_sortable_by(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Callable], List[str], Tuple]: ...
|
||||
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
|
||||
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
|
||||
def has_add_permission(self, request: WSGIRequest) -> bool: ...
|
||||
def has_change_permission(
|
||||
@@ -105,17 +133,17 @@ class BaseModelAdmin:
|
||||
def has_view_permission(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> bool: ...
|
||||
def has_module_permission(self, request: Any): ...
|
||||
def has_module_permission(self, request: WSGIRequest) -> bool: ...
|
||||
|
||||
class ModelAdmin(BaseModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.files.FileField,
|
||||
]
|
||||
],
|
||||
@@ -124,15 +152,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
@@ -168,16 +188,20 @@ class ModelAdmin(BaseModelAdmin):
|
||||
model: Type[django.db.models.base.Model] = ...
|
||||
opts: django.db.models.options.Options = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
def __init__(self, model: Any, admin_site: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
model: Type[Model],
|
||||
admin_site: Optional[Union[AdminSite, DefaultAdminSite]],
|
||||
) -> None: ...
|
||||
def get_inline_instances(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ...
|
||||
) -> List[InlineModelAdmin]: ...
|
||||
def get_urls(self): ...
|
||||
def get_urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
def urls(self): ...
|
||||
def urls(self) -> List[URLPattern]: ...
|
||||
@property
|
||||
def media(self) -> Media: ...
|
||||
def get_model_perms(self, request: Any): ...
|
||||
def get_model_perms(self, request: WSGIRequest) -> Dict[str, bool]: ...
|
||||
def get_form(
|
||||
self,
|
||||
request: Any,
|
||||
@@ -209,13 +233,25 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object: Model,
|
||||
message: List[Dict[str, Dict[str, str]]],
|
||||
message: Union[
|
||||
Dict[str, Dict[Any, Any]],
|
||||
List[Union[Dict[str, Dict[Any, Any]], Dict[str, Dict[str, str]]]],
|
||||
],
|
||||
) -> LogEntry: ...
|
||||
def log_change(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object: Model,
|
||||
message: List[Dict[str, Dict[str, Union[str, List[str]]]]],
|
||||
message: Union[
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Dict[str, List[str]]],
|
||||
Dict[str, Dict[str, Union[List[str], str]]],
|
||||
Dict[str, Dict[str, str]],
|
||||
]
|
||||
],
|
||||
],
|
||||
) -> LogEntry: ...
|
||||
def log_deletion(
|
||||
self, request: WSGIRequest, object: Model, object_repr: str
|
||||
@@ -225,26 +261,42 @@ class ModelAdmin(BaseModelAdmin):
|
||||
def get_action_choices(
|
||||
self, request: WSGIRequest, default_choices: List[Tuple[str, str]] = ...
|
||||
) -> List[Tuple[str, str]]: ...
|
||||
def get_action(self, action: Any): ...
|
||||
def get_list_display(self, request: WSGIRequest) -> Tuple[str]: ...
|
||||
def get_action(
|
||||
self, action: Union[Callable, str]
|
||||
) -> Tuple[Callable, str, str]: ...
|
||||
def get_list_display(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Callable], List[str], Tuple[str]]: ...
|
||||
def get_list_display_links(
|
||||
self, request: WSGIRequest, list_display: Tuple[str]
|
||||
) -> List[str]: ...
|
||||
def get_list_filter(self, request: WSGIRequest) -> Tuple: ...
|
||||
def get_list_select_related(self, request: WSGIRequest) -> bool: ...
|
||||
def get_search_fields(self, request: WSGIRequest) -> Tuple: ...
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
list_display: Union[List[Callable], List[str], Tuple[str]],
|
||||
) -> Optional[Union[List[Callable], List[str], Tuple[str]]]: ...
|
||||
def get_list_filter(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[Type[SimpleListFilter]], List[str], Tuple]: ...
|
||||
def get_list_select_related(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[Tuple, bool]: ...
|
||||
def get_search_fields(
|
||||
self, request: WSGIRequest
|
||||
) -> Union[List[str], Tuple]: ...
|
||||
def get_search_results(
|
||||
self, request: WSGIRequest, queryset: QuerySet, search_term: str
|
||||
) -> Tuple[QuerySet, bool]: ...
|
||||
def get_preserved_filters(self, request: WSGIRequest) -> str: ...
|
||||
def construct_change_message(
|
||||
self, request: Any, form: Any, formsets: Any, add: bool = ...
|
||||
): ...
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
form: AdminPasswordChangeForm,
|
||||
formsets: None,
|
||||
add: bool = ...,
|
||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||
def message_user(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
message: str,
|
||||
level: int = ...,
|
||||
level: Union[int, str] = ...,
|
||||
extra_tags: str = ...,
|
||||
fail_silently: bool = ...,
|
||||
) -> None: ...
|
||||
@@ -253,7 +305,9 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self, request: Any, obj: Any, form: Any, change: Any
|
||||
) -> None: ...
|
||||
def delete_model(self, request: WSGIRequest, obj: Model) -> None: ...
|
||||
def delete_queryset(self, request: Any, queryset: Any) -> None: ...
|
||||
def delete_queryset(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
) -> None: ...
|
||||
def save_formset(
|
||||
self, request: Any, form: Any, formset: Any, change: Any
|
||||
) -> None: ...
|
||||
@@ -279,11 +333,11 @@ class ModelAdmin(BaseModelAdmin):
|
||||
self, request: WSGIRequest, obj: Model
|
||||
) -> HttpResponseRedirect: ...
|
||||
def response_post_save_change(
|
||||
self, request: WSGIRequest, obj: User
|
||||
self, request: WSGIRequest, obj: Model
|
||||
) -> HttpResponseRedirect: ...
|
||||
def response_action(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
) -> Optional[TemplateResponse]: ...
|
||||
) -> Optional[HttpResponseBase]: ...
|
||||
def response_delete(
|
||||
self, request: WSGIRequest, obj_display: str, obj_id: int
|
||||
) -> HttpResponse: ...
|
||||
@@ -297,15 +351,15 @@ class ModelAdmin(BaseModelAdmin):
|
||||
) -> List[Any]: ...
|
||||
def get_changeform_initial_data(
|
||||
self, request: WSGIRequest
|
||||
) -> Dict[Any, Any]: ...
|
||||
) -> Dict[str, str]: ...
|
||||
def changeform_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
object_id: Optional[str] = ...,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...,
|
||||
extra_context: Optional[Dict[str, bool]] = ...,
|
||||
) -> Any: ...
|
||||
def autocomplete_view(self, request: Any): ...
|
||||
def autocomplete_view(self, request: WSGIRequest) -> JsonResponse: ...
|
||||
def add_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
@@ -317,13 +371,13 @@ class ModelAdmin(BaseModelAdmin):
|
||||
request: WSGIRequest,
|
||||
object_id: str,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...,
|
||||
extra_context: Optional[Dict[str, bool]] = ...,
|
||||
) -> HttpResponse: ...
|
||||
def changelist_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
extra_context: Optional[Dict[str, str]] = ...,
|
||||
) -> HttpResponse: ...
|
||||
) -> HttpResponseBase: ...
|
||||
def get_deleted_objects(
|
||||
self, objs: QuerySet, request: WSGIRequest
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
@@ -332,7 +386,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||
) -> Any: ...
|
||||
def history_view(
|
||||
self, request: WSGIRequest, object_id: str, extra_context: None = ...
|
||||
) -> TemplateResponse: ...
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class InlineModelAdmin(BaseModelAdmin):
|
||||
model: Any = ...
|
||||
@@ -352,7 +406,9 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
parent_model: Any = ...
|
||||
opts: Any = ...
|
||||
has_registered_model: Any = ...
|
||||
def __init__(self, parent_model: Any, admin_site: Any) -> None: ...
|
||||
def __init__(
|
||||
self, parent_model: Union[Type[Model], Model], admin_site: AdminSite
|
||||
) -> None: ...
|
||||
@property
|
||||
def media(self) -> Media: ...
|
||||
def get_extra(
|
||||
@@ -363,7 +419,7 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
) -> None: ...
|
||||
def get_max_num(
|
||||
self, request: WSGIRequest, obj: Optional[Model] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
) -> Optional[int]: ...
|
||||
fields: Any = ...
|
||||
def get_formset(
|
||||
self, request: Any, obj: Optional[Any] = ..., **kwargs: Any
|
||||
|
||||
@@ -31,7 +31,7 @@ class AdminSite:
|
||||
def register(
|
||||
self,
|
||||
model_or_iterable: Union[
|
||||
Tuple[Type[Model]], Type[Model], List[Type[Model]]
|
||||
List[Type[Model]], Tuple[Type[Model]], Type[Model]
|
||||
],
|
||||
admin_class: Optional[Type[ModelAdmin]] = ...,
|
||||
**options: Any
|
||||
|
||||
@@ -15,7 +15,12 @@ register: Any
|
||||
DOT: str
|
||||
|
||||
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
|
||||
def pagination(cl: ChangeList) -> Dict[str, Any]: ...
|
||||
def pagination(
|
||||
cl: ChangeList
|
||||
) -> Union[
|
||||
Dict[str, Union[List[Union[int, str]], ChangeList, int, str]],
|
||||
Dict[str, Union[ChangeList, int, range, str]],
|
||||
]: ...
|
||||
def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def result_headers(
|
||||
cl: ChangeList
|
||||
@@ -30,18 +35,31 @@ class ResultList(list):
|
||||
|
||||
def results(cl: ChangeList) -> Iterator[ResultList]: ...
|
||||
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
|
||||
def result_list(cl: ChangeList) -> Dict[str, Any]: ...
|
||||
def result_list(
|
||||
cl: ChangeList
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Optional[Union[int, str]]],
|
||||
Dict[str, Union[bool, SafeText]],
|
||||
Dict[str, Union[bool, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
]
|
||||
],
|
||||
List[ResultList],
|
||||
List[BoundField],
|
||||
ChangeList,
|
||||
int,
|
||||
],
|
||||
]: ...
|
||||
def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def date_hierarchy(
|
||||
cl: ChangeList
|
||||
) -> Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, Dict[str, str], List[Any]]],
|
||||
Dict[str, Union[bool, Dict[str, str], List[Dict[str, str]]]],
|
||||
]
|
||||
]: ...
|
||||
) -> Optional[Dict[str, Union[Dict[str, str], List[Dict[str, str]], bool]]]: ...
|
||||
def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def search_form(cl: ChangeList) -> Dict[str, Union[ChangeList, bool, str]]: ...
|
||||
def search_form(cl: ChangeList) -> Dict[str, Union[bool, ChangeList, str]]: ...
|
||||
def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ...
|
||||
def admin_list_filter(cl: ChangeList, spec: FieldListFilter) -> SafeText: ...
|
||||
def admin_actions(context: RequestContext) -> RequestContext: ...
|
||||
|
||||
@@ -8,9 +8,9 @@ from django.utils.safestring import SafeText
|
||||
register: Any
|
||||
|
||||
def admin_urlname(value: Options, arg: SafeText) -> str: ...
|
||||
def admin_urlquote(value: Union[str, UUID, int]) -> Union[str, UUID, int]: ...
|
||||
def admin_urlquote(value: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||
def add_preserved_filters(
|
||||
context: Union[Dict[str, Union[str, Options]], RequestContext],
|
||||
context: Union[Dict[str, Union[Options, str]], RequestContext],
|
||||
url: str,
|
||||
popup: bool = ...,
|
||||
to_field: Optional[str] = ...,
|
||||
|
||||
@@ -1,47 +1,77 @@
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.contrib.admin.options import BaseModelAdmin
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.contrib.auth.forms import AdminPasswordChangeForm
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.deletion import Collector
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.fields.files import FieldFile
|
||||
from django.db.models.fields.mixins import FieldCacheMixin
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel, OneToOneRel
|
||||
from django.db.models.fields.reverse_related import (ForeignObjectRel,
|
||||
ManyToOneRel)
|
||||
from django.db.models.options import Options
|
||||
from django.db.models.query import QuerySet
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
class FieldIsAForeignKeyColumnName(Exception): ...
|
||||
|
||||
def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ...
|
||||
def prepare_lookup_value(
|
||||
key: str, value: Union[str, datetime]
|
||||
key: str, value: Union[datetime, str]
|
||||
) -> Union[bool, datetime, str]: ...
|
||||
def quote(s: Union[str, int]) -> Union[str, int]: ...
|
||||
def quote(s: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||
def unquote(s: str) -> str: ...
|
||||
def flatten(
|
||||
fields: Union[
|
||||
List[Union[str, Callable]], Tuple[Tuple[str, str]], Tuple[str, str]
|
||||
List[Union[Callable, str]],
|
||||
List[Union[List[str], str]],
|
||||
List[Union[Tuple[str, str], str]],
|
||||
Tuple,
|
||||
]
|
||||
) -> List[Union[str, Callable]]: ...
|
||||
) -> List[Union[Callable, str]]: ...
|
||||
def flatten_fieldsets(
|
||||
fieldsets: Union[
|
||||
List[Tuple[None, Dict[str, List[Union[str, Callable]]]]],
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
Union[
|
||||
Dict[str, List[Any]],
|
||||
Dict[str, List[Union[Callable, str]]],
|
||||
Dict[str, List[str]],
|
||||
Dict[str, Tuple[str, str]],
|
||||
],
|
||||
]
|
||||
],
|
||||
List[Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]]],
|
||||
Tuple[
|
||||
Union[
|
||||
Tuple[None, Dict[str, Tuple[Tuple[str, str]]]],
|
||||
Tuple[None, Dict[str, Tuple[str]]],
|
||||
Tuple[
|
||||
None,
|
||||
Union[
|
||||
Dict[str, Tuple[Tuple[str, str]]],
|
||||
Dict[str, Tuple[str, str, List[str]]],
|
||||
Dict[str, Tuple[str, str, Tuple[str, str]]],
|
||||
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
|
||||
],
|
||||
]
|
||||
],
|
||||
Tuple[
|
||||
Tuple[str, Dict[str, Tuple[str]]], Tuple[str, Dict[str, Tuple[str]]]
|
||||
Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]],
|
||||
Tuple[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
|
||||
Dict[str, Union[Tuple[str, str], Tuple[str]]],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
) -> List[Union[str, Callable]]: ...
|
||||
) -> List[Union[Callable, str]]: ...
|
||||
def get_deleted_objects(
|
||||
objs: QuerySet, request: WSGIRequest, admin_site: AdminSite
|
||||
) -> Tuple[List[Any], Dict[Any, Any], Set[Any], List[Any]]: ...
|
||||
@@ -59,7 +89,7 @@ class NestedObjects(Collector):
|
||||
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
|
||||
def collect(
|
||||
self,
|
||||
objs: Union[QuerySet, List[Model]],
|
||||
objs: Union[List[Model], QuerySet],
|
||||
source: Optional[Type[Model]] = ...,
|
||||
source_attr: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
@@ -70,55 +100,60 @@ class NestedObjects(Collector):
|
||||
def nested(
|
||||
self, format_callback: Callable = ...
|
||||
) -> Union[
|
||||
List[Union[List[str], str]], List[Union[SafeText, List[SafeText]]]
|
||||
List[Union[List[Union[List[int], int]], int]],
|
||||
List[Union[List[Union[List[str], str]], str]],
|
||||
]: ...
|
||||
def can_fast_delete(self, *args: Any, **kwargs: Any) -> bool: ...
|
||||
|
||||
def model_format_dict(obj: Any): ...
|
||||
def model_ngettext(obj: QuerySet, n: None = ...) -> str: ...
|
||||
def model_ngettext(
|
||||
obj: Union[Options, QuerySet], n: Optional[int] = ...
|
||||
) -> str: ...
|
||||
def lookup_field(
|
||||
name: Union[str, Callable], obj: Model, model_admin: BaseModelAdmin = ...
|
||||
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
|
||||
) -> Union[
|
||||
Tuple[None, Callable, Optional[Union[Callable, date, int, str]]],
|
||||
Tuple[
|
||||
Union[str, Model, date, int, None],
|
||||
Union[str, Model, date, int, None],
|
||||
Union[str, Model, date, int, None],
|
||||
Optional[Union[date, Model, FieldFile, float, int, str]],
|
||||
Optional[Union[date, Model, FieldFile, float, int, str]],
|
||||
Optional[Union[date, Model, FieldFile, float, int, str]],
|
||||
],
|
||||
Tuple[None, Callable, Callable],
|
||||
]: ...
|
||||
def label_for_field(
|
||||
name: Union[str, Callable],
|
||||
name: Union[Callable, str],
|
||||
model: Type[Model],
|
||||
model_admin: BaseModelAdmin = ...,
|
||||
model_admin: Optional[BaseModelAdmin] = ...,
|
||||
return_attr: bool = ...,
|
||||
) -> Union[
|
||||
Tuple[
|
||||
Union[Type[str], None, Callable, GenericForeignKey],
|
||||
Union[Type[str], None, Callable, GenericForeignKey],
|
||||
],
|
||||
Tuple[Callable, Callable],
|
||||
Tuple[str, Optional[Union[Type[str], GenericForeignKey]]],
|
||||
str,
|
||||
]: ...
|
||||
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
|
||||
def display_for_field(
|
||||
value: Optional[Union[int, str, date, Model]],
|
||||
field: Union[Field, reverse_related.OneToOneRel],
|
||||
empty_value_display: SafeText,
|
||||
value: Optional[Union[date, Decimal, Model, FieldFile, float, int, str]],
|
||||
field: Union[Field, mixins.FieldCacheMixin],
|
||||
empty_value_display: str,
|
||||
) -> str: ...
|
||||
def display_for_value(
|
||||
value: Optional[Union[Callable, Model, int, str]],
|
||||
empty_value_display: SafeText,
|
||||
value: Optional[
|
||||
Union[Callable, List[Union[int, str]], date, Model, FieldFile, int, str]
|
||||
],
|
||||
empty_value_display: str,
|
||||
boolean: bool = ...,
|
||||
) -> str: ...
|
||||
|
||||
class NotRelationField(Exception): ...
|
||||
|
||||
def get_model_from_relation(
|
||||
field: Union[Field, reverse_related.ManyToOneRel]
|
||||
field: Union[Field, ForeignObjectRel]
|
||||
) -> Type[Model]: ...
|
||||
def reverse_field_path(
|
||||
model: Type[Model], path: str
|
||||
) -> Tuple[Type[Model], str]: ...
|
||||
def get_fields_from_path(
|
||||
model: Type[Model], path: str
|
||||
) -> List[Union[FieldCacheMixin, Field]]: ...
|
||||
def construct_change_message(form: Any, formsets: Any, add: Any): ...
|
||||
) -> List[Union[Field, ForeignObjectRel]]: ...
|
||||
def construct_change_message(
|
||||
form: AdminPasswordChangeForm, formsets: None, add: bool
|
||||
) -> List[Dict[str, Dict[str, List[str]]]]: ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.contrib.admin.filters import ListFilter, SimpleListFilter
|
||||
from django.contrib.admin.filters import FieldListFilter, SimpleListFilter
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import (Combinable, CombinedExpression,
|
||||
OrderBy)
|
||||
from django.db.models.expressions import BaseExpression, CombinedExpression, F
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
ALL_VAR: str
|
||||
@@ -47,28 +47,37 @@ class ChangeList:
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
model: Type[Model],
|
||||
list_display: Union[List[Union[str, Callable]], Tuple[str]],
|
||||
list_display: Union[List[Union[Callable, str]], Tuple[str]],
|
||||
list_display_links: Optional[
|
||||
Union[List[str], Tuple[str], List[Callable]]
|
||||
Union[List[Callable], List[str], Tuple[str]]
|
||||
],
|
||||
list_filter: Union[Tuple, List[Type[SimpleListFilter]], List[str]],
|
||||
list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple],
|
||||
date_hierarchy: Optional[str],
|
||||
search_fields: Union[Tuple, List[str]],
|
||||
list_select_related: Union[bool, Tuple],
|
||||
search_fields: Union[List[str], Tuple],
|
||||
list_select_related: Union[Tuple, bool],
|
||||
list_per_page: int,
|
||||
list_max_show_all: int,
|
||||
list_editable: Union[List[str], Tuple],
|
||||
model_admin: ModelAdmin,
|
||||
sortable_by: Union[Tuple, List[Callable], List[str]],
|
||||
sortable_by: Union[List[Callable], List[str], Tuple],
|
||||
) -> None: ...
|
||||
def get_filters_params(self, params: None = ...) -> Dict[str, str]: ...
|
||||
def get_filters(
|
||||
self, request: WSGIRequest
|
||||
) -> Tuple[List[ListFilter], bool, bool, bool]: ...
|
||||
) -> Union[
|
||||
Tuple[List[Any], bool, Dict[str, datetime], bool],
|
||||
Tuple[
|
||||
List[Union[FieldListFilter, SimpleListFilter]],
|
||||
bool,
|
||||
Dict[str, bool],
|
||||
bool,
|
||||
],
|
||||
Tuple[List[FieldListFilter], bool, Dict[str, str], bool],
|
||||
]: ...
|
||||
def get_query_string(
|
||||
self,
|
||||
new_params: Optional[
|
||||
Union[Dict[str, Union[str, int]], Dict[str, None]]
|
||||
Union[Dict[str, None], Dict[str, Union[int, str]]]
|
||||
] = ...,
|
||||
remove: Optional[List[str]] = ...,
|
||||
) -> str: ...
|
||||
@@ -82,11 +91,11 @@ class ChangeList:
|
||||
paginator: Any = ...
|
||||
def get_results(self, request: WSGIRequest) -> None: ...
|
||||
def get_ordering_field(
|
||||
self, field_name: Union[str, Callable]
|
||||
self, field_name: Union[Callable, str]
|
||||
) -> Optional[Union[CombinedExpression, str]]: ...
|
||||
def get_ordering(
|
||||
self, request: WSGIRequest, queryset: QuerySet
|
||||
) -> Union[List[Union[Combinable, str]], List[Union[OrderBy, str]]]: ...
|
||||
) -> List[Union[BaseExpression, F, str]]: ...
|
||||
def get_ordering_field_columns(self) -> OrderedDict: ...
|
||||
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
|
||||
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
|
||||
|
||||
@@ -1,124 +1,405 @@
|
||||
from typing import Any, Optional
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.sites import AdminSite, DefaultAdminSite
|
||||
from django.contrib.auth.forms import (ReadOnlyPasswordHashField,
|
||||
ReadOnlyPasswordHashWidget)
|
||||
from django.db.models.fields.reverse_related import ForeignObjectRel
|
||||
from django.db.models.query_utils import Q
|
||||
from django.forms.fields import (BooleanField, CharField, Field, FileField,
|
||||
IntegerField, SplitDateTimeField, URLField)
|
||||
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
|
||||
from django.forms.widgets import (CheckboxInput, ChoiceWidget, DateInput,
|
||||
Media, Select, TimeInput, Widget)
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
|
||||
class FilteredSelectMultiple(forms.SelectMultiple):
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
verbose_name: Any = ...
|
||||
is_stacked: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Any,
|
||||
is_stacked: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
choices: Any = ...,
|
||||
verbose_name: str,
|
||||
is_stacked: bool,
|
||||
attrs: None = ...,
|
||||
choices: Tuple = ...,
|
||||
) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Union[List[Any], str],
|
||||
attrs: Optional[Dict[str, str]],
|
||||
) -> Dict[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[int, str]],
|
||||
List[
|
||||
Tuple[
|
||||
None,
|
||||
List[Dict[str, Union[Dict[Any, Any], int, str]]],
|
||||
int,
|
||||
]
|
||||
],
|
||||
List[str],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
]: ...
|
||||
|
||||
class AdminDateWidget(forms.DateInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
def __init__(
|
||||
self, attrs: Optional[Any] = ..., format: Optional[Any] = ...
|
||||
self,
|
||||
attrs: Optional[Dict[str, Union[int, str]]] = ...,
|
||||
format: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class AdminTimeWidget(forms.TimeInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
def __init__(
|
||||
self, attrs: Optional[Any] = ..., format: Optional[Any] = ...
|
||||
self,
|
||||
attrs: Optional[Dict[str, Union[int, str]]] = ...,
|
||||
format: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class AdminSplitDateTime(forms.SplitDateTimeWidget):
|
||||
attrs: Dict[Any, Any]
|
||||
widgets: List[django.forms.widgets.DateTimeBaseInput]
|
||||
template_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[List[str], datetime]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, str]],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, Union[bool, str]],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Dict[str, str], bool, str]],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
]
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[Any, Any],
|
||||
List[Dict[str, Union[Dict[str, str], bool, str]]],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[bool, str]],
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Union[bool, str]], bool, str],
|
||||
]
|
||||
],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[Dict[str, Union[Dict[str, str], bool, str]]],
|
||||
bool,
|
||||
str,
|
||||
],
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
]: ...
|
||||
|
||||
class AdminRadioSelect(forms.RadioSelect):
|
||||
attrs: Dict[str, str]
|
||||
template_name: str = ...
|
||||
|
||||
class AdminFileWidget(forms.ClearableFileInput):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
|
||||
def url_params_from_lookup_dict(lookups: Any): ...
|
||||
def url_params_from_lookup_dict(
|
||||
lookups: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, List[str]],
|
||||
Dict[str, Tuple[str, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Q,
|
||||
]
|
||||
) -> Dict[str, str]: ...
|
||||
|
||||
class ForeignKeyRawIdWidget(forms.TextInput):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
rel: Any = ...
|
||||
admin_site: Any = ...
|
||||
db: Any = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
db: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
using: Optional[Any] = ...,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: Union[AdminSite, DefaultAdminSite],
|
||||
attrs: None = ...,
|
||||
using: None = ...,
|
||||
) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def base_url_parameters(self): ...
|
||||
def url_parameters(self): ...
|
||||
def label_and_url_for_value(self, value: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[List[int], int, str, UUID]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[
|
||||
str, Optional[Union[Dict[str, Union[bool, str]], bool, str]]
|
||||
],
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Union[Dict[Any, Any], bool, str]], str]],
|
||||
Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]],
|
||||
]: ...
|
||||
def base_url_parameters(self) -> Dict[str, str]: ...
|
||||
def url_parameters(self) -> Dict[str, str]: ...
|
||||
def label_and_url_for_value(
|
||||
self, value: Union[int, str, UUID]
|
||||
) -> Tuple[str, str]: ...
|
||||
|
||||
class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
|
||||
admin_site: django.contrib.admin.sites.AdminSite
|
||||
attrs: Dict[Any, Any]
|
||||
db: None
|
||||
rel: django.db.models.fields.reverse_related.ManyToManyRel
|
||||
template_name: str = ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def url_parameters(self): ...
|
||||
def label_and_url_for_value(self, value: Any): ...
|
||||
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
|
||||
def format_value(self, value: Any): ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[List[int]],
|
||||
attrs: Optional[Dict[str, str]],
|
||||
) -> Union[
|
||||
Dict[str, Union[Dict[str, Union[Dict[Any, Any], bool, str]], str]],
|
||||
Dict[str, Union[Dict[str, Union[Dict[str, str], bool, str]], str]],
|
||||
]: ...
|
||||
def url_parameters(self) -> Dict[Any, Any]: ...
|
||||
def label_and_url_for_value(self, value: List[int]) -> Tuple[str, str]: ...
|
||||
def value_from_datadict(
|
||||
self, data: QueryDict, files: MultiValueDict, name: str
|
||||
) -> None: ...
|
||||
def format_value(self, value: Optional[List[int]]) -> str: ...
|
||||
|
||||
class RelatedFieldWidgetWrapper(forms.Widget):
|
||||
template_name: str = ...
|
||||
needs_multipart_form: Any = ...
|
||||
attrs: Any = ...
|
||||
choices: Any = ...
|
||||
widget: Any = ...
|
||||
rel: Any = ...
|
||||
can_add_related: Any = ...
|
||||
can_change_related: Any = ...
|
||||
can_delete_related: Any = ...
|
||||
can_view_related: Any = ...
|
||||
admin_site: Any = ...
|
||||
needs_multipart_form: bool = ...
|
||||
attrs: Dict[Any, Any] = ...
|
||||
choices: django.forms.models.ModelChoiceIterator = ...
|
||||
widget: django.contrib.admin.widgets.AutocompleteSelect = ...
|
||||
rel: django.db.models.fields.reverse_related.ManyToOneRel = ...
|
||||
can_add_related: bool = ...
|
||||
can_change_related: bool = ...
|
||||
can_delete_related: bool = ...
|
||||
can_view_related: bool = ...
|
||||
admin_site: django.contrib.admin.sites.AdminSite = ...
|
||||
def __init__(
|
||||
self,
|
||||
widget: Any,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
can_add_related: Optional[Any] = ...,
|
||||
widget: ChoiceWidget,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: Union[AdminSite, DefaultAdminSite],
|
||||
can_add_related: Optional[bool] = ...,
|
||||
can_change_related: bool = ...,
|
||||
can_delete_related: bool = ...,
|
||||
can_view_related: bool = ...,
|
||||
) -> None: ...
|
||||
def __deepcopy__(self, memo: Any): ...
|
||||
def __deepcopy__(
|
||||
self,
|
||||
memo: Union[
|
||||
Dict[
|
||||
int,
|
||||
Union[
|
||||
List[
|
||||
Union[
|
||||
AdminEmailInputWidget,
|
||||
AdminTextInputWidget,
|
||||
FilteredSelectMultiple,
|
||||
RelatedFieldWidgetWrapper,
|
||||
ReadOnlyPasswordHashField,
|
||||
ReadOnlyPasswordHashWidget,
|
||||
BooleanField,
|
||||
CharField,
|
||||
ModelMultipleChoiceField,
|
||||
CheckboxInput,
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
AdminFileWidget,
|
||||
AdminTextInputWidget,
|
||||
CharField,
|
||||
FileField,
|
||||
]
|
||||
],
|
||||
List[Union[AdminIntegerFieldWidget, IntegerField]],
|
||||
List[
|
||||
Union[
|
||||
AdminSplitDateTime,
|
||||
AdminTextInputWidget,
|
||||
AdminTextareaWidget,
|
||||
RelatedFieldWidgetWrapper,
|
||||
CharField,
|
||||
SplitDateTimeField,
|
||||
ModelChoiceField,
|
||||
DateInput,
|
||||
Select,
|
||||
TimeInput,
|
||||
]
|
||||
],
|
||||
OrderedDict,
|
||||
Field,
|
||||
Widget,
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
int,
|
||||
Union[
|
||||
List[Union[AdminURLFieldWidget, URLField]],
|
||||
OrderedDict,
|
||||
AdminURLFieldWidget,
|
||||
URLField,
|
||||
ModelChoiceField,
|
||||
],
|
||||
],
|
||||
],
|
||||
) -> RelatedFieldWidgetWrapper: ...
|
||||
@property
|
||||
def is_hidden(self): ...
|
||||
def is_hidden(self) -> bool: ...
|
||||
@property
|
||||
def media(self): ...
|
||||
def get_related_url(self, info: Any, action: Any, *args: Any): ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def value_from_datadict(self, data: Any, files: Any, name: Any): ...
|
||||
def value_omitted_from_data(self, data: Any, files: Any, name: Any): ...
|
||||
def id_for_label(self, id_: Any): ...
|
||||
def media(self) -> Media: ...
|
||||
def get_related_url(
|
||||
self, info: Tuple[str, str], action: str, *args: Any
|
||||
) -> str: ...
|
||||
def get_context(
|
||||
self,
|
||||
name: str,
|
||||
value: Optional[Union[int, str]],
|
||||
attrs: Optional[Dict[str, Union[bool, str]]],
|
||||
) -> Dict[str, Union[bool, str]]: ...
|
||||
def value_from_datadict(
|
||||
self, data: QueryDict, files: MultiValueDict, name: str
|
||||
) -> Optional[Union[List[str], str]]: ...
|
||||
def value_omitted_from_data(
|
||||
self, data: Dict[Any, Any], files: Dict[Any, Any], name: str
|
||||
) -> bool: ...
|
||||
def id_for_label(self, id_: str) -> str: ...
|
||||
|
||||
class AdminTextareaWidget(forms.Textarea):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminTextInputWidget(forms.TextInput):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminEmailInputWidget(forms.EmailInput):
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminURLFieldWidget(forms.URLInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
template_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def get_context(self, name: Any, value: Any, attrs: Any): ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
def get_context(
|
||||
self, name: str, value: Optional[str], attrs: Optional[Dict[str, str]]
|
||||
) -> Dict[
|
||||
str, Union[Dict[str, Optional[Union[Dict[str, str], bool, str]]], str]
|
||||
]: ...
|
||||
|
||||
class AdminIntegerFieldWidget(forms.NumberInput):
|
||||
attrs: Dict[str, str]
|
||||
input_type: str
|
||||
class_name: str = ...
|
||||
def __init__(self, attrs: Optional[Any] = ...) -> None: ...
|
||||
def __init__(self, attrs: None = ...) -> None: ...
|
||||
|
||||
class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget):
|
||||
class_name: str = ...
|
||||
@@ -134,19 +415,37 @@ class AutocompleteMixin:
|
||||
attrs: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
rel: Any,
|
||||
admin_site: Any,
|
||||
attrs: Optional[Any] = ...,
|
||||
choices: Any = ...,
|
||||
using: Optional[Any] = ...,
|
||||
rel: ForeignObjectRel,
|
||||
admin_site: Union[AdminSite, DefaultAdminSite],
|
||||
attrs: Optional[Dict[str, str]] = ...,
|
||||
choices: Tuple = ...,
|
||||
using: None = ...,
|
||||
) -> None: ...
|
||||
def get_url(self): ...
|
||||
def get_url(self) -> str: ...
|
||||
def build_attrs(
|
||||
self, base_attrs: Any, extra_attrs: Optional[Any] = ...
|
||||
): ...
|
||||
def optgroups(self, name: Any, value: Any, attr: Optional[Any] = ...): ...
|
||||
self,
|
||||
base_attrs: Dict[str, str],
|
||||
extra_attrs: Optional[Dict[str, Union[bool, str]]] = ...,
|
||||
) -> Dict[str, Union[bool, str]]: ...
|
||||
def optgroups(
|
||||
self,
|
||||
name: str,
|
||||
value: List[str],
|
||||
attr: Dict[str, Union[bool, str]] = ...,
|
||||
) -> List[
|
||||
Tuple[
|
||||
None,
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[Any, Any], bool, str]],
|
||||
Dict[str, Union[Dict[str, bool], Set[str], int, str]],
|
||||
]
|
||||
],
|
||||
int,
|
||||
]
|
||||
]: ...
|
||||
@property
|
||||
def media(self): ...
|
||||
def media(self) -> Media: ...
|
||||
|
||||
class AutocompleteSelect(AutocompleteMixin, forms.Select): ...
|
||||
class AutocompleteSelectMultiple(AutocompleteMixin, forms.SelectMultiple): ...
|
||||
|
||||
@@ -45,7 +45,7 @@ class TemplateDetailView(BaseAdminDocsView):
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
def get_return_data_type(func_name: Any): ...
|
||||
def get_readable_field_data_type(field: Union[str, Field]) -> str: ...
|
||||
def get_readable_field_data_type(field: Union[Field, str]) -> str: ...
|
||||
def extract_views_from_urlpatterns(
|
||||
urlpatterns: Any, base: str = ..., namespace: Optional[Any] = ...
|
||||
): ...
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.options import Options
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
||||
|
||||
@@ -24,7 +23,7 @@ def authenticate(
|
||||
def login(
|
||||
request: HttpRequest,
|
||||
user: AbstractBaseUser,
|
||||
backend: Optional[Union[str, Type[ModelBackend]]] = ...,
|
||||
backend: Optional[Union[Type[ModelBackend], str]] = ...,
|
||||
) -> None: ...
|
||||
def logout(request: HttpRequest) -> None: ...
|
||||
def get_user_model() -> Type[Model]: ...
|
||||
@@ -33,7 +32,7 @@ def get_user(
|
||||
) -> Union[AbstractBaseUser, AnonymousUser]: ...
|
||||
def get_permission_codename(action: str, opts: Options) -> str: ...
|
||||
def update_session_auth_hash(
|
||||
request: WSGIRequest, user: Union[SimpleLazyObject, AbstractUser]
|
||||
request: WSGIRequest, user: AbstractUser
|
||||
) -> None: ...
|
||||
|
||||
default_app_config: str
|
||||
|
||||
@@ -16,11 +16,11 @@ class GroupAdmin(admin.ModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.files.FileField,
|
||||
]
|
||||
],
|
||||
@@ -29,15 +29,7 @@ class GroupAdmin(admin.ModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
@@ -59,11 +51,11 @@ class UserAdmin(admin.ModelAdmin):
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.files.FileField,
|
||||
]
|
||||
],
|
||||
@@ -72,15 +64,7 @@ class UserAdmin(admin.ModelAdmin):
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
django.forms.widgets.Widget,
|
||||
]
|
||||
],
|
||||
],
|
||||
|
||||
@@ -10,7 +10,7 @@ class ModelBackend:
|
||||
def authenticate(
|
||||
self,
|
||||
request: Any,
|
||||
username: Optional[Union[str, int]] = ...,
|
||||
username: Optional[Union[int, str]] = ...,
|
||||
password: Optional[str] = ...,
|
||||
**kwargs: Any
|
||||
) -> Optional[AbstractBaseUser]: ...
|
||||
@@ -28,7 +28,7 @@ class ModelBackend:
|
||||
) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self,
|
||||
user_obj: Union[AnonymousUser, AbstractBaseUser],
|
||||
user_obj: Union[AbstractBaseUser, AnonymousUser],
|
||||
perm: str,
|
||||
obj: Optional[str] = ...,
|
||||
) -> bool: ...
|
||||
|
||||
@@ -40,5 +40,5 @@ class AbstractBaseUser(models.Model):
|
||||
def get_email_field_name(cls) -> str: ...
|
||||
@classmethod
|
||||
def normalize_username(
|
||||
cls, username: Union[str, int]
|
||||
) -> Union[str, int]: ...
|
||||
cls, username: Union[int, str]
|
||||
) -> Union[int, str]: ...
|
||||
|
||||
@@ -15,13 +15,14 @@ class PermLookupDict:
|
||||
|
||||
class PermWrapper:
|
||||
user: django.utils.functional.SimpleLazyObject = ...
|
||||
def __init__(
|
||||
self, user: Union[SimpleLazyObject, AnonymousUser, User]
|
||||
) -> None: ...
|
||||
def __init__(self, user: Union[AnonymousUser, User]) -> None: ...
|
||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def __contains__(self, perm_name: Union[str, bool]) -> bool: ...
|
||||
def __contains__(self, perm_name: Union[bool, str]) -> bool: ...
|
||||
|
||||
def auth(
|
||||
request: HttpRequest
|
||||
) -> Dict[str, Union[SimpleLazyObject, PermWrapper, User, AnonymousUser]]: ...
|
||||
) -> Union[
|
||||
Dict[str, Union[PermWrapper, AnonymousUser]],
|
||||
Dict[str, Union[PermWrapper, User]],
|
||||
]: ...
|
||||
|
||||
@@ -12,7 +12,7 @@ def login_required(
|
||||
login_url: Optional[str] = ...,
|
||||
) -> Callable: ...
|
||||
def permission_required(
|
||||
perm: Union[str, List[str], Set[str]],
|
||||
perm: Union[List[str], Set[str], str],
|
||||
login_url: None = ...,
|
||||
raise_exception: bool = ...,
|
||||
) -> Callable: ...
|
||||
|
||||
@@ -6,7 +6,6 @@ from django.contrib.auth.models import AbstractUser, User
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
UserModel: Any
|
||||
|
||||
@@ -15,13 +14,20 @@ class ReadOnlyPasswordHashWidget(forms.Widget):
|
||||
template_name: str = ...
|
||||
def get_context(
|
||||
self, name: str, value: Optional[str], attrs: Dict[str, str]
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[str, bool, None, Dict[Any, Any]]],
|
||||
List[Dict[str, str]],
|
||||
Dict[str, Union[str, bool, None, Dict[str, str]]],
|
||||
Dict[str, Union[str, bool, Dict[str, str]]],
|
||||
) -> Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Optional[Union[Dict[Any, Any], bool, str]]],
|
||||
List[Dict[str, str]],
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Optional[Union[Dict[str, str], bool, str]]],
|
||||
List[Dict[str, str]],
|
||||
],
|
||||
],
|
||||
]: ...
|
||||
|
||||
@@ -63,7 +69,7 @@ class UserChangeForm(forms.ModelForm):
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[str, Optional[Union[int, str, datetime.datetime, List[Any]]]]
|
||||
initial: Dict[str, Optional[Union[List[Any], datetime.datetime, int, str]]]
|
||||
instance: django.contrib.auth.models.User
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
@@ -114,7 +120,7 @@ class PasswordResetForm(forms.Form):
|
||||
self,
|
||||
subject_template_name: str,
|
||||
email_template_name: str,
|
||||
context: Dict[str, Union[str, AbstractBaseUser]],
|
||||
context: Dict[str, Union[AbstractBaseUser, str]],
|
||||
from_email: Optional[str],
|
||||
to_email: str,
|
||||
html_email_template_name: Optional[str] = ...,
|
||||
@@ -148,15 +154,10 @@ class SetPasswordForm(forms.Form):
|
||||
new_password2: Any = ...
|
||||
user: django.contrib.auth.models.User = ...
|
||||
def __init__(
|
||||
self,
|
||||
user: Optional[Union[SimpleLazyObject, AbstractBaseUser]],
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
self, user: Optional[AbstractBaseUser], *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def clean_new_password2(self) -> str: ...
|
||||
def save(
|
||||
self, commit: bool = ...
|
||||
) -> Union[AbstractBaseUser, SimpleLazyObject]: ...
|
||||
def save(self, commit: bool = ...) -> AbstractBaseUser: ...
|
||||
|
||||
class PasswordChangeForm(SetPasswordForm):
|
||||
auto_id: str
|
||||
|
||||
@@ -22,4 +22,4 @@ class Command(BaseCommand):
|
||||
def handle(self, *args: Any, **options: Any) -> None: ...
|
||||
def get_input_data(
|
||||
self, field: Field, message: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
|
||||
@@ -80,10 +80,10 @@ class PermissionsMixin(models.Model):
|
||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self, perm: Union[str, Tuple[str, Any]], obj: Optional[str] = ...
|
||||
self, perm: Union[Tuple[str, Any], str], obj: Optional[str] = ...
|
||||
) -> bool: ...
|
||||
def has_perms(
|
||||
self, perm_list: Union[Set[str], List[str], Tuple[str]], obj: None = ...
|
||||
self, perm_list: Union[List[str], Set[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
def has_module_perms(self, app_label: str) -> bool: ...
|
||||
|
||||
|
||||
@@ -3,24 +3,25 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
def get_default_password_validators() -> Union[
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[Union[MinimumLengthValidator, UserAttributeSimilarityValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
]: ...
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, Union[str, Dict[str, int]]]]
|
||||
validator_config: List[
|
||||
Union[Dict[str, Union[Dict[str, int], str]], Dict[str, str]]
|
||||
]
|
||||
) -> Union[
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[Union[MinimumLengthValidator, UserAttributeSimilarityValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
]: ...
|
||||
def validate_password(
|
||||
password: str,
|
||||
user: Optional[Union[AbstractBaseUser, SimpleLazyObject]] = ...,
|
||||
user: Optional[AbstractBaseUser] = ...,
|
||||
password_validators: Optional[List[Any]] = ...,
|
||||
) -> None: ...
|
||||
def password_changed(
|
||||
@@ -46,8 +47,8 @@ class UserAttributeSimilarityValidator:
|
||||
max_similarity: float = ...
|
||||
def __init__(
|
||||
self,
|
||||
user_attributes: Union[Tuple[str, str, str, str], List[str]] = ...,
|
||||
max_similarity: float = ...,
|
||||
user_attributes: Union[List[str], Tuple[str, str, str, str]] = ...,
|
||||
max_similarity: Union[float, int] = ...,
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
@@ -56,7 +57,7 @@ class CommonPasswordValidator:
|
||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
||||
passwords: Set[str] = ...
|
||||
def __init__(
|
||||
self, password_list_path: Union[str, PosixPath] = ...
|
||||
self, password_list_path: Union[PosixPath, str] = ...
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
@@ -11,7 +11,6 @@ from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
@@ -39,14 +38,15 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], Dict[str, str], MultiValueDict, HttpRequest]
|
||||
Union[Dict[Any, Any], Dict[str, str], HttpRequest, MultiValueDict]
|
||||
],
|
||||
]: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(
|
||||
self, **kwargs: Any
|
||||
) -> Dict[
|
||||
str, Union[AuthenticationForm, LoginView, str, Site, RequestSite]
|
||||
) -> Union[
|
||||
Dict[str, Union[AuthenticationForm, LoginView, Site, str]],
|
||||
Dict[str, Union[AuthenticationForm, LoginView, RequestSite, str]],
|
||||
]: ...
|
||||
|
||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||
@@ -112,7 +112,7 @@ class PasswordResetConfirmView(PasswordContextMixin, FormView):
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str, Optional[Union[Dict[Any, Any], MultiValueDict, AbstractBaseUser]]
|
||||
str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]
|
||||
]: ...
|
||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
@@ -130,10 +130,7 @@ class PasswordChangeView(PasswordContextMixin, FormView):
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[Union[Dict[Any, Any], User, MultiValueDict, SimpleLazyObject]],
|
||||
]: ...
|
||||
) -> Dict[str, Optional[Union[Dict[Any, Any], User]]]: ...
|
||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
||||
|
||||
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
|
||||
|
||||
@@ -42,7 +42,9 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
) -> None: ...
|
||||
def get_filter_kwargs_for_object(
|
||||
self, obj: Model
|
||||
) -> Dict[str, Optional[Union[int, ContentType]]]: ...
|
||||
) -> Union[
|
||||
Dict[str, Optional[ContentType]], Dict[str, Union[ContentType, int]]
|
||||
]: ...
|
||||
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def get_cache_name(self) -> str: ...
|
||||
@@ -54,12 +56,12 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
) -> ContentType: ...
|
||||
def get_prefetch_queryset(
|
||||
self,
|
||||
instances: Union[QuerySet, List[Model]],
|
||||
instances: Union[List[Model], QuerySet],
|
||||
queryset: Optional[QuerySet] = ...,
|
||||
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
|
||||
def __get__(
|
||||
self, instance: Optional[Model], cls: Type[Model] = ...
|
||||
) -> Optional[Union[Model, GenericForeignKey]]: ...
|
||||
) -> Optional[Union[GenericForeignKey, Model]]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
|
||||
class GenericRel(ForeignObjectRel):
|
||||
|
||||
@@ -1,42 +1,55 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||
from typing import Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.apps.registry import Apps
|
||||
from django.contrib.admin.migrations.0001_initial import Migration
|
||||
from django.contrib.admin.migrations.0002_logentry_remove_auto_add import \
|
||||
Migration
|
||||
from django.contrib.admin.migrations.0003_logentry_add_action_flag_choices import \
|
||||
Migration
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import migrations
|
||||
from django.contrib.sites.migrations.0001_initial import Migration
|
||||
from django.contrib.sites.migrations.0002_alter_domain_unique import Migration
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.state import StateApps
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
class RenameContentType(migrations.RunPython):
|
||||
app_label: Any = ...
|
||||
old_model: Any = ...
|
||||
new_model: Any = ...
|
||||
def __init__(
|
||||
self, app_label: str, old_model: str, new_model: str
|
||||
) -> None: ...
|
||||
def rename_forward(
|
||||
self, apps: StateApps, schema_editor: DatabaseSchemaEditor
|
||||
) -> None: ...
|
||||
def rename_backward(
|
||||
self, apps: StateApps, schema_editor: DatabaseSchemaEditor
|
||||
) -> None: ...
|
||||
|
||||
def inject_rename_contenttypes_operations(
|
||||
plan: List[Tuple[Migration, bool]] = ...,
|
||||
apps: StateApps = ...,
|
||||
using: str = ...,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def get_contenttypes_and_models(
|
||||
app_config: AppConfig, using: str, ContentType: Type[ContentType]
|
||||
) -> Tuple[Dict[str, ContentType], Dict]: ...
|
||||
def create_contenttypes(
|
||||
app_config: AppConfig,
|
||||
verbosity: int = ...,
|
||||
interactive: bool = ...,
|
||||
using: str = ...,
|
||||
apps: Apps = ...,
|
||||
**kwargs: Any
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def get_contenttypes_and_models(
|
||||
app_config: AppConfig,
|
||||
using: str,
|
||||
ContentType: Type[ContentType]
|
||||
) -> Tuple[Dict[str, ContentType], Dict[str, Type[Model]]]: ...
|
||||
|
||||
|
||||
def inject_rename_contenttypes_operations(
|
||||
plan: List[Union[Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool]]] = ...,
|
||||
apps: StateApps = ...,
|
||||
using: str = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class RenameContentType:
|
||||
def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ...
|
||||
def rename_backward(
|
||||
self,
|
||||
apps: StateApps,
|
||||
schema_editor: DatabaseSchemaEditor
|
||||
) -> None: ...
|
||||
def rename_forward(
|
||||
self,
|
||||
apps: StateApps,
|
||||
schema_editor: DatabaseSchemaEditor
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from typing import Any, Optional, Type, Union
|
||||
from typing import Any, Dict, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db import models
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
|
||||
class ContentTypeManager(models.Manager):
|
||||
@@ -10,11 +11,13 @@ class ContentTypeManager(models.Manager):
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def get_by_natural_key(self, app_label: Any, model: Any): ...
|
||||
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
|
||||
def get_for_model(
|
||||
self, model: Union[Type[Model], Model], for_concrete_model: bool = ...
|
||||
) -> ContentType: ...
|
||||
def get_for_models(self, *models: Any, for_concrete_models: bool = ...): ...
|
||||
def get_for_models(
|
||||
self, *models: Any, for_concrete_models: bool = ...
|
||||
) -> Dict[Type[Model], ContentType]: ...
|
||||
def get_for_id(self, id: int) -> ContentType: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
|
||||
@@ -30,7 +33,7 @@ class ContentType(models.Model):
|
||||
unique_together: Any = ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def model_class(self) -> Type[Model]: ...
|
||||
def model_class(self) -> Optional[Type[Model]]: ...
|
||||
def get_object_for_this_type(self, **kwargs: Any) -> Model: ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any): ...
|
||||
def natural_key(self): ...
|
||||
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ...
|
||||
def natural_key(self) -> Tuple[str, str]: ...
|
||||
|
||||
@@ -6,6 +6,6 @@ from django.http.response import HttpResponseRedirect
|
||||
|
||||
def shortcut(
|
||||
request: HttpRequest,
|
||||
content_type_id: Union[str, int],
|
||||
object_id: Union[str, int],
|
||||
content_type_id: Union[int, str],
|
||||
object_id: Union[int, str],
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
@@ -6,12 +6,12 @@ from django.db.models.query import QuerySet
|
||||
|
||||
class FlatpageForm(forms.ModelForm):
|
||||
auto_id: str
|
||||
data: Dict[str, Union[str, List[int]]]
|
||||
data: Dict[str, Union[List[int], str]]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[str, Union[int, str, List[django.contrib.sites.models.Site]]]
|
||||
initial: Dict[str, Union[List[django.contrib.sites.models.Site], int, str]]
|
||||
instance: django.contrib.flatpages.models.FlatPage
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
@@ -20,4 +20,4 @@ class FlatpageForm(forms.ModelForm):
|
||||
model: Any = ...
|
||||
fields: str = ...
|
||||
def clean_url(self) -> str: ...
|
||||
def clean(self) -> Dict[str, Union[str, bool, QuerySet]]: ...
|
||||
def clean(self) -> Dict[str, Union[bool, QuerySet, str]]: ...
|
||||
|
||||
@@ -6,13 +6,13 @@ register: Any
|
||||
|
||||
def ordinal(value: Optional[str]) -> Optional[str]: ...
|
||||
def intcomma(
|
||||
value: Optional[Union[Decimal, float, str]], use_l10n: bool = ...
|
||||
value: Optional[Union[Decimal, float, int, str]], use_l10n: bool = ...
|
||||
) -> str: ...
|
||||
|
||||
intword_converters: Any
|
||||
|
||||
def intword(value: Optional[str]) -> Optional[Union[str, int]]: ...
|
||||
def apnumber(value: Optional[str]) -> Optional[Union[str, int]]: ...
|
||||
def intword(value: Optional[str]) -> Optional[Union[int, str]]: ...
|
||||
def apnumber(value: Optional[str]) -> Optional[Union[int, str]]: ...
|
||||
def naturalday(
|
||||
value: Optional[Union[date, str]], arg: None = ...
|
||||
) -> Optional[str]: ...
|
||||
|
||||
@@ -14,7 +14,7 @@ def add_message(
|
||||
extra_tags: str = ...,
|
||||
fail_silently: Union[bool, str] = ...,
|
||||
) -> None: ...
|
||||
def get_messages(request: HttpRequest) -> Union[BaseStorage, List[Any]]: ...
|
||||
def get_messages(request: HttpRequest) -> Union[List[Any], BaseStorage]: ...
|
||||
def get_level(request: HttpRequest) -> int: ...
|
||||
def set_level(request: HttpRequest, level: int) -> bool: ...
|
||||
def debug(
|
||||
@@ -45,5 +45,5 @@ def error(
|
||||
request: WSGIRequest,
|
||||
message: str,
|
||||
extra_tags: str = ...,
|
||||
fail_silently: Union[str, bool] = ...,
|
||||
fail_silently: Union[bool, str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.messages.storage.cookie import CookieStorage
|
||||
from django.contrib.messages.storage.fallback import FallbackStorage
|
||||
from django.contrib.messages.storage.session import SessionStorage
|
||||
from django.contrib.messages.storage.base import BaseStorage
|
||||
from django.http.request import HttpRequest
|
||||
|
||||
|
||||
def messages(
|
||||
request: HttpRequest
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
List[Any],
|
||||
Dict[str, int],
|
||||
FallbackStorage,
|
||||
SessionStorage,
|
||||
CookieStorage,
|
||||
],
|
||||
) -> Union[
|
||||
Dict[str, Union[Dict[str, int], List[Any]]],
|
||||
Dict[str, Union[Dict[str, int], BaseStorage]],
|
||||
]: ...
|
||||
|
||||
@@ -12,7 +12,7 @@ class Message:
|
||||
def __init__(
|
||||
self, level: int, message: str, extra_tags: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __eq__(self, other: Union[str, Message]) -> bool: ...
|
||||
def __eq__(self, other: Union[Message, str]) -> bool: ...
|
||||
@property
|
||||
def tags(self) -> str: ...
|
||||
@property
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import json
|
||||
from typing import Any, Collection, Dict, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.contrib.messages.storage.base import BaseStorage, Message
|
||||
|
||||
@@ -14,10 +14,60 @@ class MessageEncoder(json.JSONEncoder):
|
||||
skipkeys: bool
|
||||
sort_keys: bool
|
||||
message_key: str = ...
|
||||
def default(self, obj: Message) -> List[Union[str, int]]: ...
|
||||
def default(self, obj: Message) -> List[Union[int, str]]: ...
|
||||
|
||||
class MessageDecoder(json.JSONDecoder):
|
||||
def process_messages(self, obj: Collection) -> Any: ...
|
||||
def process_messages(
|
||||
self,
|
||||
obj: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Union[
|
||||
Dict[str, List[Union[int, str]]],
|
||||
List[Union[int, str]],
|
||||
]
|
||||
],
|
||||
List[Union[int, str]],
|
||||
],
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
List[
|
||||
Union[
|
||||
Dict[str, List[Union[int, str]]],
|
||||
List[Union[int, str]],
|
||||
]
|
||||
],
|
||||
List[Union[int, str]],
|
||||
],
|
||||
],
|
||||
List[Union[int, str]],
|
||||
]
|
||||
],
|
||||
List[Union[List[Union[int, str]], str]],
|
||||
List[Union[int, str]],
|
||||
str,
|
||||
],
|
||||
) -> Union[
|
||||
Dict[str, Union[List[Union[Dict[str, Message], Message]], Message]],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[List[Union[Dict[str, Message], Message]], Message],
|
||||
],
|
||||
Message,
|
||||
]
|
||||
],
|
||||
List[Union[Message, str]],
|
||||
Message,
|
||||
str,
|
||||
]: ...
|
||||
def decode(
|
||||
self, s: str, **kwargs: Any
|
||||
) -> Union[
|
||||
@@ -25,13 +75,13 @@ class MessageDecoder(json.JSONDecoder):
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[Message, List[Union[Message, Dict[str, Message]]]],
|
||||
Union[List[Union[Dict[str, Message], Message]], Message],
|
||||
],
|
||||
Message,
|
||||
]
|
||||
],
|
||||
Message,
|
||||
List[Union[Message, str]],
|
||||
Message,
|
||||
]: ...
|
||||
|
||||
class CookieStorage(BaseStorage):
|
||||
|
||||
@@ -16,5 +16,5 @@ class SessionStorage(BaseStorage):
|
||||
self, messages: Union[List[Message], List[str]]
|
||||
) -> str: ...
|
||||
def deserialize_messages(
|
||||
self, data: Optional[Union[str, List[Any]]]
|
||||
) -> Optional[Union[List[str], List[Message]]]: ...
|
||||
self, data: Optional[Union[List[Any], str]]
|
||||
) -> Optional[Union[List[Message], List[str]]]: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.contrib.postgres import lookups
|
||||
from django.db.models import Field, Transform
|
||||
@@ -30,7 +30,11 @@ class ArrayField(CheckFieldDefaultMixin, Field):
|
||||
def get_db_prep_value(
|
||||
self, value: Any, connection: Any, prepared: bool = ...
|
||||
): ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Any]]: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]
|
||||
]: ...
|
||||
def to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
|
||||
@@ -35,7 +35,7 @@ class JSONField(CheckFieldDefaultMixin, Field):
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Union[bool, Type[DjangoJSONEncoder]]]
|
||||
None, str, List[Any], Dict[str, Union[Type[DjangoJSONEncoder], bool]]
|
||||
]: ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
|
||||
@@ -16,25 +16,34 @@ class SessionBase:
|
||||
serializer: Any = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
def __getitem__(self, key: str) -> Union[str, Model, int]: ...
|
||||
def __getitem__(self, key: str) -> Union[Model, int, str]: ...
|
||||
def __setitem__(
|
||||
self, key: str, value: Union[str, datetime, Model, int]
|
||||
self, key: str, value: Union[datetime, Model, int, str]
|
||||
) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def get(
|
||||
self, key: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, int, datetime]]: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Union[str, int]: ...
|
||||
) -> Optional[Union[datetime, int, str]]: ...
|
||||
def pop(self, key: str, default: Any = ...) -> Union[int, str]: ...
|
||||
def setdefault(self, key: str, value: str) -> str: ...
|
||||
def set_test_cookie(self) -> None: ...
|
||||
def test_cookie_worked(self) -> bool: ...
|
||||
def delete_test_cookie(self) -> None: ...
|
||||
def encode(
|
||||
self, session_dict: Dict[str, Union[str, int, Model, datetime]]
|
||||
self,
|
||||
session_dict: Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
],
|
||||
) -> str: ...
|
||||
def decode(
|
||||
self, session_data: Union[str, bytes]
|
||||
) -> Dict[str, Union[str, int, Model, datetime]]: ...
|
||||
self, session_data: Union[bytes, str]
|
||||
) -> Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
]: ...
|
||||
def update(self, dict_: Dict[str, int]) -> None: ...
|
||||
def has_key(self, key: Any): ...
|
||||
def keys(self): ...
|
||||
@@ -46,7 +55,7 @@ class SessionBase:
|
||||
def get_expiry_age(self, **kwargs: Any) -> int: ...
|
||||
def get_expiry_date(self, **kwargs: Any) -> datetime: ...
|
||||
def set_expiry(
|
||||
self, value: Optional[Union[datetime, int, timedelta]]
|
||||
self, value: Optional[Union[datetime, timedelta, int]]
|
||||
) -> None: ...
|
||||
def get_expire_at_browser_close(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
|
||||
@@ -14,12 +14,19 @@ class SessionStore(SessionBase):
|
||||
@classmethod
|
||||
def get_model_class(cls) -> Type[Session]: ...
|
||||
def model(self) -> Type[AbstractBaseSession]: ...
|
||||
def load(self) -> Dict[str, Union[Model, str, int]]: ...
|
||||
def load(
|
||||
self
|
||||
) -> Union[Dict[str, Model], Dict[str, int], Dict[str, str]]: ...
|
||||
def exists(self, session_key: Optional[str]) -> bool: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def create_model_instance(
|
||||
self, data: Dict[str, Union[int, str, Model, datetime]]
|
||||
self,
|
||||
data: Union[
|
||||
Dict[str, Union[datetime, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Model],
|
||||
],
|
||||
) -> AbstractBaseSession: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
def delete(self, session_key: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class SessionStore(SessionBase):
|
||||
storage_path: str = ...
|
||||
file_prefix: str = ...
|
||||
def __init__(self, session_key: Optional[str] = ...) -> None: ...
|
||||
def load(self) -> Dict[str, Union[str, int]]: ...
|
||||
def load(self) -> Dict[str, Union[int, str]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.contrib.sessions.backends.base import SessionBase
|
||||
class SessionStore(SessionBase):
|
||||
accessed: bool
|
||||
serializer: Type[django.core.signing.JSONSerializer]
|
||||
def load(self) -> Dict[str, Union[str, datetime]]: ...
|
||||
def load(self) -> Dict[str, Union[datetime, str]]: ...
|
||||
modified: bool = ...
|
||||
def create(self) -> None: ...
|
||||
def save(self, must_create: bool = ...) -> None: ...
|
||||
|
||||
@@ -6,7 +6,11 @@ from django.db.models.base import Model
|
||||
|
||||
|
||||
class PickleSerializer:
|
||||
def dumps(self, obj: Dict[str, Union[Model, str, datetime]]) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[Model, str, datetime]]: ...
|
||||
def dumps(
|
||||
self, obj: Union[Dict[str, Union[datetime, str]], Dict[str, Model]]
|
||||
) -> bytes: ...
|
||||
def loads(
|
||||
self, data: bytes
|
||||
) -> Union[Dict[str, Union[datetime, str]], Dict[str, Model]]: ...
|
||||
|
||||
JSONSerializer = BaseJSONSerializer
|
||||
|
||||
@@ -22,12 +22,10 @@ class Sitemap:
|
||||
def paginator(self) -> Paginator: ...
|
||||
def get_urls(
|
||||
self,
|
||||
page: Union[str, int] = ...,
|
||||
site: Optional[Union[RequestSite, Site]] = ...,
|
||||
page: Union[int, str] = ...,
|
||||
site: Optional[Union[Site, RequestSite]] = ...,
|
||||
protocol: Optional[str] = ...,
|
||||
) -> Union[
|
||||
List[Dict[str, Union[Model, str, datetime, None]]], List[Dict[str, Any]]
|
||||
]: ...
|
||||
) -> List[Dict[str, Optional[Union[datetime, Model, str]]]]: ...
|
||||
|
||||
class GenericSitemap(Sitemap):
|
||||
priority: None = ...
|
||||
@@ -37,7 +35,10 @@ class GenericSitemap(Sitemap):
|
||||
protocol: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
info_dict: Dict[str, Union[QuerySet, datetime, str]],
|
||||
info_dict: Union[
|
||||
Dict[str, Union[datetime, QuerySet]],
|
||||
Dict[str, Union[QuerySet, str]],
|
||||
],
|
||||
priority: Optional[float] = ...,
|
||||
changefreq: Optional[str] = ...,
|
||||
protocol: Optional[str] = ...,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Optional, Type, Union
|
||||
|
||||
from django.contrib.sitemaps import GenericSitemap, Sitemap
|
||||
@@ -9,16 +8,14 @@ from django.template.response import TemplateResponse
|
||||
def x_robots_tag(func: Callable) -> Callable: ...
|
||||
def index(
|
||||
request: WSGIRequest,
|
||||
sitemaps: Dict[str, Union[Type[Sitemap], Sitemap]],
|
||||
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, Sitemap]],
|
||||
template_name: str = ...,
|
||||
content_type: str = ...,
|
||||
sitemap_url_name: str = ...,
|
||||
) -> TemplateResponse: ...
|
||||
def sitemap(
|
||||
request: WSGIRequest,
|
||||
sitemaps: Union[
|
||||
Dict[str, Type[Sitemap]], Dict[str, GenericSitemap], OrderedDict
|
||||
],
|
||||
sitemaps: Union[Dict[str, Type[Sitemap]], Dict[str, GenericSitemap]],
|
||||
section: Optional[str] = ...,
|
||||
template_name: str = ...,
|
||||
content_type: str = ...,
|
||||
|
||||
@@ -7,4 +7,4 @@ from django.http.request import HttpRequest
|
||||
|
||||
def get_current_site(
|
||||
request: Optional[HttpRequest]
|
||||
) -> Union[RequestSite, Site]: ...
|
||||
) -> Union[Site, RequestSite]: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class FileSystemFinder(BaseFinder):
|
||||
self, app_names: None = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def find_location(
|
||||
self, root: str, path: str, prefix: str = ...
|
||||
) -> Optional[str]: ...
|
||||
@@ -37,7 +37,7 @@ class AppDirectoriesFinder(BaseFinder):
|
||||
def list(
|
||||
self, ignore_patterns: List[str]
|
||||
) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
||||
|
||||
class BaseStorageFinder(BaseFinder):
|
||||
@@ -48,7 +48,7 @@ class BaseStorageFinder(BaseFinder):
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[List[str], str]: ...
|
||||
def list(
|
||||
self, ignore_patterns: List[str]
|
||||
) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
||||
@@ -57,6 +57,6 @@ class DefaultStorageFinder(BaseStorageFinder):
|
||||
storage: django.contrib.staticfiles.storage.StaticFilesStorage = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
def find(path: str, all: bool = ...) -> Optional[Union[str, List[str]]]: ...
|
||||
def find(path: str, all: bool = ...) -> Optional[Union[List[str], str]]: ...
|
||||
def get_finders() -> Iterator[BaseFinder]: ...
|
||||
def get_finder(import_path: str) -> BaseFinder: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.core.files.storage import DefaultStorage, FileSystemStorage
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
@@ -26,7 +26,7 @@ class Command(BaseCommand):
|
||||
ignore_patterns: Any = ...
|
||||
post_process: Any = ...
|
||||
def set_options(self, **options: Any) -> None: ...
|
||||
def collect(self) -> Union[str, List[str]]: ...
|
||||
def collect(self) -> Dict[str, Union[List[Any], List[str]]]: ...
|
||||
def handle(self, **options: Any) -> Optional[str]: ...
|
||||
def log(self, msg: str, level: int = ...) -> None: ...
|
||||
def is_local_storage(self) -> bool: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.core.files.storage import DefaultStorage, FileSystemStorage
|
||||
|
||||
|
||||
def matches_patterns(
|
||||
path: str, patterns: Union[OrderedDict, List[str], Tuple[str]] = ...
|
||||
path: str, patterns: Union[List[str], Tuple[str], OrderedDict] = ...
|
||||
) -> bool: ...
|
||||
def get_files(
|
||||
storage: Union[DefaultStorage, FileSystemStorage],
|
||||
|
||||
3
django-stubs/core/cache/__init__.pyi
vendored
3
django-stubs/core/cache/__init__.pyi
vendored
@@ -1,4 +1,3 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache as BaseCache
|
||||
@@ -16,7 +15,7 @@ class CacheHandler:
|
||||
class DefaultCacheProxy:
|
||||
def __getattr__(
|
||||
self, name: str
|
||||
) -> Union[Callable, Dict[str, float], int, OrderedDict]: ...
|
||||
) -> Union[Callable, Dict[str, float], int]: ...
|
||||
def __setattr__(self, name: str, value: Callable) -> None: ...
|
||||
def __delattr__(self, name: Any): ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
|
||||
22
django-stubs/core/cache/backends/base.pyi
vendored
22
django-stubs/core/cache/backends/base.pyi
vendored
@@ -1,4 +1,3 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
@@ -11,7 +10,7 @@ DEFAULT_TIMEOUT: Any
|
||||
MEMCACHE_MAX_KEY_LENGTH: int
|
||||
|
||||
def default_key_func(
|
||||
key: Union[str, int], key_prefix: str, version: Union[str, int]
|
||||
key: Union[int, str], key_prefix: str, version: Union[int, str]
|
||||
) -> str: ...
|
||||
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
|
||||
|
||||
@@ -22,11 +21,17 @@ class BaseCache:
|
||||
key_func: Callable = ...
|
||||
def __init__(
|
||||
self,
|
||||
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
|
||||
params: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, Dict[str, int]],
|
||||
Dict[str, None],
|
||||
Dict[str, int],
|
||||
Dict[str, str],
|
||||
],
|
||||
) -> None: ...
|
||||
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
|
||||
def make_key(
|
||||
self, key: Union[str, int], version: Optional[Union[str, int]] = ...
|
||||
self, key: Union[int, str], version: Optional[Union[int, str]] = ...
|
||||
) -> str: ...
|
||||
def add(
|
||||
self,
|
||||
@@ -54,14 +59,14 @@ class BaseCache:
|
||||
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
|
||||
def get_many(
|
||||
self, keys: List[str], version: Optional[int] = ...
|
||||
) -> Dict[str, Union[str, int]]: ...
|
||||
) -> Union[Dict[str, int], Dict[str, str]]: ...
|
||||
def get_or_set(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[Callable, int, str]],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
def has_key(self, key: Any, version: Optional[Any] = ...): ...
|
||||
def incr(
|
||||
self, key: str, delta: int = ..., version: Optional[int] = ...
|
||||
@@ -73,13 +78,12 @@ class BaseCache:
|
||||
def set_many(
|
||||
self,
|
||||
data: Union[
|
||||
Dict[str, bytes],
|
||||
Dict[str, Union[Dict[str, int], str]],
|
||||
Dict[str, bytes],
|
||||
Dict[str, int],
|
||||
OrderedDict,
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[Union[str, int]] = ...,
|
||||
version: Optional[Union[int, str]] = ...,
|
||||
) -> List[Any]: ...
|
||||
def delete_many(
|
||||
self, keys: Union[Dict[str, str], List[str]], version: None = ...
|
||||
|
||||
62
django-stubs/core/cache/backends/db.pyi
vendored
62
django-stubs/core/cache/backends/db.pyi
vendored
@@ -1,6 +1,9 @@
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
|
||||
class Options:
|
||||
@@ -25,7 +28,12 @@ class BaseDatabaseCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
table: str,
|
||||
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
|
||||
params: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, Dict[str, int]],
|
||||
Dict[str, int],
|
||||
Dict[str, str],
|
||||
],
|
||||
) -> None: ...
|
||||
|
||||
class DatabaseCache(BaseDatabaseCache):
|
||||
@@ -36,20 +44,62 @@ class DatabaseCache(BaseDatabaseCache):
|
||||
def get(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
) -> Optional[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
List[Any],
|
||||
bytes,
|
||||
Model,
|
||||
QuerySet,
|
||||
HttpResponse,
|
||||
int,
|
||||
str,
|
||||
]
|
||||
]: ...
|
||||
def set(
|
||||
self,
|
||||
key: str,
|
||||
value: Any,
|
||||
value: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
List[Any],
|
||||
bytes,
|
||||
Model,
|
||||
QuerySet,
|
||||
HttpResponse,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[int, bytes, str, Dict[str, int]],
|
||||
value: Union[Dict[str, int], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
|
||||
10
django-stubs/core/cache/backends/dummy.pyi
vendored
10
django-stubs/core/cache/backends/dummy.pyi
vendored
@@ -22,20 +22,20 @@ class DummyCache(BaseCache):
|
||||
self,
|
||||
key: str,
|
||||
value: Union[
|
||||
str,
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
str,
|
||||
int,
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Dict[str, int],
|
||||
Callable,
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[str] = ...,
|
||||
|
||||
38
django-stubs/core/cache/backends/filebased.pyi
vendored
38
django-stubs/core/cache/backends/filebased.pyi
vendored
@@ -1,6 +1,9 @@
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
|
||||
class FileBasedCache(BaseCache):
|
||||
@@ -12,25 +15,50 @@ class FileBasedCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
dir: str,
|
||||
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
|
||||
params: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, Dict[str, int]],
|
||||
Dict[str, int],
|
||||
Dict[str, str],
|
||||
],
|
||||
) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[int, bytes, str, Dict[str, int]],
|
||||
value: Union[Dict[str, int], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> bool: ...
|
||||
def get(
|
||||
self,
|
||||
key: str,
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Optional[str]: ...
|
||||
def set(
|
||||
self,
|
||||
key: str,
|
||||
value: Any,
|
||||
value: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
List[Any],
|
||||
bytes,
|
||||
Model,
|
||||
QuerySet,
|
||||
HttpResponse,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
|
||||
68
django-stubs/core/cache/backends/locmem.pyi
vendored
68
django-stubs/core/cache/backends/locmem.pyi
vendored
@@ -1,7 +1,10 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.http.response import HttpResponse
|
||||
|
||||
|
||||
class LocMemCache(BaseCache):
|
||||
@@ -12,27 +15,74 @@ class LocMemCache(BaseCache):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
|
||||
params: Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, Dict[str, int]],
|
||||
Dict[str, None],
|
||||
Dict[str, int],
|
||||
Dict[str, str],
|
||||
],
|
||||
) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[
|
||||
Dict[str, Union[str, datetime]], int, bytes, str, Dict[str, int]
|
||||
Dict[str, Union[datetime, str]], Dict[str, int], bytes, int, str
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
def get(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
default: Optional[Union[str, int]] = ...,
|
||||
key: Union[int, str],
|
||||
default: Optional[Union[int, str]] = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
) -> Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
List[str],
|
||||
bytes,
|
||||
Model,
|
||||
QuerySet,
|
||||
HttpResponse,
|
||||
int,
|
||||
str,
|
||||
]: ...
|
||||
def set(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
value: Any,
|
||||
key: Union[int, str],
|
||||
value: Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Callable,
|
||||
Dict[str, int],
|
||||
List[int],
|
||||
Tuple[int, int, int, int],
|
||||
Type[Any],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[datetime, str]],
|
||||
List[str],
|
||||
bytes,
|
||||
Model,
|
||||
QuerySet,
|
||||
HttpResponse,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
@@ -41,7 +91,7 @@ class LocMemCache(BaseCache):
|
||||
) -> Any: ...
|
||||
def incr(
|
||||
self,
|
||||
key: Union[str, int],
|
||||
key: Union[int, str],
|
||||
delta: int = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> int: ...
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any, Callable, Optional, Type, Union
|
||||
|
||||
from django.contrib.admin.options import ModelAdmin
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.manager import Manager
|
||||
|
||||
DEBUG: int
|
||||
INFO: int
|
||||
@@ -17,10 +23,19 @@ class CheckMessage:
|
||||
level: int,
|
||||
msg: str,
|
||||
hint: Optional[str] = ...,
|
||||
obj: Any = ...,
|
||||
obj: Optional[
|
||||
Union[
|
||||
Callable,
|
||||
Type[Union[ModelAdmin, Model]],
|
||||
GenericForeignKey,
|
||||
Field,
|
||||
Manager,
|
||||
str,
|
||||
]
|
||||
] = ...,
|
||||
id: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def __eq__(self, other: Union[str, CheckMessage]) -> bool: ...
|
||||
def __eq__(self, other: Union[CheckMessage, str]) -> bool: ...
|
||||
def is_serious(self, level: int = ...) -> bool: ...
|
||||
def is_silenced(self) -> bool: ...
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Any, Callable, List, Optional, Set, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.contrib.admin.apps import SimpleAdminConfig
|
||||
from django.contrib.auth.apps import AuthConfig
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
|
||||
@@ -27,10 +28,10 @@ class CheckRegistry:
|
||||
) -> Callable: ...
|
||||
def run_checks(
|
||||
self,
|
||||
app_configs: Optional[List[AppConfig]] = ...,
|
||||
app_configs: Optional[List[Union[SimpleAdminConfig, AuthConfig]]] = ...,
|
||||
tags: Optional[List[str]] = ...,
|
||||
include_deployment_checks: bool = ...,
|
||||
) -> Union[List[int], List[CheckMessage], List[str]]: ...
|
||||
) -> Union[List[CheckMessage], List[int], List[str]]: ...
|
||||
def tag_exists(
|
||||
self, tag: str, include_deployment_checks: bool = ...
|
||||
) -> bool: ...
|
||||
|
||||
@@ -8,7 +8,7 @@ def check_url_config(
|
||||
app_configs: None, **kwargs: Any
|
||||
) -> List[CheckMessage]: ...
|
||||
def check_resolver(
|
||||
resolver: Union[URLResolver, Tuple[str, Callable], URLPattern]
|
||||
resolver: Union[Tuple[str, Callable], URLPattern, URLResolver]
|
||||
) -> List[CheckMessage]: ...
|
||||
def check_url_namespaces_unique(
|
||||
app_configs: None, **kwargs: Any
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from typing import (Any, Dict, Iterable, Iterator, List, Optional, Tuple, Type,
|
||||
Union)
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.forms.utils import ErrorDict
|
||||
|
||||
|
||||
class FieldDoesNotExist(Exception): ...
|
||||
@@ -35,12 +33,18 @@ class ValidationError(Exception):
|
||||
params: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
message: Iterable,
|
||||
message: Union[
|
||||
Dict[str, List[ValidationError]],
|
||||
Dict[str, Union[List[str], str]],
|
||||
List[Union[ValidationError, str]],
|
||||
ValidationError,
|
||||
str,
|
||||
],
|
||||
code: Optional[str] = ...,
|
||||
params: Optional[
|
||||
Union[
|
||||
Dict[str, Union[Tuple[str], Type[Model], Model, str]],
|
||||
Dict[str, Union[int, str]],
|
||||
Dict[str, Union[Model, Type[Model], str, Tuple[str]]],
|
||||
]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
@@ -49,8 +53,8 @@ class ValidationError(Exception):
|
||||
@property
|
||||
def messages(self) -> List[str]: ...
|
||||
def update_error_dict(
|
||||
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
|
||||
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
|
||||
def __iter__(self) -> Iterator[Union[str, Tuple[str, List[str]]]]: ...
|
||||
self, error_dict: Dict[str, List[ValidationError]]
|
||||
) -> Dict[str, List[ValidationError]]: ...
|
||||
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...
|
||||
|
||||
class EmptyResultSet(Exception): ...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
from http.client import HTTPResponse
|
||||
from io import (BufferedRandom, BufferedReader, BufferedWriter, BytesIO,
|
||||
StringIO, TextIOWrapper)
|
||||
from tempfile import SpooledTemporaryFile, _TemporaryFileWrapper
|
||||
from typing import Any, Iterator, Optional, Union
|
||||
|
||||
from django.core.files.utils import FileProxyMixin
|
||||
@@ -8,15 +12,31 @@ class File(FileProxyMixin):
|
||||
file: _io.BufferedReader = ...
|
||||
name: str = ...
|
||||
mode: str = ...
|
||||
def __init__(self, file: Any, name: Optional[str] = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Optional[
|
||||
Union[
|
||||
BufferedRandom,
|
||||
BufferedReader,
|
||||
BufferedWriter,
|
||||
BytesIO,
|
||||
StringIO,
|
||||
TextIOWrapper,
|
||||
HTTPResponse,
|
||||
SpooledTemporaryFile,
|
||||
_TemporaryFileWrapper,
|
||||
]
|
||||
],
|
||||
name: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def size(self) -> int: ...
|
||||
def chunks(
|
||||
self, chunk_size: Optional[int] = ...
|
||||
) -> Iterator[Union[str, bytes]]: ...
|
||||
) -> Iterator[Union[bytes, str]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
def __iter__(self) -> Iterator[Union[str, bytes]]: ...
|
||||
def __iter__(self) -> Iterator[Union[bytes, str]]: ...
|
||||
def __enter__(self) -> File: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, tb: None) -> None: ...
|
||||
def open(self, mode: Optional[str] = ...) -> File: ...
|
||||
@@ -27,7 +47,7 @@ class ContentFile(File):
|
||||
name: None
|
||||
size: Any = ...
|
||||
def __init__(
|
||||
self, content: Union[str, bytes], name: Optional[str] = ...
|
||||
self, content: Union[bytes, str], name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def open(self, mode: Optional[str] = ...) -> ContentFile: ...
|
||||
@@ -35,5 +55,5 @@ class ContentFile(File):
|
||||
def write(self, data: str) -> int: ...
|
||||
|
||||
def endswith_cr(line: bytes) -> bool: ...
|
||||
def endswith_lf(line: Union[str, bytes]) -> bool: ...
|
||||
def endswith_lf(line: Union[bytes, str]) -> bool: ...
|
||||
def equals_lf(line: bytes) -> bool: ...
|
||||
|
||||
@@ -14,6 +14,6 @@ class ImageFile(File):
|
||||
def height(self) -> int: ...
|
||||
|
||||
def get_image_dimensions(
|
||||
file_or_path: Union[BytesIO, BufferedReader, str, ImageFile],
|
||||
file_or_path: Union[BufferedReader, BytesIO, ImageFile, str],
|
||||
close: bool = ...,
|
||||
) -> Any: ...
|
||||
|
||||
@@ -13,5 +13,5 @@ class _OFFSET(Structure): ...
|
||||
class _OFFSET_UNION(Union): ...
|
||||
class OVERLAPPED(Structure): ...
|
||||
|
||||
def lock(f: Union[TextIOWrapper, BufferedRandom, int], flags: int) -> bool: ...
|
||||
def lock(f: Union[BufferedRandom, TextIOWrapper, int], flags: int) -> bool: ...
|
||||
def unlock(f: Union[BufferedRandom, int]) -> bool: ...
|
||||
|
||||
@@ -11,7 +11,7 @@ class Storage:
|
||||
def save(
|
||||
self,
|
||||
name: Optional[str],
|
||||
content: Union[TextIOWrapper, StringIO, File],
|
||||
content: Union[StringIO, TextIOWrapper, File],
|
||||
max_length: Optional[int] = ...,
|
||||
) -> str: ...
|
||||
def get_valid_name(self, name: str) -> str: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class UploadedFile(File):
|
||||
content_type_extra: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Optional[Union[_TemporaryFileWrapper, StringIO, BytesIO]] = ...,
|
||||
file: Optional[Union[BytesIO, StringIO, _TemporaryFileWrapper]] = ...,
|
||||
name: str = ...,
|
||||
content_type: str = ...,
|
||||
size: Optional[int] = ...,
|
||||
@@ -41,7 +41,7 @@ class InMemoryUploadedFile(UploadedFile):
|
||||
field_name: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[StringIO, BytesIO],
|
||||
file: Union[BytesIO, StringIO],
|
||||
field_name: Optional[str],
|
||||
name: str,
|
||||
content_type: str,
|
||||
@@ -50,7 +50,7 @@ class InMemoryUploadedFile(UploadedFile):
|
||||
content_type_extra: Optional[Dict[str, bytes]] = ...,
|
||||
) -> None: ...
|
||||
def open(self, mode: Optional[str] = ...) -> InMemoryUploadedFile: ...
|
||||
def chunks(self, chunk_size: None = ...) -> Iterator[Union[str, bytes]]: ...
|
||||
def chunks(self, chunk_size: None = ...) -> Iterator[Union[bytes, str]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
@@ -58,7 +58,7 @@ class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
content: Optional[Union[str, bytes]],
|
||||
content: Optional[Union[bytes, str]],
|
||||
content_type: str = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from io import BytesIO
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from typing import Any, Dict, Optional, Tuple, Union
|
||||
|
||||
from django.core.files.uploadedfile import (InMemoryUploadedFile,
|
||||
TemporaryUploadedFile)
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.test.client import FakePayload
|
||||
|
||||
|
||||
class UploadFileException(Exception): ...
|
||||
@@ -26,8 +27,13 @@ class FileUploadHandler:
|
||||
def __init__(self, request: Optional[WSGIRequest] = ...) -> None: ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: Union[WSGIRequest, BytesIO],
|
||||
META: Dict[str, Any],
|
||||
input_data: Union[BytesIO, WSGIRequest],
|
||||
META: Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
encoding: str = ...,
|
||||
@@ -68,8 +74,13 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
activated: Any = ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: Union[WSGIRequest, BytesIO],
|
||||
META: Dict[str, Any],
|
||||
input_data: Union[BytesIO, WSGIRequest],
|
||||
META: Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
encoding: str = ...,
|
||||
|
||||
@@ -16,7 +16,7 @@ def get_exception_response(
|
||||
resolver: URLResolver,
|
||||
status_code: int,
|
||||
exception: Union[
|
||||
MultiPartParserError, PermissionDenied, SuspiciousOperation, Http404
|
||||
PermissionDenied, SuspiciousOperation, MultiPartParserError, Http404
|
||||
],
|
||||
sender: None = ...,
|
||||
) -> HttpResponse: ...
|
||||
|
||||
@@ -16,7 +16,7 @@ class LimitedStream:
|
||||
buf_size: int = ...
|
||||
def __init__(
|
||||
self,
|
||||
stream: Union[str, FakePayload, BytesIO],
|
||||
stream: Union[BytesIO, FakePayload, str],
|
||||
limit: int,
|
||||
buf_size: int = ...,
|
||||
) -> None: ...
|
||||
@@ -29,11 +29,11 @@ class WSGIRequest(HttpRequest):
|
||||
environ: Dict[
|
||||
str,
|
||||
Union[
|
||||
str,
|
||||
Tuple[int, int],
|
||||
django.test.client.FakePayload,
|
||||
_io.BytesIO,
|
||||
django.test.client.FakePayload,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
] = ...
|
||||
path_info: str = ...
|
||||
@@ -41,17 +41,38 @@ class WSGIRequest(HttpRequest):
|
||||
META: Dict[
|
||||
str,
|
||||
Union[
|
||||
str,
|
||||
Tuple[int, int],
|
||||
django.test.client.FakePayload,
|
||||
_io.BytesIO,
|
||||
django.test.client.FakePayload,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
] = ...
|
||||
method: str = ...
|
||||
encoding: Any = ...
|
||||
resolver_match: None = ...
|
||||
def __init__(self, environ: Dict[str, Any]) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
environ: Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Tuple[int, int], BytesIO, FakePayload, int, str]
|
||||
],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str],
|
||||
Tuple[int, int],
|
||||
BytesIO,
|
||||
FakePayload,
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
],
|
||||
) -> None: ...
|
||||
def GET(self) -> QueryDict: ...
|
||||
def COOKIES(self) -> Dict[str, str]: ...
|
||||
@property
|
||||
@@ -64,16 +85,68 @@ class WSGIHandler(base.BaseHandler):
|
||||
def __call__(
|
||||
self,
|
||||
environ: Dict[
|
||||
str, Union[str, Tuple[int, int], FakePayload, BytesIO, int]
|
||||
str, Union[Tuple[int, int], BytesIO, FakePayload, int, str]
|
||||
],
|
||||
start_response: Callable,
|
||||
) -> HttpResponse: ...
|
||||
|
||||
def get_path_info(environ: Dict[str, Any]) -> str: ...
|
||||
def get_script_name(environ: Dict[str, Any]) -> str: ...
|
||||
def get_path_info(
|
||||
environ: Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Tuple[int, int], BytesIO, FakePayload, int, str]],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
]
|
||||
) -> str: ...
|
||||
def get_script_name(
|
||||
environ: Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Tuple[int, int], BytesIO, FakePayload, int, str]],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
]
|
||||
) -> str: ...
|
||||
def get_bytes_from_wsgi(
|
||||
environ: Dict[str, Any], key: str, default: str
|
||||
environ: Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Tuple[int, int], BytesIO, FakePayload, int, str]],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
],
|
||||
key: str,
|
||||
default: str,
|
||||
) -> bytes: ...
|
||||
def get_str_from_wsgi(
|
||||
environ: Dict[str, Any], key: str, default: str
|
||||
environ: Union[
|
||||
Dict[
|
||||
str,
|
||||
Optional[Union[Tuple[int, int], BytesIO, FakePayload, int, str]],
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, str], Tuple[int, int], BytesIO, FakePayload, int, str
|
||||
],
|
||||
],
|
||||
],
|
||||
key: str,
|
||||
default: str,
|
||||
) -> str: ...
|
||||
|
||||
@@ -10,5 +10,5 @@ class EmailBackend(BaseEmailBackend):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def write_message(self, message: EmailMessage) -> None: ...
|
||||
def send_messages(
|
||||
self, email_messages: Union[List[EmailMessage], Iterator[Any]]
|
||||
self, email_messages: Union[Iterator[Any], List[EmailMessage]]
|
||||
) -> int: ...
|
||||
|
||||
@@ -8,5 +8,5 @@ class EmailBackend(BaseEmailBackend):
|
||||
fail_silently: bool
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def send_messages(
|
||||
self, messages: Union[List[EmailMessage], Iterator[Any]]
|
||||
self, messages: Union[Iterator[Any], List[EmailMessage]]
|
||||
) -> int: ...
|
||||
|
||||
@@ -36,5 +36,5 @@ class EmailBackend(BaseEmailBackend):
|
||||
def open(self) -> Optional[bool]: ...
|
||||
def close(self) -> None: ...
|
||||
def send_messages(
|
||||
self, email_messages: Union[List[EmailMessage], Iterator[Any]]
|
||||
self, email_messages: Union[Iterator[Any], List[EmailMessage]]
|
||||
) -> int: ...
|
||||
|
||||
@@ -19,7 +19,7 @@ def forbid_multi_line_headers(
|
||||
) -> Tuple[str, str]: ...
|
||||
def split_addr(addr: str, encoding: str) -> Tuple[str, str]: ...
|
||||
def sanitize_address(
|
||||
addr: Union[str, Tuple[str, str]], encoding: str
|
||||
addr: Union[Tuple[str, str], str], encoding: str
|
||||
) -> str: ...
|
||||
|
||||
class MIMEMixin:
|
||||
@@ -80,15 +80,15 @@ class EmailMessage:
|
||||
subject: str = ...,
|
||||
body: Optional[str] = ...,
|
||||
from_email: Optional[str] = ...,
|
||||
to: Optional[Union[List[str], str, Tuple[str, str]]] = ...,
|
||||
bcc: Optional[Union[str, List[str], Tuple[str]]] = ...,
|
||||
to: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
||||
bcc: Optional[Union[List[str], Tuple[str], str]] = ...,
|
||||
connection: Optional[BaseEmailBackend] = ...,
|
||||
attachments: Optional[
|
||||
Union[List[MIMEText], List[Tuple[str, str]]]
|
||||
Union[List[Tuple[str, str]], List[MIMEText]]
|
||||
] = ...,
|
||||
headers: Optional[Dict[str, str]] = ...,
|
||||
cc: Optional[Union[str, List[str], Tuple[str, str]]] = ...,
|
||||
reply_to: Optional[Union[str, List[Union[str, None]]]] = ...,
|
||||
cc: Optional[Union[List[str], Tuple[str, str], str]] = ...,
|
||||
reply_to: Optional[Union[List[Optional[str]], str]] = ...,
|
||||
) -> None: ...
|
||||
def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ...
|
||||
def message(self) -> MIMEMixin: ...
|
||||
@@ -96,8 +96,8 @@ class EmailMessage:
|
||||
def send(self, fail_silently: bool = ...) -> int: ...
|
||||
def attach(
|
||||
self,
|
||||
filename: Optional[Union[str, MIMEText]] = ...,
|
||||
content: Optional[Union[bytes, str, SafeMIMEText, EmailMessage]] = ...,
|
||||
filename: Optional[Union[MIMEText, str]] = ...,
|
||||
content: Optional[Union[bytes, EmailMessage, SafeMIMEText, str]] = ...,
|
||||
mimetype: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def attach_file(self, path: str, mimetype: Optional[str] = ...) -> None: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ def find_commands(management_dir: str) -> List[str]: ...
|
||||
def load_command_class(app_name: str, name: str) -> BaseCommand: ...
|
||||
def get_commands() -> Dict[str, str]: ...
|
||||
def call_command(
|
||||
command_name: Union[str, BaseCommand, Tuple[str]],
|
||||
command_name: Union[Tuple[str], BaseCommand, str],
|
||||
*args: Any,
|
||||
**options: Any
|
||||
) -> Optional[str]: ...
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from argparse import Action, ArgumentParser, HelpFormatter, Namespace
|
||||
from argparse import (ArgumentParser, HelpFormatter, Namespace, _AppendAction,
|
||||
_HelpAction, _StoreAction, _StoreFalseAction,
|
||||
_StoreTrueAction, _VersionAction)
|
||||
from io import StringIO, TextIOBase, TextIOWrapper
|
||||
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.contrib.admin.apps import SimpleAdminConfig
|
||||
from django.contrib.auth.apps import AuthConfig
|
||||
|
||||
|
||||
class CommandError(Exception): ...
|
||||
@@ -34,9 +37,34 @@ def no_translations(handle_func: Callable) -> Callable: ...
|
||||
class DjangoHelpFormatter(HelpFormatter):
|
||||
show_last: Any = ...
|
||||
def add_usage(
|
||||
self, usage: None, actions: List[Action], *args: Any, **kwargs: Any
|
||||
self,
|
||||
usage: None,
|
||||
actions: List[
|
||||
Union[
|
||||
_AppendAction,
|
||||
_HelpAction,
|
||||
_StoreAction,
|
||||
_StoreFalseAction,
|
||||
_StoreTrueAction,
|
||||
_VersionAction,
|
||||
]
|
||||
],
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def add_arguments(
|
||||
self,
|
||||
actions: List[
|
||||
Union[
|
||||
_AppendAction,
|
||||
_HelpAction,
|
||||
_StoreAction,
|
||||
_StoreFalseAction,
|
||||
_StoreTrueAction,
|
||||
_VersionAction,
|
||||
]
|
||||
],
|
||||
) -> None: ...
|
||||
def add_arguments(self, actions: List[Action]) -> None: ...
|
||||
|
||||
class OutputWrapper(TextIOBase):
|
||||
@property
|
||||
@@ -85,10 +113,10 @@ class BaseCommand:
|
||||
def run_from_argv(self, argv: List[str]) -> None: ...
|
||||
def execute(
|
||||
self, *args: Any, **options: Any
|
||||
) -> Optional[Union[str, Tuple]]: ...
|
||||
) -> Optional[Union[Tuple, str]]: ...
|
||||
def check(
|
||||
self,
|
||||
app_configs: Optional[List[AppConfig]] = ...,
|
||||
app_configs: Optional[List[Union[SimpleAdminConfig, AuthConfig]]] = ...,
|
||||
tags: Optional[List[str]] = ...,
|
||||
display_num_errors: bool = ...,
|
||||
include_deployment_checks: bool = ...,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from io import StringIO
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.db.backends.base.introspection import FieldInfo
|
||||
@@ -16,7 +17,12 @@ class Command(BaseCommand):
|
||||
db_module: str = ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def handle(self, **options: Any) -> None: ...
|
||||
def handle_inspection(self, options: Dict[str, Any]) -> Iterator[str]: ...
|
||||
def handle_inspection(
|
||||
self,
|
||||
options: Dict[
|
||||
str, Optional[Union[Callable, List[str], StringIO, int, str]]
|
||||
],
|
||||
) -> Iterator[str]: ...
|
||||
def normalize_col_name(
|
||||
self, col_name: str, used_column_names: List[str], is_relation: bool
|
||||
) -> Tuple[str, Dict[str, str], List[str]]: ...
|
||||
@@ -27,7 +33,12 @@ class Command(BaseCommand):
|
||||
self,
|
||||
table_name: str,
|
||||
constraints: Dict[
|
||||
str, Dict[str, Union[str, List[str], bool, Tuple[str, str]]]
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], Tuple[str, str], bool]],
|
||||
Dict[str, Union[List[str], bool, str]],
|
||||
Dict[str, Union[List[str], bool]],
|
||||
],
|
||||
],
|
||||
column_to_field_name: Dict[str, str],
|
||||
is_view: bool,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import zipfile
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
from typing import Any, List, Optional, Tuple
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
|
||||
@@ -29,7 +29,7 @@ class Command(BaseCommand):
|
||||
def load_label(self, fixture_label: str) -> None: ...
|
||||
def find_fixtures(
|
||||
self, fixture_label: str
|
||||
) -> Union[List[Tuple[str, None, str]], List[Tuple[str, str, str]]]: ...
|
||||
) -> List[Tuple[str, str, str]]: ...
|
||||
def fixture_dirs(self) -> List[str]: ...
|
||||
def parse_name(
|
||||
self, fixture_name: str
|
||||
|
||||
@@ -12,7 +12,7 @@ class Command(BaseCommand):
|
||||
requires_system_checks: bool = ...
|
||||
shells: Any = ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def ipython(self, options: Dict[str, Optional[Union[str, int]]]) -> Any: ...
|
||||
def bpython(self, options: Dict[str, Optional[Union[str, int]]]) -> Any: ...
|
||||
def ipython(self, options: Dict[str, Optional[Union[int, str]]]) -> Any: ...
|
||||
def bpython(self, options: Dict[str, Optional[Union[int, str]]]) -> Any: ...
|
||||
def python(self, options: Any) -> None: ...
|
||||
def handle(self, **options: Any) -> None: ...
|
||||
|
||||
@@ -18,15 +18,17 @@ class Paginator:
|
||||
def __init__(
|
||||
self,
|
||||
object_list: Union[
|
||||
QuerySet, List[int], List[Dict[str, str]], str, List[Model]
|
||||
List[Dict[str, str]], List[Model], List[int], QuerySet, str
|
||||
],
|
||||
per_page: Union[str, int],
|
||||
per_page: Union[int, str],
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
) -> None: ...
|
||||
def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
|
||||
def validate_number(
|
||||
self, number: Optional[Union[float, int, str]]
|
||||
) -> int: ...
|
||||
def get_page(self, number: Optional[int]) -> Page: ...
|
||||
def page(self, number: Union[str, int]) -> Page: ...
|
||||
def page(self, number: Union[int, str]) -> Page: ...
|
||||
def count(self) -> int: ...
|
||||
def num_pages(self) -> int: ...
|
||||
@property
|
||||
@@ -41,13 +43,13 @@ class Page(collections.abc.Sequence):
|
||||
def __init__(
|
||||
self,
|
||||
object_list: Union[
|
||||
QuerySet, List[int], List[Dict[str, str]], str, List[Model]
|
||||
List[Dict[str, str]], List[Model], List[int], QuerySet, str
|
||||
],
|
||||
number: int,
|
||||
paginator: Paginator,
|
||||
) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, index: Union[str, int]) -> Union[Model, str]: ...
|
||||
def __getitem__(self, index: Union[int, str]) -> Union[Model, str]: ...
|
||||
def has_next(self) -> bool: ...
|
||||
def has_previous(self) -> bool: ...
|
||||
def has_other_pages(self) -> bool: ...
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from collections import OrderedDict
|
||||
from gzip import GzipFile
|
||||
from io import BufferedReader, StringIO, TextIOWrapper
|
||||
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
|
||||
Union)
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.core.management.commands.loaddata import SingleZipReader
|
||||
from django.core.serializers.python import Serializer
|
||||
from django.core.serializers.xml_serializer import Deserializer, Serializer
|
||||
from django.db.models.base import Model
|
||||
@@ -30,14 +33,22 @@ def get_public_serializer_formats() -> List[str]: ...
|
||||
def get_deserializer(format: str) -> Union[Callable, Type[Deserializer]]: ...
|
||||
def serialize(
|
||||
format: str,
|
||||
queryset: Union[QuerySet, List[Model], Iterator[Any]],
|
||||
queryset: Union[Iterator[Any], List[Model], QuerySet],
|
||||
**options: Any
|
||||
) -> Optional[Union[str, bytes, List[OrderedDict]]]: ...
|
||||
) -> Optional[Union[List[OrderedDict], bytes, str]]: ...
|
||||
def deserialize(
|
||||
format: str, stream_or_string: Any, **options: Any
|
||||
) -> Union[Deserializer, Iterator[Any]]: ...
|
||||
format: str,
|
||||
stream_or_string: Union[
|
||||
List[OrderedDict],
|
||||
BufferedReader,
|
||||
StringIO,
|
||||
TextIOWrapper,
|
||||
SingleZipReader,
|
||||
GzipFile,
|
||||
str,
|
||||
],
|
||||
**options: Any
|
||||
) -> Union[Iterator[Any], Deserializer]: ...
|
||||
def sort_dependencies(
|
||||
app_list: Union[
|
||||
List[Tuple[str, List[Type[Model]]]], List[Tuple[AppConfig, None]]
|
||||
]
|
||||
app_list: List[Union[Tuple[AppConfig, None], Tuple[str, List[Type[Model]]]]]
|
||||
) -> List[Type[Model]]: ...
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from decimal import Decimal
|
||||
from io import BufferedReader, StringIO, TextIOWrapper
|
||||
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
|
||||
from uuid import UUID
|
||||
@@ -18,10 +20,10 @@ class DeserializationError(Exception):
|
||||
@classmethod
|
||||
def WithData(
|
||||
cls,
|
||||
original_exc: Union[ValidationError, ObjectDoesNotExist],
|
||||
original_exc: Union[ObjectDoesNotExist, ValidationError],
|
||||
model: str,
|
||||
fk: Union[str, int],
|
||||
field_value: Optional[Union[str, List[str]]],
|
||||
fk: Union[int, str],
|
||||
field_value: Optional[Union[List[str], str]],
|
||||
) -> DeserializationError: ...
|
||||
|
||||
class M2MDeserializationError(Exception):
|
||||
@@ -29,8 +31,8 @@ class M2MDeserializationError(Exception):
|
||||
pk: List[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
original_exc: Union[ValidationError, ObjectDoesNotExist],
|
||||
pk: Union[str, List[str]],
|
||||
original_exc: Union[ObjectDoesNotExist, ValidationError],
|
||||
pk: Union[List[str], str],
|
||||
) -> None: ...
|
||||
|
||||
class ProgressBar:
|
||||
@@ -55,7 +57,7 @@ class Serializer:
|
||||
first: bool = ...
|
||||
def serialize(
|
||||
self,
|
||||
queryset: Union[QuerySet, List[Model], Iterator[Any]],
|
||||
queryset: Union[Iterator[Any], List[Model], QuerySet],
|
||||
*,
|
||||
stream: Optional[Any] = ...,
|
||||
fields: Optional[Any] = ...,
|
||||
@@ -64,7 +66,7 @@ class Serializer:
|
||||
progress_output: Optional[Any] = ...,
|
||||
object_count: int = ...,
|
||||
**options: Any
|
||||
) -> Optional[Union[str, bytes, List[OrderedDict]]]: ...
|
||||
) -> Optional[Union[List[OrderedDict], bytes, str]]: ...
|
||||
def start_serialization(self) -> None: ...
|
||||
def end_serialization(self) -> None: ...
|
||||
def start_object(self, obj: Any) -> None: ...
|
||||
@@ -72,14 +74,14 @@ class Serializer:
|
||||
def handle_field(self, obj: Any, field: Any) -> None: ...
|
||||
def handle_fk_field(self, obj: Any, field: Any) -> None: ...
|
||||
def handle_m2m_field(self, obj: Any, field: Any) -> None: ...
|
||||
def getvalue(self) -> Optional[Union[str, bytes]]: ...
|
||||
def getvalue(self) -> Optional[Union[bytes, str]]: ...
|
||||
|
||||
class Deserializer:
|
||||
options: Any = ...
|
||||
stream: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
stream_or_string: Union[str, TextIOWrapper, BufferedReader],
|
||||
stream_or_string: Union[BufferedReader, TextIOWrapper, str],
|
||||
**options: Any
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Deserializer: ...
|
||||
@@ -89,14 +91,29 @@ class DeserializedObject:
|
||||
object: django.db.models.base.Model = ...
|
||||
m2m_data: Dict[Any, Any] = ...
|
||||
def __init__(
|
||||
self, obj: Model, m2m_data: Optional[Dict[str, List[int]]] = ...
|
||||
self,
|
||||
obj: Model,
|
||||
m2m_data: Optional[Dict[str, Union[List[Any], List[int]]]] = ...,
|
||||
) -> None: ...
|
||||
def save(
|
||||
self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
def build_instance(
|
||||
Model: Type[Model], data: Dict[str, Any], db: str
|
||||
Model: Type[Model],
|
||||
data: Union[
|
||||
Dict[str, Optional[Union[int, str]]],
|
||||
Dict[str, Optional[datetime]],
|
||||
Dict[str, Optional[timedelta]],
|
||||
Dict[str, Optional[UUID]],
|
||||
Dict[str, Union[date, int, str]],
|
||||
Dict[str, Union[time, int]],
|
||||
Dict[str, Union[Decimal, int, str]],
|
||||
Dict[str, Union[float, int, str]],
|
||||
Dict[str, Union[int, memoryview]],
|
||||
Dict[str, Union[int, UUID]],
|
||||
],
|
||||
db: str,
|
||||
) -> Model: ...
|
||||
def deserialize_m2m_values(
|
||||
field: ManyToManyField,
|
||||
@@ -105,6 +122,6 @@ def deserialize_m2m_values(
|
||||
) -> List[int]: ...
|
||||
def deserialize_fk_value(
|
||||
field: ForeignKey,
|
||||
field_value: Optional[Union[int, Tuple[str], str, List[str]]],
|
||||
field_value: Optional[Union[List[str], Tuple[str], int, str]],
|
||||
using: str,
|
||||
) -> Optional[Union[str, UUID, int]]: ...
|
||||
) -> Optional[Union[int, str, UUID]]: ...
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import json
|
||||
from datetime import date, time, timedelta
|
||||
from decimal import Decimal
|
||||
from gzip import GzipFile
|
||||
from io import BufferedReader, StringIO, TextIOWrapper
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.core.management.commands.loaddata import SingleZipReader
|
||||
from django.core.serializers.python import Serializer as PythonSerializer
|
||||
from django.db.models.base import Model
|
||||
|
||||
@@ -21,9 +24,14 @@ class Serializer(PythonSerializer):
|
||||
def start_serialization(self) -> None: ...
|
||||
def end_serialization(self) -> None: ...
|
||||
def end_object(self, obj: Model) -> None: ...
|
||||
def getvalue(self) -> Optional[Union[str, bytes]]: ...
|
||||
def getvalue(self) -> Optional[Union[bytes, str]]: ...
|
||||
|
||||
def Deserializer(stream_or_string: Any, **options: Any) -> None: ...
|
||||
def Deserializer(
|
||||
stream_or_string: Union[
|
||||
BufferedReader, StringIO, TextIOWrapper, SingleZipReader, GzipFile, str
|
||||
],
|
||||
**options: Any
|
||||
) -> None: ...
|
||||
|
||||
class DjangoJSONEncoder(json.JSONEncoder):
|
||||
allow_nan: bool
|
||||
@@ -33,5 +41,5 @@ class DjangoJSONEncoder(json.JSONEncoder):
|
||||
skipkeys: bool
|
||||
sort_keys: bool
|
||||
def default(
|
||||
self, o: Union[time, UUID, Decimal, date, timedelta]
|
||||
self, o: Union[date, time, timedelta, Decimal, UUID]
|
||||
) -> str: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Iterator, List, Optional
|
||||
from datetime import date, datetime
|
||||
from typing import Any, Dict, Iterator, List, Optional, Union
|
||||
|
||||
from django.core.serializers import base
|
||||
from django.core.serializers.base import DeserializedObject
|
||||
@@ -24,10 +25,175 @@ class Serializer(base.Serializer):
|
||||
def handle_field(self, obj: Model, field: Field) -> None: ...
|
||||
def handle_fk_field(self, obj: Model, field: ForeignKey) -> None: ...
|
||||
def handle_m2m_field(self, obj: Model, field: ManyToManyField) -> None: ...
|
||||
def getvalue(self): ...
|
||||
def getvalue(self) -> List[OrderedDict]: ...
|
||||
|
||||
def Deserializer(
|
||||
object_list: List,
|
||||
object_list: Union[
|
||||
List[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[Any], List[int], datetime, int, str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Optional[Union[Dict[str, Optional[str]], str]]],
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[List[str]], List[str], str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str, Optional[Union[Dict[str, Union[float, int, str]], str]]
|
||||
],
|
||||
Dict[str, Optional[Union[Dict[str, str], str]]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[Any, Any], date, str]],
|
||||
Dict[str, Union[Dict[Any, Any], float, str]],
|
||||
Dict[str, Union[Dict[Any, Any], int, str]],
|
||||
Dict[str, Union[Dict[str, List[Any]], int, str]],
|
||||
Dict[str, Union[Dict[str, List[int]], int, str]],
|
||||
Dict[str, Union[Dict[str, None], int, str]],
|
||||
Dict[str, Union[Dict[str, Union[List[Any], List[str]]], str]],
|
||||
Dict[
|
||||
str,
|
||||
Union[Dict[str, Union[List[List[str]], List[str]]], str],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Union[int, str]], int, str]],
|
||||
Dict[str, Union[Dict[str, bool], int, str]],
|
||||
Dict[str, Union[Dict[str, date], int, str]],
|
||||
Dict[str, Union[Dict[str, datetime], int, str]],
|
||||
Dict[str, Union[Dict[str, float], int, str]],
|
||||
Dict[str, Union[Dict[str, int], int, str]],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, List[Any]], int, str]],
|
||||
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, List[str]], int, str]],
|
||||
Dict[str, Union[Dict[str, None], int, str]],
|
||||
Dict[str, Union[Dict[str, Optional[str]], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[Any], List[List[str]], bool, str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[Any], List[int], bool, str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, Union[List[Any], str]], int, str]],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[List[str]], int, str]], int, str
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str, Union[Dict[str, Union[List[List[str]], str]], int, str]
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[Union[int, str]], int, str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[int], datetime, int, str]],
|
||||
int,
|
||||
str,
|
||||
],
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[
|
||||
str, Union[Dict[str, Union[List[int], int, str]], int, str]
|
||||
],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, Union[List[int], str]], int, str]],
|
||||
Dict[str, Union[Dict[str, str], int, str]],
|
||||
]
|
||||
],
|
||||
List[
|
||||
Union[
|
||||
Dict[str, Union[Dict[str, Union[List[str], str]], int, str]],
|
||||
Dict[str, Union[Dict[str, str], str]],
|
||||
]
|
||||
],
|
||||
],
|
||||
*,
|
||||
using: Any = ...,
|
||||
ignorenonexistent: bool = ...,
|
||||
|
||||
@@ -46,9 +46,9 @@ class DjangoSafeDumper(SafeDumper):
|
||||
represented_objects: Dict[
|
||||
int,
|
||||
Union[
|
||||
yaml.nodes.SequenceNode,
|
||||
yaml.nodes.MappingNode,
|
||||
yaml.nodes.ScalarNode,
|
||||
yaml.nodes.SequenceNode,
|
||||
],
|
||||
]
|
||||
resolver_exact_paths: List[Any]
|
||||
@@ -81,6 +81,6 @@ class Serializer(PythonSerializer):
|
||||
internal_use_only: bool = ...
|
||||
def handle_field(self, obj: Model, field: Field) -> None: ...
|
||||
def end_serialization(self) -> None: ...
|
||||
def getvalue(self) -> Union[str, bytes]: ...
|
||||
def getvalue(self) -> Union[bytes, str]: ...
|
||||
|
||||
def Deserializer(stream_or_string: str, **options: Any) -> None: ...
|
||||
|
||||
@@ -34,7 +34,7 @@ class Deserializer(base.Deserializer):
|
||||
ignore: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
stream_or_string: Union[str, TextIOWrapper, BufferedReader],
|
||||
stream_or_string: Union[BufferedReader, TextIOWrapper, str],
|
||||
*,
|
||||
using: Any = ...,
|
||||
ignorenonexistent: bool = ...,
|
||||
|
||||
@@ -10,31 +10,31 @@ class SignatureExpired(BadSignature): ...
|
||||
def b64_encode(s: bytes) -> bytes: ...
|
||||
def b64_decode(s: bytes) -> bytes: ...
|
||||
def base64_hmac(
|
||||
salt: str, value: Union[str, bytes], key: Union[str, bytes]
|
||||
salt: str, value: Union[bytes, str], key: Union[bytes, str]
|
||||
) -> str: ...
|
||||
def get_cookie_signer(salt: str = ...) -> TimestampSigner: ...
|
||||
|
||||
class JSONSerializer:
|
||||
def dumps(
|
||||
self, obj: Union[Dict[str, Union[str, int]], str, List[str]]
|
||||
self, obj: Union[Dict[str, Union[int, str]], List[str], str]
|
||||
) -> bytes: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[str, int]]: ...
|
||||
def loads(self, data: bytes) -> Dict[str, Union[int, str]]: ...
|
||||
|
||||
def dumps(
|
||||
obj: Union[Dict[str, Union[str, datetime]], str, List[str]],
|
||||
obj: Union[Dict[str, Union[datetime, str]], List[str], str],
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[JSONSerializer, PickleSerializer]] = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
compress: bool = ...,
|
||||
) -> str: ...
|
||||
def loads(
|
||||
s: str,
|
||||
key: None = ...,
|
||||
salt: str = ...,
|
||||
serializer: Type[Union[JSONSerializer, PickleSerializer]] = ...,
|
||||
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
|
||||
max_age: Optional[int] = ...,
|
||||
) -> Union[
|
||||
Dict[str, Union[str, int]], str, Dict[str, Union[str, datetime]], List[str]
|
||||
Dict[str, Union[datetime, str]], Dict[str, Union[int, str]], List[str], str
|
||||
]: ...
|
||||
|
||||
class Signer:
|
||||
@@ -43,11 +43,11 @@ class Signer:
|
||||
salt: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
key: Optional[Union[str, bytes]] = ...,
|
||||
key: Optional[Union[bytes, str]] = ...,
|
||||
sep: str = ...,
|
||||
salt: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def signature(self, value: Union[str, bytes]) -> str: ...
|
||||
def signature(self, value: Union[bytes, str]) -> str: ...
|
||||
def sign(self, value: str) -> str: ...
|
||||
def unsign(self, signed_value: str) -> str: ...
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from typing import Any, Dict, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
EMPTY_VALUES: Any
|
||||
|
||||
@@ -17,15 +16,15 @@ class RegexValidator:
|
||||
flags: int = ...
|
||||
def __init__(
|
||||
self,
|
||||
regex: Optional[Union[str, SimpleLazyObject]] = ...,
|
||||
regex: Optional[str] = ...,
|
||||
message: Optional[str] = ...,
|
||||
code: Optional[str] = ...,
|
||||
inverse_match: Optional[bool] = ...,
|
||||
flags: Optional[RegexFlag] = ...,
|
||||
) -> None: ...
|
||||
def __call__(self, value: Optional[Union[str, float]]) -> None: ...
|
||||
def __call__(self, value: Optional[Union[float, int, str]]) -> None: ...
|
||||
def __eq__(
|
||||
self, other: Union[RegexValidator, ProhibitNullCharactersValidator]
|
||||
self, other: Union[ProhibitNullCharactersValidator, RegexValidator]
|
||||
) -> bool: ...
|
||||
|
||||
class URLValidator(RegexValidator):
|
||||
@@ -46,7 +45,7 @@ class URLValidator(RegexValidator):
|
||||
|
||||
integer_validator: Any
|
||||
|
||||
def validate_integer(value: Optional[Union[float, str]]) -> None: ...
|
||||
def validate_integer(value: Optional[Union[float, int, str]]) -> None: ...
|
||||
|
||||
class EmailValidator:
|
||||
message: Any = ...
|
||||
@@ -93,17 +92,17 @@ class BaseValidator:
|
||||
limit_value: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
limit_value: Optional[Union[Decimal, float, str, datetime]],
|
||||
limit_value: Optional[Union[datetime, Decimal, float, int, str]],
|
||||
message: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def __call__(
|
||||
self, value: Union[Decimal, float, bytes, str, datetime]
|
||||
self, value: Union[bytes, datetime, Decimal, float, int, str]
|
||||
) -> None: ...
|
||||
def __eq__(self, other: BaseValidator) -> bool: ...
|
||||
def compare(self, a: bool, b: bool) -> bool: ...
|
||||
def clean(
|
||||
self, x: Union[Decimal, float, datetime]
|
||||
) -> Union[Decimal, float, datetime]: ...
|
||||
self, x: Union[datetime, Decimal, float, int]
|
||||
) -> Union[datetime, Decimal, float, int]: ...
|
||||
|
||||
class MaxValueValidator(BaseValidator):
|
||||
limit_value: decimal.Decimal
|
||||
@@ -111,8 +110,8 @@ class MaxValueValidator(BaseValidator):
|
||||
code: str = ...
|
||||
def compare(
|
||||
self,
|
||||
a: Union[float, datetime, Decimal],
|
||||
b: Union[Decimal, datetime, float],
|
||||
a: Union[datetime, Decimal, float, int],
|
||||
b: Union[datetime, Decimal, float, int],
|
||||
) -> bool: ...
|
||||
|
||||
class MinValueValidator(BaseValidator):
|
||||
@@ -121,8 +120,8 @@ class MinValueValidator(BaseValidator):
|
||||
code: str = ...
|
||||
def compare(
|
||||
self,
|
||||
a: Union[float, datetime, Decimal],
|
||||
b: Union[float, datetime, Decimal],
|
||||
a: Union[datetime, Decimal, float, int],
|
||||
b: Union[datetime, Decimal, float, int],
|
||||
) -> bool: ...
|
||||
|
||||
class MinLengthValidator(BaseValidator):
|
||||
@@ -137,7 +136,7 @@ class MaxLengthValidator(BaseValidator):
|
||||
message: Any = ...
|
||||
code: str = ...
|
||||
def compare(self, a: int, b: int) -> bool: ...
|
||||
def clean(self, x: Union[str, bytes]) -> int: ...
|
||||
def clean(self, x: Union[bytes, str]) -> int: ...
|
||||
|
||||
class DecimalValidator:
|
||||
messages: Any = ...
|
||||
@@ -145,12 +144,12 @@ class DecimalValidator:
|
||||
decimal_places: int = ...
|
||||
def __init__(
|
||||
self,
|
||||
max_digits: Optional[Union[str, int]],
|
||||
decimal_places: Optional[Union[str, int]],
|
||||
max_digits: Optional[Union[int, str]],
|
||||
decimal_places: Optional[Union[int, str]],
|
||||
) -> None: ...
|
||||
def __call__(self, value: Decimal) -> None: ...
|
||||
def __eq__(
|
||||
self, other: Union[MinValueValidator, DecimalValidator]
|
||||
self, other: Union[DecimalValidator, MinValueValidator]
|
||||
) -> bool: ...
|
||||
|
||||
class FileExtensionValidator:
|
||||
@@ -176,8 +175,8 @@ class ProhibitNullCharactersValidator:
|
||||
self, message: Optional[str] = ..., code: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __call__(
|
||||
self, value: Optional[Union[str, Dict[Any, Any], UUID]]
|
||||
self, value: Optional[Union[Dict[Any, Any], str, UUID]]
|
||||
) -> None: ...
|
||||
def __eq__(
|
||||
self, other: Union[RegexValidator, ProhibitNullCharactersValidator]
|
||||
self, other: Union[ProhibitNullCharactersValidator, RegexValidator]
|
||||
) -> bool: ...
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
from typing import Any, Optional, Union
|
||||
from collections import deque
|
||||
from typing import Any, Callable, Dict, List, Optional, Union
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.sqlite3.creation import DatabaseCreation
|
||||
from django.db.backends.sqlite3.features import DatabaseFeatures
|
||||
from django.db.backends.sqlite3.introspection import DatabaseIntrospection
|
||||
from django.db.backends.sqlite3.operations import DatabaseOperations
|
||||
from django.db.utils import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS
|
||||
from django.db.utils import \
|
||||
DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY
|
||||
@@ -19,7 +24,21 @@ connections: Any
|
||||
router: Any
|
||||
|
||||
class DefaultConnectionProxy:
|
||||
def __getattr__(self, item: str) -> Any: ...
|
||||
def __getattr__(
|
||||
self, item: str
|
||||
) -> Union[
|
||||
Callable,
|
||||
Dict[str, Optional[Union[Dict[Any, Any], Dict[str, None], int, str]]],
|
||||
List[Dict[str, str]],
|
||||
List[str],
|
||||
bool,
|
||||
deque,
|
||||
DatabaseCreation,
|
||||
DatabaseFeatures,
|
||||
DatabaseIntrospection,
|
||||
DatabaseOperations,
|
||||
str,
|
||||
]: ...
|
||||
def __setattr__(self, name: str, value: Union[bool, MagicMock]) -> None: ...
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __eq__(self, other: DatabaseWrapper) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
|
||||
|
||||
from django.db.backends.sqlite3.base import (DatabaseWrapper,
|
||||
SQLiteCursorWrapper)
|
||||
@@ -48,7 +48,9 @@ class BaseDatabaseWrapper:
|
||||
validation: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
settings_dict: Dict[str, Any],
|
||||
settings_dict: Dict[
|
||||
str, Optional[Union[Dict[str, Optional[str]], int, str]]
|
||||
],
|
||||
alias: str = ...,
|
||||
allow_thread_sharing: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -17,7 +17,7 @@ class BaseDatabaseCreation:
|
||||
def set_as_test_mirror(
|
||||
self,
|
||||
primary_settings_dict: Dict[
|
||||
str, Optional[Union[str, int, Dict[str, None]]]
|
||||
str, Optional[Union[Dict[str, None], int, str]]
|
||||
],
|
||||
) -> None: ...
|
||||
def serialize_db_to_string(self) -> str: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class BaseDatabaseIntrospection:
|
||||
def __init__(self, connection: BaseDatabaseWrapper) -> None: ...
|
||||
def get_field_type(
|
||||
self, data_type: str, description: FieldInfo
|
||||
) -> Union[str, Tuple[str, Dict[str, int]]]: ...
|
||||
) -> Union[Tuple[str, Dict[str, int]], str]: ...
|
||||
def table_name_converter(self, name: str) -> str: ...
|
||||
def column_name_converter(self, name: str) -> str: ...
|
||||
def table_names(
|
||||
|
||||
@@ -27,10 +27,7 @@ class BaseDatabaseOperations:
|
||||
explain_prefix: Any = ...
|
||||
connection: django.db.DefaultConnectionProxy = ...
|
||||
def __init__(
|
||||
self,
|
||||
connection: Union[
|
||||
DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper
|
||||
],
|
||||
self, connection: Union[DefaultConnectionProxy, BaseDatabaseWrapper]
|
||||
) -> None: ...
|
||||
def autoinc_sql(self, table: str, column: str) -> None: ...
|
||||
def bulk_batch_size(self, fields: Any, objs: Any): ...
|
||||
@@ -100,7 +97,7 @@ class BaseDatabaseOperations:
|
||||
def sequence_reset_sql(
|
||||
self,
|
||||
style: Style,
|
||||
model_list: Union[Set[Type[Model]], List[Type[Model]]],
|
||||
model_list: Union[List[Type[Model]], Set[Type[Model]]],
|
||||
) -> List[Any]: ...
|
||||
def start_transaction_sql(self) -> str: ...
|
||||
def end_transaction_sql(self, success: bool = ...) -> str: ...
|
||||
@@ -111,8 +108,8 @@ class BaseDatabaseOperations:
|
||||
prep_for_iexact_query: Any = ...
|
||||
def validate_autopk_value(self, value: int) -> int: ...
|
||||
def adapt_unknown_value(
|
||||
self, value: Union[time, int, Decimal, str, date]
|
||||
) -> Union[str, int]: ...
|
||||
self, value: Union[date, time, Decimal, int, str]
|
||||
) -> Union[int, str]: ...
|
||||
def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ...
|
||||
def adapt_datetimefield_value(self, value: None) -> None: ...
|
||||
def adapt_timefield_value(
|
||||
@@ -134,7 +131,7 @@ class BaseDatabaseOperations:
|
||||
def get_db_converters(self, expression: Expression) -> List[Any]: ...
|
||||
def convert_durationfield_value(
|
||||
self,
|
||||
value: Optional[float],
|
||||
value: Optional[Union[float, int]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper,
|
||||
) -> Optional[timedelta]: ...
|
||||
@@ -152,10 +149,10 @@ class BaseDatabaseOperations:
|
||||
self,
|
||||
placeholder: str,
|
||||
params: Union[
|
||||
List[float], List[None], List[bool], List[str], List[memoryview]
|
||||
List[None], List[float], List[int], List[memoryview], List[str]
|
||||
],
|
||||
) -> Union[
|
||||
List[float], List[None], List[bool], List[str], List[memoryview]
|
||||
List[None], List[float], List[int], List[memoryview], List[str]
|
||||
]: ...
|
||||
def integer_field_range(self, internal_type: Any): ...
|
||||
def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any): ...
|
||||
|
||||
@@ -4,7 +4,8 @@ from django.db.backends.ddl_references import Statement
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.fields import Field, IPAddressField
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.indexes import Index
|
||||
|
||||
logger: Any
|
||||
|
||||
@@ -52,40 +53,51 @@ class BaseDatabaseSchemaEditor:
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
def execute(
|
||||
self, sql: Union[str, Statement], params: Optional[Tuple] = ...
|
||||
self,
|
||||
sql: Union[Statement, str],
|
||||
params: Optional[Union[List[int], Tuple]] = ...,
|
||||
) -> None: ...
|
||||
def quote_name(self, name: str) -> str: ...
|
||||
def column_sql(
|
||||
self, model: Type[Model], field: Field, include_default: bool = ...
|
||||
) -> Tuple[str, List[Any]]: ...
|
||||
) -> Union[Tuple[None, None], Tuple[str, List[Any]]]: ...
|
||||
def skip_default(self, field: Any): ...
|
||||
def prepare_default(self, value: Any) -> None: ...
|
||||
def effective_default(self, field: IPAddressField) -> None: ...
|
||||
def effective_default(
|
||||
self, field: Field
|
||||
) -> Optional[Union[int, memoryview, str]]: ...
|
||||
def quote_value(self, value: Any) -> None: ...
|
||||
def create_model(self, model: Type[Model]) -> None: ...
|
||||
def delete_model(self, model: Any) -> None: ...
|
||||
def add_index(self, model: Any, index: Any) -> None: ...
|
||||
def remove_index(self, model: Any, index: Any) -> None: ...
|
||||
def delete_model(self, model: Type[Model]) -> None: ...
|
||||
def add_index(self, model: Type[Model], index: Index) -> None: ...
|
||||
def remove_index(self, model: Type[Model], index: Index) -> None: ...
|
||||
def alter_unique_together(
|
||||
self,
|
||||
model: Type[Model],
|
||||
old_unique_together: List[List[str]],
|
||||
new_unique_together: List[Any],
|
||||
old_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]],
|
||||
new_unique_together: Union[List[List[str]], Tuple[Tuple[str, str]]],
|
||||
) -> None: ...
|
||||
def alter_index_together(
|
||||
self, model: Any, old_index_together: Any, new_index_together: Any
|
||||
self,
|
||||
model: Type[Model],
|
||||
old_index_together: Union[List[List[str]], List[Tuple[str, str]]],
|
||||
new_index_together: Union[List[List[str]], List[Tuple[str, str]]],
|
||||
) -> None: ...
|
||||
def alter_db_table(
|
||||
self, model: Any, old_db_table: Any, new_db_table: Any
|
||||
): ...
|
||||
self, model: Type[Model], old_db_table: str, new_db_table: str
|
||||
) -> None: ...
|
||||
def alter_db_tablespace(
|
||||
self, model: Any, old_db_tablespace: Any, new_db_tablespace: Any
|
||||
) -> None: ...
|
||||
def add_field(self, model: Any, field: Any): ...
|
||||
def remove_field(self, model: Any, field: Any): ...
|
||||
def alter_field(
|
||||
self, model: Any, old_field: Any, new_field: Any, strict: bool = ...
|
||||
): ...
|
||||
self,
|
||||
model: Type[Model],
|
||||
old_field: Field,
|
||||
new_field: Field,
|
||||
strict: bool = ...,
|
||||
) -> None: ...
|
||||
def remove_procedure(
|
||||
self, procedure_name: Any, param_types: Any = ...
|
||||
) -> None: ...
|
||||
|
||||
@@ -39,7 +39,7 @@ class Columns(TableColumns):
|
||||
table: str,
|
||||
columns: List[str],
|
||||
quote_name: Callable,
|
||||
col_suffixes: Union[Tuple, List[str]] = ...,
|
||||
col_suffixes: Union[List[str], Tuple] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class IndexName(TableColumns):
|
||||
|
||||
@@ -54,7 +54,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
run_on_commit: List[Any]
|
||||
savepoint_ids: List[Any]
|
||||
savepoint_state: int
|
||||
settings_dict: Dict[str, Optional[Union[str, int, Dict[str, None]]]]
|
||||
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
|
||||
validation: django.db.backends.base.validation.BaseDatabaseValidation
|
||||
operators: Any = ...
|
||||
ensure_connection: Any = ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from django.db.backends.base.client import BaseDatabaseClient
|
||||
|
||||
@@ -7,6 +7,11 @@ class DatabaseClient(BaseDatabaseClient):
|
||||
executable_name: str = ...
|
||||
@classmethod
|
||||
def settings_to_cmd_args(
|
||||
cls, settings_dict: Dict[str, Any]
|
||||
cls,
|
||||
settings_dict: Union[
|
||||
Dict[str, Optional[Union[Dict[Any, Any], str]]],
|
||||
Dict[str, Union[Dict[str, Dict[str, str]], int, str]],
|
||||
Dict[str, Union[Dict[str, Union[int, str]], int, str]],
|
||||
],
|
||||
) -> List[str]: ...
|
||||
def runshell(self) -> None: ...
|
||||
|
||||
@@ -38,7 +38,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
run_on_commit: List[Any]
|
||||
savepoint_ids: List[Any]
|
||||
savepoint_state: int
|
||||
settings_dict: Dict[str, Optional[Union[str, int, Dict[str, None]]]]
|
||||
settings_dict: Dict[str, Optional[Union[Dict[str, None], int, str]]]
|
||||
validation: django.db.backends.base.validation.BaseDatabaseValidation
|
||||
vendor: str = ...
|
||||
display_name: str = ...
|
||||
@@ -77,14 +77,14 @@ class SQLiteCursorWrapper(Database.Cursor):
|
||||
query: str,
|
||||
params: Optional[
|
||||
Union[
|
||||
List[Union[int, str, None, memoryview]],
|
||||
List[Union[str, float, None]],
|
||||
List[Optional[Union[float, int, str]]],
|
||||
List[Optional[Union[int, memoryview, str]]],
|
||||
List[datetime],
|
||||
Tuple,
|
||||
]
|
||||
] = ...,
|
||||
) -> SQLiteCursorWrapper: ...
|
||||
def executemany(
|
||||
self, query: str, param_list: Union[List[Tuple[int]], Iterator[Any]]
|
||||
self, query: str, param_list: Union[Iterator[Any], List[Tuple[int]]]
|
||||
) -> SQLiteCursorWrapper: ...
|
||||
def convert_query(self, query: str) -> str: ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class FlexibleFieldLookupDict:
|
||||
base_data_types_reverse: Any = ...
|
||||
def __getitem__(
|
||||
self, key: str
|
||||
) -> Union[str, Tuple[str, Dict[str, int]]]: ...
|
||||
) -> Union[Tuple[str, Dict[str, int]], str]: ...
|
||||
|
||||
class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
connection: django.db.backends.sqlite3.base.DatabaseWrapper
|
||||
@@ -23,7 +23,10 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
self, cursor: CursorWrapper, table_name: str
|
||||
) -> List[FieldInfo]: ...
|
||||
def get_sequences(
|
||||
self, cursor: CursorWrapper, table_name: str, table_fields: Field = ...
|
||||
self,
|
||||
cursor: CursorWrapper,
|
||||
table_name: str,
|
||||
table_fields: List[Field] = ...,
|
||||
) -> List[Dict[str, str]]: ...
|
||||
def get_relations(
|
||||
self, cursor: CursorWrapper, table_name: str
|
||||
@@ -36,4 +39,11 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
) -> Optional[str]: ...
|
||||
def get_constraints(
|
||||
self, cursor: CursorWrapper, table_name: str
|
||||
) -> Dict[str, Dict[str, Union[List[str], bool, str, Tuple[str, str]]]]: ...
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[List[str], Tuple[str, str], bool]],
|
||||
Dict[str, Union[List[str], bool, str]],
|
||||
Dict[str, Union[List[str], bool]],
|
||||
],
|
||||
]: ...
|
||||
|
||||
@@ -8,8 +8,7 @@ from django.db.backends.sqlite3.base import (DatabaseWrapper,
|
||||
SQLiteCursorWrapper)
|
||||
from django.db.backends.utils import CursorDebugWrapper
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.expressions import (BaseExpression, Col, Expression, F,
|
||||
SQLiteNumericMixin)
|
||||
from django.db.models.expressions import BaseExpression, Col, Expression, F
|
||||
from django.db.models.fields import Field
|
||||
from django.utils.datastructures import ImmutableList
|
||||
|
||||
@@ -21,30 +20,34 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
explain_prefix: str = ...
|
||||
def bulk_batch_size(
|
||||
self,
|
||||
fields: Union[List[Field], ImmutableList, List[str]],
|
||||
fields: Union[List[Field], List[str], ImmutableList],
|
||||
objs: Union[List[Model], range],
|
||||
) -> int: ...
|
||||
def check_expression_support(self, expression: BaseExpression) -> None: ...
|
||||
def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def date_interval_sql(self, timedelta: timedelta) -> str: ...
|
||||
def format_for_duration_arithmetic(self, sql: Any): ...
|
||||
def format_for_duration_arithmetic(self, sql: str) -> str: ...
|
||||
def date_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def time_trunc_sql(self, lookup_type: Any, field_name: Any): ...
|
||||
def datetime_cast_date_sql(self, field_name: Any, tzname: Any): ...
|
||||
def datetime_cast_time_sql(self, field_name: Any, tzname: Any): ...
|
||||
def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def datetime_cast_date_sql(
|
||||
self, field_name: str, tzname: Optional[str]
|
||||
) -> str: ...
|
||||
def datetime_cast_time_sql(
|
||||
self, field_name: str, tzname: Optional[str]
|
||||
) -> str: ...
|
||||
def datetime_extract_sql(
|
||||
self, lookup_type: str, field_name: str, tzname: None
|
||||
self, lookup_type: str, field_name: str, tzname: Optional[str]
|
||||
) -> str: ...
|
||||
def datetime_trunc_sql(
|
||||
self, lookup_type: Any, field_name: Any, tzname: Any
|
||||
): ...
|
||||
self, lookup_type: str, field_name: str, tzname: Optional[str]
|
||||
) -> str: ...
|
||||
def time_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
|
||||
def pk_default_value(self) -> str: ...
|
||||
def last_executed_query(
|
||||
self,
|
||||
cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper],
|
||||
sql: str,
|
||||
params: Optional[Union[List[int], Tuple, List[str]]],
|
||||
params: Optional[Union[List[int], List[str], Tuple]],
|
||||
) -> str: ...
|
||||
def quote_name(self, name: str) -> str: ...
|
||||
def no_limit_value(self) -> int: ...
|
||||
@@ -52,20 +55,20 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
self,
|
||||
style: Style,
|
||||
tables: List[str],
|
||||
sequences: Union[Tuple, List[Dict[str, str]]],
|
||||
sequences: Union[List[Dict[str, str]], Tuple],
|
||||
allow_cascade: bool = ...,
|
||||
) -> List[str]: ...
|
||||
def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ...
|
||||
def adapt_datetimefield_value(
|
||||
self, value: Optional[Union[datetime, F]]
|
||||
) -> Optional[Union[str, F]]: ...
|
||||
) -> Optional[Union[F, str]]: ...
|
||||
def adapt_timefield_value(
|
||||
self, value: Optional[Union[time, F]]
|
||||
) -> Optional[Union[str, F]]: ...
|
||||
) -> Optional[Union[F, str]]: ...
|
||||
def get_db_converters(self, expression: Expression) -> List[Callable]: ...
|
||||
def convert_datetimefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, datetime]],
|
||||
value: Optional[Union[datetime, str]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper,
|
||||
) -> Optional[datetime]: ...
|
||||
@@ -77,12 +80,12 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
) -> Optional[date]: ...
|
||||
def convert_timefield_value(
|
||||
self,
|
||||
value: Optional[Union[str, time]],
|
||||
value: Optional[Union[time, str]],
|
||||
expression: Expression,
|
||||
connection: DatabaseWrapper,
|
||||
) -> Optional[time]: ...
|
||||
def get_decimalfield_converter(
|
||||
self, expression: SQLiteNumericMixin
|
||||
self, expression: Expression
|
||||
) -> Callable: ...
|
||||
def convert_uuidfield_value(
|
||||
self, value: Optional[str], expression: Col, connection: DatabaseWrapper
|
||||
@@ -95,8 +98,8 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
) -> Optional[bool]: ...
|
||||
def bulk_insert_sql(
|
||||
self,
|
||||
fields: Union[List[Field], List[None], ImmutableList],
|
||||
placeholder_rows: Union[Tuple[Tuple[str]], List[Any]],
|
||||
fields: Union[List[None], List[Field], ImmutableList],
|
||||
placeholder_rows: Union[List[Any], Tuple[Tuple[str]]],
|
||||
) -> str: ...
|
||||
def combine_expression(
|
||||
self, connector: str, sub_expressions: List[str]
|
||||
|
||||
@@ -17,7 +17,7 @@ class CursorWrapper:
|
||||
def __getattr__(
|
||||
self, attr: str
|
||||
) -> Union[
|
||||
Callable, int, Tuple[Tuple[str, None, None, None, None, None, None]]
|
||||
Callable, Tuple[Tuple[str, None, None, None, None, None, None]], int
|
||||
]: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __enter__(self) -> CursorWrapper: ...
|
||||
@@ -33,8 +33,8 @@ class CursorWrapper:
|
||||
sql: str,
|
||||
params: Optional[
|
||||
Union[
|
||||
List[Union[int, str, None, memoryview]],
|
||||
List[Union[str, float, None]],
|
||||
List[Optional[Union[float, int, str]]],
|
||||
List[Optional[Union[int, memoryview, str]]],
|
||||
List[datetime],
|
||||
Tuple,
|
||||
]
|
||||
@@ -43,14 +43,14 @@ class CursorWrapper:
|
||||
def executemany(
|
||||
self,
|
||||
sql: str,
|
||||
param_list: Union[List[Tuple[str]], List[Tuple[int]], Iterator[Any]],
|
||||
param_list: Union[Iterator[Any], List[Tuple[Union[int, str]]]],
|
||||
) -> Optional[SQLiteCursorWrapper]: ...
|
||||
|
||||
class CursorDebugWrapper(CursorWrapper):
|
||||
cursor: django.db.backends.sqlite3.base.SQLiteCursorWrapper
|
||||
db: django.db.backends.sqlite3.base.DatabaseWrapper
|
||||
def execute(
|
||||
self, sql: str, params: Optional[Union[Tuple, List[str]]] = ...
|
||||
self, sql: str, params: Optional[Union[List[str], Tuple]] = ...
|
||||
) -> Any: ...
|
||||
def executemany(self, sql: str, param_list: Iterator[Any]) -> Any: ...
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user