improved version

This commit is contained in:
Maxim Kurnikov
2018-07-29 20:06:41 +03:00
parent c180555415
commit 89bb6eac75
160 changed files with 1007 additions and 607 deletions

View File

@@ -1,6 +1,8 @@
from django.db.models.base import Model
from typing import (
Any,
Iterator,
Type,
)
@@ -9,7 +11,11 @@ class AppConfig:
def _path_from_module(self, module: Any) -> str: ...
@classmethod
def create(cls, entry: str) -> AppConfig: ...
def get_model(self, model_name: str, require_ready: bool = ...) -> Any: ...
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Any]: ...
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
def get_models(
self,
include_auto_created: bool = ...,
include_swapped: bool = ...
) -> Iterator[Type[Model]]: ...
def import_models(self) -> None: ...
def ready(self) -> None: ...

View File

@@ -1,10 +1,11 @@
from django.apps.config import AppConfig
from django.db.migrations.state import AppConfigStub
from django.db.models.base import Model
from typing import (
Any,
List,
Optional,
Tuple,
Type,
Union,
)
@@ -12,12 +13,17 @@ from typing import (
class Apps:
def __init__(
self,
installed_apps: Union[Tuple, List[AppConfigStub], List[str]] = ...
installed_apps: Union[Tuple, List[str], List[AppConfigStub]] = ...
) -> None: ...
def check_apps_ready(self) -> None: ...
def check_models_ready(self) -> None: ...
def clear_cache(self) -> None: ...
def do_pending_operations(self, model: Any) -> None: ...
def do_pending_operations(self, model: Type[Model]) -> None: ...
def get_app_config(self, app_label: str) -> AppConfig: ...
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ...
def get_model(self, app_label: str, model_name: None = ..., require_ready: bool = ...) -> Any: ...
def get_model(
self,
app_label: str,
model_name: None = ...,
require_ready: bool = ...
) -> Type[Model]: ...

View File

@@ -14,4 +14,4 @@ def url(
view: Any,
kwargs: Any = ...,
name: Optional[str] = ...
) -> Union[URLResolver, URLPattern]: ...
) -> Union[URLPattern, URLResolver]: ...

View File

@@ -10,7 +10,7 @@ from typing import (
def i18n_patterns(
*urls,
prefix_default_language = ...
) -> Union[List[List[Any]], List[URLResolver]]: ...
) -> Union[List[URLResolver], List[List[Any]]]: ...
def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ...

View File

@@ -1,5 +1,4 @@
from django.contrib.admin.options import (
BaseModelAdmin,
InlineModelAdmin,
ModelAdmin,
TabularInline,
@@ -20,7 +19,10 @@ from typing import (
class BaseModelAdminChecks:
def _check_autocomplete_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_autocomplete_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_autocomplete_fields_item(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
@@ -28,32 +30,44 @@ class BaseModelAdminChecks:
field_name: str,
label: str
) -> List[Any]: ...
def _check_exclude(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_exclude(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_field_spec(
self,
obj: BaseModelAdmin,
model: Any,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
fields: Union[str, Tuple[str, str, str, str], Tuple[str, str]],
label: str
) -> List[Any]: ...
def _check_field_spec_item(
self,
obj: BaseModelAdmin,
model: Any,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_fieldsets(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_fieldsets(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_fieldsets_item(
self,
obj: BaseModelAdmin,
model: Any,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
fieldset: Any,
label: str,
seen_fields: List[str]
) -> List[Any]: ...
def _check_filter_horizontal(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_filter_horizontal(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_filter_item(
self,
obj: ModelAdmin,
@@ -61,17 +75,29 @@ class BaseModelAdminChecks:
field_name: str,
label: str
) -> List[Any]: ...
def _check_filter_vertical(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_form(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_ordering(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_filter_vertical(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_form(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_ordering(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_ordering_item(
self,
obj: ModelAdmin,
model: Any,
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_prepopulated_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_prepopulated_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_prepopulated_fields_key(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
@@ -81,9 +107,9 @@ class BaseModelAdminChecks:
) -> List[Any]: ...
def _check_prepopulated_fields_value(
self,
obj: BaseModelAdmin,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
val: Union[Tuple[str], List[str]],
val: Union[List[str], Tuple[str]],
label: str
) -> List[Any]: ...
def _check_prepopulated_fields_value_item(
@@ -93,8 +119,14 @@ class BaseModelAdminChecks:
field_name: str,
label: str
) -> List[Any]: ...
def _check_radio_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_raw_id_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_radio_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_raw_id_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_raw_id_fields_item(
self,
obj: ModelAdmin,
@@ -102,18 +134,24 @@ class BaseModelAdminChecks:
field_name: str,
label: str
) -> List[Any]: ...
def _check_readonly_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_readonly_fields(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def _check_readonly_fields_item(
self,
obj: BaseModelAdmin,
model: Any,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_view_on_site_url(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_view_on_site_url(
self,
obj: Union[ModelAdmin, InlineModelAdmin]
) -> List[Any]: ...
def check(
self,
admin_obj: BaseModelAdmin,
admin_obj: Union[ModelAdmin, InlineModelAdmin],
**kwargs
) -> List[Error]: ...
@@ -122,11 +160,15 @@ class InlineModelAdminChecks:
def _check_exclude_of_parent_model(
self,
obj: InlineModelAdmin,
parent_model: Any
parent_model: Type[Model]
) -> List[Any]: ...
def _check_extra(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_formset(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_has_add_permission(self, obj: InlineModelAdmin) -> None: ...
def _check_max_num(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_min_num(self, obj: InlineModelAdmin) -> List[Any]: ...
def _check_relation(self, obj: InlineModelAdmin, parent_model: Any) -> List[Any]: ...
def _check_relation(
self,
obj: InlineModelAdmin,
parent_model: Type[Model]
) -> List[Any]: ...

View File

@@ -13,7 +13,6 @@ from django.db.models.fields.related import (
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
List,
@@ -79,20 +78,20 @@ class DateFieldListFilter:
class FieldListFilter:
def __init__(
self,
field: Any,
field: Union[ForeignObjectRel, Field],
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
@classmethod
def create(
cls,
field: Any,
field: Union[ForeignObjectRel, Field],
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> FieldListFilter: ...
@@ -103,7 +102,12 @@ class FieldListFilter:
queryset: QuerySet
) -> QuerySet: ...
@classmethod
def register(cls, test: Callable, list_filter_class: Any, take_priority: bool = ...) -> None: ...
def register(
cls,
test: Callable,
list_filter_class: Type[FieldListFilter],
take_priority: bool = ...
) -> None: ...
class ListFilter:
@@ -111,7 +115,7 @@ class ListFilter:
self,
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model: Type[Model],
model_admin: ModelAdmin
) -> None: ...
@@ -122,7 +126,7 @@ class RelatedFieldListFilter:
field: Union[ForeignObjectRel, ManyToManyField, ForeignKey],
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
@@ -144,7 +148,7 @@ class RelatedOnlyFieldListFilter:
field: Union[ManyToManyField, ForeignKey],
request: WSGIRequest,
model_admin: ModelAdmin
) -> Union[List[Tuple[int, str]], List[Tuple[str, str]]]: ...
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
class SimpleListFilter:

View File

@@ -1,12 +1,16 @@
from django.core.checks.messages import Error
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.related import (
ForeignKey,
ManyToManyField,
)
from django.db.models.query import QuerySet
from django.forms.fields import TypedChoiceField
from django.forms.fields import (
Field,
TypedChoiceField,
)
from django.forms.models import (
ModelChoiceField,
ModelMultipleChoiceField,
@@ -32,7 +36,12 @@ class BaseModelAdmin:
request: object,
**kwargs
) -> TypedChoiceField: ...
def formfield_for_dbfield(self, db_field: Field, request: object, **kwargs) -> Any: ...
def formfield_for_dbfield(
self,
db_field: Field,
request: object,
**kwargs
) -> Optional[Field]: ...
def formfield_for_foreignkey(
self,
db_field: ForeignKey,
@@ -47,27 +56,43 @@ class BaseModelAdmin:
) -> ModelMultipleChoiceField: ...
def get_autocomplete_fields(self, request: object) -> Tuple: ...
def get_empty_value_display(self) -> SafeText: ...
def get_exclude(self, request: object, obj: Any = ...) -> None: ...
def get_exclude(self, request: object, obj: Optional[Model] = ...) -> None: ...
def get_field_queryset(
self,
db: None,
db_field: Union[ManyToManyField, ForeignKey],
request: object
) -> Optional[QuerySet]: ...
def get_fields(self, request: object, obj: Any = ...) -> Union[List[Union[str, Callable]], List[str]]: ...
def get_fieldsets(self, request: WSGIRequest, obj: Any = ...) -> Any: ...
def get_fields(
self,
request: object,
obj: Optional[Model] = ...
) -> Union[List[str], List[Union[str, Callable]]]: ...
def get_fieldsets(
self,
request: WSGIRequest,
obj: Optional[Model] = ...
) -> Any: ...
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
def get_prepopulated_fields(
self,
request: WSGIRequest,
obj: Any = ...
obj: Optional[Model] = ...
) -> Dict[str, Tuple[str]]: ...
def get_queryset(self, request: object) -> QuerySet: ...
def get_readonly_fields(self, request: object, obj: Any = ...) -> Union[Tuple, List[str]]: ...
def get_sortable_by(self, request: WSGIRequest) -> Union[Tuple, List[str]]: ...
def get_view_on_site_url(self, obj: Any = ...) -> Optional[str]: ...
def get_readonly_fields(
self,
request: object,
obj: Optional[Model] = ...
) -> Union[List[str], Tuple]: ...
def get_sortable_by(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
def get_view_on_site_url(self, obj: Optional[Model] = ...) -> Optional[str]: ...
def has_add_permission(self, request: WSGIRequest) -> bool: ...
def has_change_permission(self, request: object, obj: Any = ...) -> bool: ...
def has_delete_permission(self, request: object, obj: Any = ...) -> bool: ...
def has_change_permission(self, request: object, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: object, obj: Optional[Model] = ...) -> bool: ...
def has_module_permission(self, request: object) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Any = ...) -> bool: ...
def has_view_permission(
self,
request: WSGIRequest,
obj: Optional[Model] = ...
) -> bool: ...

View File

@@ -1,4 +1,5 @@
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.http.response import (
HttpResponse,
HttpResponseRedirect,
@@ -14,6 +15,7 @@ from typing import (
Dict,
List,
Tuple,
Type,
Union,
)
@@ -44,12 +46,12 @@ class AdminSite:
request: WSGIRequest,
extra_context: None = ...
) -> TemplateResponse: ...
def is_registered(self, model: Any) -> bool: ...
def is_registered(self, model: Type[Model]) -> bool: ...
def login(
self,
request: WSGIRequest,
extra_context: None = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def logout(
self,
request: WSGIRequest,
@@ -66,11 +68,11 @@ class AdminSite:
extra_context: None = ...
) -> TemplateResponse: ...
def register(self, model_or_iterable: Any, admin_class: Any = ..., **options) -> None: ...
def unregister(self, model_or_iterable: Any) -> None: ...
def unregister(self, model_or_iterable: Type[Model]) -> None: ...
@property
def urls(
self
) -> Union[Tuple[List[Union[URLPattern, URLResolver]], str, str], Tuple[List[URLPattern], str, str]]: ...
) -> Union[Tuple[List[URLPattern], str, str], Tuple[List[Union[URLPattern, URLResolver]], str, str]]: ...
class DefaultAdminSite:

View File

@@ -74,7 +74,7 @@ def pagination_tag(
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
def result_headers(cl: ChangeList) -> Iterator[Dict[str, Union[None, int, str]]]: ...
def result_headers(cl: ChangeList) -> Iterator[Dict[str, Optional[Union[int, str]]]]: ...
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...

View File

@@ -20,4 +20,4 @@ def add_preserved_filters(
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[str, int, UUID]) -> Union[str, int, UUID]: ...

View File

@@ -4,8 +4,15 @@ from django.contrib.admin.options import (
TabularInline,
)
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.contrib.auth.models import User
from django.db.models.base import Model
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.fields import Field
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
ManyToManyRel,
ManyToOneRel,
OneToOneRel,
)
from django.db.models.options import Options
from django.db.models.query import QuerySet
from typing import (
@@ -14,6 +21,7 @@ from typing import (
Dict,
List,
Optional,
Set,
Tuple,
Type,
Union,
@@ -21,7 +29,10 @@ from typing import (
from uuid import UUID
def _get_non_gfk_field(opts: Options, name: Union[str, Callable]) -> Any: ...
def _get_non_gfk_field(
opts: Options,
name: Union[str, Callable]
) -> Union[Field, reverse_related.ManyToManyRel, reverse_related.OneToOneRel]: ...
def construct_change_message(
@@ -31,7 +42,11 @@ def construct_change_message(
) -> List[Dict[str, Dict[str, List[str]]]]: ...
def display_for_field(value: Any, field: Any, empty_value_display: str) -> str: ...
def display_for_field(
value: Any,
field: Union[Field, reverse_related.OneToOneRel],
empty_value_display: str
) -> str: ...
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
@@ -40,21 +55,23 @@ def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...)
def flatten(fields: Union[Tuple, List[Union[str, Callable]], List[str]]) -> Union[List[Union[str, Callable]], List[str]]: ...
def flatten_fieldsets(fieldsets: Any) -> Union[List[Union[str, Callable]], List[str]]: ...
def flatten_fieldsets(fieldsets: Any) -> Union[List[str], List[Union[str, Callable]]]: ...
def get_fields_from_path(model: Any, path: str) -> Any: ...
def get_fields_from_path(model: Type[Model], path: str) -> Any: ...
def get_model_from_relation(field: Any) -> Any: ...
def get_model_from_relation(
field: Union[ForeignObjectRel, Field]
) -> Type[Model]: ...
def help_text_for_field(name: str, model: Any) -> str: ...
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
def label_for_field(
name: Union[str, Callable],
model: Any,
model: Type[Model],
model_admin: Optional[Union[ModelAdmin, TabularInline]] = ...,
return_attr: bool = ...
) -> Any: ...
@@ -79,7 +96,10 @@ def prepare_lookup_value(key: str, value: Union[str, datetime]) -> Union[bool, d
def quote(s: Union[str, UUID, int]) -> Union[str, UUID, int]: ...
def reverse_field_path(model: Type[Model], path: str) -> Any: ...
def reverse_field_path(
model: Type[Model],
path: str
) -> Union[Tuple[Type[Model], str], Tuple[Type[User], str]]: ...
def unquote(s: str) -> str: ...
@@ -87,13 +107,24 @@ def unquote(s: str) -> str: ...
class NestedObjects:
def __init__(self, *args, **kwargs) -> None: ...
def _nested(self, obj: Model, seen: Any, format_callback: Callable) -> Any: ...
def add_edge(self, source: Any, target: Model) -> None: ...
def _nested(
self,
obj: Model,
seen: Set[Model],
format_callback: Callable
) -> Any: ...
def add_edge(self, source: Optional[Model], target: Model) -> None: ...
def can_fast_delete(self, *args, **kwargs) -> bool: ...
def collect(self, objs: Any, source: Any = ..., source_attr: Optional[str] = ..., **kwargs) -> None: ...
def collect(
self,
objs: Union[List[Model], QuerySet],
source: Optional[Type[Model]] = ...,
source_attr: Optional[str] = ...,
**kwargs
) -> None: ...
def nested(self, format_callback: Callable = ...) -> Any: ...
def related_objects(
self,
related: ManyToOneRel,
objs: Any
objs: Union[List[User], List[Model]]
) -> QuerySet: ...

View File

@@ -21,10 +21,10 @@ class ChangeList:
def __init__(
self,
request: WSGIRequest,
model: Any,
list_display: Union[Tuple[str, str, str, str], List[Union[str, Callable]], List[str]],
list_display_links: Union[Tuple[str, str], List[str]],
list_filter: Union[List[Type[SimpleListFilter]], Tuple, List[str]],
model: Type[Model],
list_display: Union[List[str], List[Union[str, Callable]], Tuple[str, str, str, str]],
list_display_links: Union[List[str], Tuple[str, str]],
list_filter: Union[List[Type[SimpleListFilter]], List[str], Tuple],
date_hierarchy: Optional[str],
search_fields: Union[List[str], Tuple],
list_select_related: bool,

View File

@@ -45,7 +45,7 @@ class AdminSplitDateTime:
name: str,
value: Optional[datetime],
attrs: Dict[str, Union[bool, str]]
) -> Dict[str, Any]: ...
) -> Dict[str, Union[Dict[str, Any], str, Dict[str, Union[str, bool, Dict[str, Union[bool, str]], List[Dict[str, Union[str, bool, Dict[str, Union[bool, str]]]]]]], Dict[str, Union[str, bool, Dict[str, str], List[Dict[str, Union[str, bool, Dict[str, str]]]]]]]]: ...
class AdminTextInputWidget:

View File

@@ -9,7 +9,6 @@ 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 test_client.auth_backends import BackendWithoutGetUserMethod
from typing import (
Any,
Dict,
@@ -20,7 +19,7 @@ from typing import (
)
def _clean_credentials(credentials: Dict[str, Union[str, None]]) -> Dict[str, Union[str, None]]: ...
def _clean_credentials(credentials: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]: ...
def _get_backends(return_tuples: bool = ...) -> Any: ...
@@ -49,9 +48,7 @@ def get_user(
def get_user_model() -> Type[Model]: ...
def load_backend(
path: str
) -> Union[ModelBackend, BackendWithoutGetUserMethod]: ...
def load_backend(path: str) -> object: ...
def login(

View File

@@ -28,7 +28,7 @@ class UserAdmin:
request: WSGIRequest,
form_url: str = ...,
extra_context: None = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def add_view(
self,
request: WSGIRequest,
@@ -53,4 +53,4 @@ class UserAdmin:
request: WSGIRequest,
id: str,
form_url: str = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...

View File

@@ -1,4 +1,3 @@
from auth_tests.test_context_processors import MockUser
from django.contrib.auth.models import (
AnonymousUser,
User,
@@ -12,20 +11,17 @@ from typing import (
def auth(
request: HttpRequest
) -> Dict[str, Union[AnonymousUser, PermWrapper, User]]: ...
) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...
class PermLookupDict:
def __bool__(self) -> bool: ...
def __getitem__(self, perm_name: str) -> bool: ...
def __init__(self, user: MockUser, app_label: str) -> None: ...
def __init__(self, user: object, app_label: str) -> None: ...
class PermWrapper:
def __contains__(self, perm_name: str) -> bool: ...
def __getitem__(self, app_label: str) -> PermLookupDict: ...
def __init__(
self,
user: Union[MockUser, AnonymousUser, User]
) -> None: ...
def __init__(self, user: object) -> None: ...
def __iter__(self): ...

View File

@@ -20,7 +20,7 @@ def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
def get_hashers(
) -> Union[List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher], List[UnsaltedMD5PasswordHasher]]: ...
) -> Union[List[UnsaltedMD5PasswordHasher], List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher]]: ...
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...

View File

@@ -42,7 +42,7 @@ class AnonymousUser:
def get_username(self) -> str: ...
def has_module_perms(self, module: str) -> bool: ...
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
def has_perms(self, perm_list: Union[Tuple[str], List[str]], obj: None = ...) -> bool: ...
def has_perms(self, perm_list: Union[List[str], Tuple[str]], obj: None = ...) -> bool: ...
@property
def is_anonymous(self) -> bool: ...
@property
@@ -71,7 +71,7 @@ class PermissionsMixin:
def get_all_permissions(self, obj: None = ...) -> Set[str]: ...
def has_module_perms(self, app_label: str) -> bool: ...
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
def has_perms(self, perm_list: Union[Tuple[str], List[str]], obj: None = ...) -> bool: ...
def has_perms(self, perm_list: Union[List[str], Tuple[str]], obj: None = ...) -> bool: ...
class UserManager:

View File

@@ -14,12 +14,12 @@ def _password_validators_help_text_html(password_validators: None = ...) -> str:
def get_default_password_validators(
) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ...
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
def get_password_validators(
validator_config: List[Dict[str, str]]
) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ...
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
def password_changed(

View File

@@ -15,6 +15,7 @@ from typing import (
Dict,
Optional,
Set,
Type,
Union,
)
@@ -32,16 +33,16 @@ class LoginView:
request: HttpRequest,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def form_valid(
self,
form: AuthenticationForm
) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
def get_form_class(self) -> Any: ...
def get_form_class(self) -> Type[AuthenticationForm]: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, MultiValueDict, WSGIRequest]]: ...
) -> Dict[str, Optional[Union[MultiValueDict, WSGIRequest]]]: ...
def get_redirect_url(self) -> str: ...
def get_success_url(self) -> str: ...
@@ -52,7 +53,7 @@ class LogoutView:
request: HttpRequest,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def get_next_page(self) -> Optional[str]: ...
def post(
self,
@@ -71,14 +72,14 @@ class PasswordChangeView:
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def form_valid(
self,
form: PasswordChangeForm
) -> HttpResponseRedirect: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, User, MultiValueDict]]: ...
) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
class PasswordResetConfirmView:
@@ -86,11 +87,11 @@ class PasswordResetConfirmView:
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, User, MultiValueDict]]: ...
) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
def get_user(self, uidb64: str) -> Optional[User]: ...
@@ -99,7 +100,7 @@ class PasswordResetView:
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...

View File

@@ -25,26 +25,30 @@ from typing import (
class GenericForeignKey:
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __get__(
self,
instance: Optional[Model],
cls: Type[Model] = ...
) -> Optional[Union[Model, GenericForeignKey]]: ...
def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ...
def __set__(self, instance: Model, value: Any) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def __str__(self) -> str: ...
def _check_content_type_field(self) -> List[Error]: ...
def _check_field_name(self) -> List[Any]: ...
def _check_object_id_field(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Error]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def get_cache_name(self) -> str: ...
def get_content_type(
self,
obj: Any = ...,
obj: Optional[Model] = ...,
id: Optional[int] = ...,
using: Optional[str] = ...
) -> ContentType: ...
def get_filter_kwargs_for_object(
self,
obj: Model
) -> Dict[str, Union[None, ContentType, int]]: ...
) -> Dict[str, Optional[Union[ContentType, int]]]: ...
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
def get_prefetch_queryset(
self,
@@ -57,7 +61,7 @@ class GenericRel:
def __init__(
self,
field: GenericRelation,
to: Any,
to: Union[Type[Model], str],
related_name: None = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: None = ...
@@ -67,7 +71,7 @@ class GenericRel:
class GenericRelation:
def __init__(
self,
to: Any,
to: Union[Type[Model], str],
object_id_field: str = ...,
content_type_field: str = ...,
for_concrete_model: bool = ...,
@@ -81,9 +85,13 @@ class GenericRelation:
self,
field: Optional[Union[GenericForeignKey, GenericRelation]]
) -> bool: ...
def bulk_related_objects(self, objs: Any, using: str = ...) -> QuerySet: ...
def bulk_related_objects(
self,
objs: List[Model],
using: str = ...
) -> QuerySet: ...
def check(self, **kwargs) -> List[Error]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def get_content_type(self) -> ContentType: ...
def get_extra_restriction(
self,
@@ -99,5 +107,5 @@ class GenericRelation:
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
def resolve_related_fields(
self
) -> Union[List[Tuple[PositiveIntegerField, AutoField]], List[Tuple[PositiveIntegerField, related.OneToOneField]]]: ...
) -> Union[List[Tuple[PositiveIntegerField, related.OneToOneField]], List[Tuple[PositiveIntegerField, AutoField]]]: ...
def set_attributes_from_rel(self) -> None: ...

View File

@@ -2,10 +2,14 @@ from django.apps.config import AppConfig
from django.apps.registry import Apps
from django.contrib.contenttypes.models import ContentType
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.migration import Migration
from django.db.migrations.state import StateApps
from typing import (
Any,
List,
Tuple,
Type,
Union,
)
@@ -27,7 +31,7 @@ def get_contenttypes_and_models(
def inject_rename_contenttypes_operations(
plan: Any = ...,
plan: Union[List[Any], List[Tuple[Migration, bool]]] = ...,
apps: StateApps = ...,
using: str = ...,
**kwargs

View File

@@ -11,7 +11,7 @@ from typing import (
def apnumber(value: str) -> str: ...
def intcomma(value: Optional[Union[str, float, int]], use_l10n: bool = ...) -> str: ...
def intcomma(value: Optional[Union[str, float]], use_l10n: bool = ...) -> str: ...
def intword(value: Optional[str]) -> Optional[str]: ...

View File

@@ -12,7 +12,7 @@ class BaseStorage:
def __len__(self) -> int: ...
def _get_level(self) -> int: ...
@property
def _loaded_messages(self) -> Union[List[str], List[Message]]: ...
def _loaded_messages(self) -> Union[List[Message], List[str]]: ...
def _prepare_messages(self, messages: List[Message]) -> None: ...
def _set_level(self, value: int = ...) -> None: ...
def add(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ...

View File

@@ -13,14 +13,14 @@ class CookieStorage:
def _decode(self, data: Optional[str]) -> Any: ...
def _encode(
self,
messages: Union[List[str], List[Message]],
messages: Union[List[Message], List[str]],
encode_empty: bool = ...
) -> Optional[str]: ...
def _get(
self,
*args,
**kwargs
) -> Union[Tuple[None, bool], Tuple[List[str], bool], Tuple[List[Any], bool], Tuple[List[Message], bool]]: ...
) -> Union[Tuple[None, bool], Tuple[List[Any], bool], Tuple[List[str], bool], Tuple[List[Message], bool]]: ...
def _hash(self, value: str) -> str: ...
def _store(
self,
@@ -38,7 +38,7 @@ class MessageDecoder:
self,
s: str,
**kwargs
) -> Union[List[Message], List[Union[Message, str]], List[str]]: ...
) -> Union[List[Union[Message, str]], List[Message], List[str]]: ...
def process_messages(self, obj: Any) -> Any: ...

View File

@@ -14,7 +14,7 @@ class FallbackStorage:
self,
*args,
**kwargs
) -> Union[Tuple[List[str], bool], Tuple[List[Any], bool], Tuple[List[Message], bool]]: ...
) -> Union[Tuple[List[Any], bool], Tuple[List[str], bool], Tuple[List[Message], bool]]: ...
def _store(
self,
messages: List[Message],

View File

@@ -27,5 +27,5 @@ class SessionStorage:
def deserialize_messages(
self,
data: Optional[str]
) -> Optional[Union[List[str], List[Message]]]: ...
) -> Optional[Union[List[Message], List[str]]]: ...
def serialize_messages(self, messages: Union[List[Message], List[str]]) -> str: ...

View File

@@ -21,7 +21,7 @@ class SessionBase:
def _get_session(
self,
no_load: bool = ...
) -> Dict[str, Union[Model, int, str, datetime]]: ...
) -> Dict[str, Union[str, int, datetime, Model]]: ...
def _get_session_key(self) -> Optional[str]: ...
def _hash(self, value: bytes) -> str: ...
def _set_session_key(self, value: Optional[str]) -> None: ...
@@ -29,7 +29,7 @@ class SessionBase:
def clear(self) -> None: ...
def cycle_key(self) -> None: ...
def decode(self, session_data: Union[str, bytes]) -> Dict[str, Union[str, int]]: ...
def encode(self, session_dict: Dict[str, Union[int, str, datetime]]) -> str: ...
def encode(self, session_dict: Dict[str, Union[str, int, datetime]]) -> str: ...
def flush(self) -> None: ...
def get(self, key: str, default: Optional[str] = ...) -> Optional[Union[str, datetime, int]]: ...
def get_expire_at_browser_close(self) -> bool: ...
@@ -37,7 +37,7 @@ class SessionBase:
def get_expiry_date(self, **kwargs) -> datetime: ...
def is_empty(self) -> bool: ...
def pop(self, key: str, default: object = ...) -> Union[str, int]: ...
def set_expiry(self, value: Optional[Union[int, datetime, timedelta]]) -> None: ...
def set_expiry(self, value: Optional[Union[datetime, int, timedelta]]) -> None: ...
def setdefault(self, key: str, value: str) -> str: ...
def test_cookie_worked(self) -> bool: ...
def update(self, dict_: Dict[str, int]) -> None: ...

View File

@@ -17,7 +17,7 @@ class SessionStore:
def create(self) -> None: ...
def create_model_instance(
self,
data: Dict[str, Union[int, str, datetime]]
data: Dict[str, Union[str, int, datetime]]
) -> AbstractBaseSession: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...

View File

@@ -36,13 +36,13 @@ class Sitemap:
page: Union[str, int],
protocol: str,
domain: str
) -> Union[List[Dict[str, Union[Model, str, None]]], List[Dict[str, object]]]: ...
) -> Union[List[Dict[str, object]], List[Dict[str, Union[Model, str, None]]]]: ...
def get_urls(
self,
page: Union[str, int] = ...,
site: Optional[Union[RequestSite, Site]] = ...,
protocol: Optional[str] = ...
) -> Union[List[Dict[str, Union[Model, str, datetime, None]]], List[Dict[str, object]]]: ...
) -> Union[List[Dict[str, object]], List[Dict[str, Union[Model, str, datetime, None]]]]: ...
def items(self) -> List[Any]: ...
def location(self, obj: Model) -> str: ...
@property

View File

@@ -1,12 +1,16 @@
from django.contrib.sitemaps import Sitemap
from django.contrib.flatpages.sitemaps import FlatPageSitemap
from django.contrib.sitemaps import (
GenericSitemap,
Sitemap,
)
from django.core.handlers.wsgi import WSGIRequest
from django.template.response import TemplateResponse
from typing import (
Any,
Callable,
Dict,
Optional,
Type,
Union,
)
@@ -21,7 +25,7 @@ def index(
def sitemap(
request: WSGIRequest,
sitemaps: Dict[str, Any],
sitemaps: Dict[str, Union[Type[Sitemap], Type[FlatPageSitemap], GenericSitemap]],
section: Optional[str] = ...,
template_name: str = ...,
content_type: str = ...

View File

@@ -21,4 +21,4 @@ def get_files(
) -> Iterator[str]: ...
def matches_patterns(path: str, patterns: Union[OrderedDict, Tuple[str], List[str]] = ...) -> bool: ...
def matches_patterns(path: str, patterns: Union[OrderedDict, List[str], Tuple[str]] = ...) -> bool: ...

View File

@@ -19,5 +19,5 @@ class CacheHandler:
class DefaultCacheProxy:
def __contains__(self, key: str) -> bool: ...
def __getattr__(self, name: str) -> Union[OrderedDict, Callable, Dict[str, float]]: ...
def __getattr__(self, name: str) -> Union[OrderedDict, Dict[str, float], Callable]: ...
def __setattr__(self, name: str, value: Callable) -> None: ...

View File

@@ -27,7 +27,7 @@ class BaseCache:
def get_or_set(
self,
key: str,
default: Optional[Union[str, Callable, int]],
default: Optional[Union[str, int, Callable]],
timeout: object = ...,
version: Optional[int] = ...
) -> Optional[Union[str, int]]: ...
@@ -36,7 +36,7 @@ class BaseCache:
def make_key(self, key: Union[str, int], version: Optional[Union[str, int]] = ...) -> str: ...
def set_many(
self,
data: Union[Dict[str, str], Dict[str, Union[Dict[str, int], str]], Dict[str, int], OrderedDict],
data: Union[Dict[str, Union[Dict[str, int], str]], OrderedDict, Dict[str, str], Dict[str, int]],
timeout: object = ...,
version: Optional[int] = ...
) -> List[Any]: ...

View File

@@ -10,11 +10,11 @@ from typing import (
class BaseDatabaseCache:
def __init__(self, table: str, params: Dict[str, Union[int, Callable, str, Dict[str, int]]]) -> None: ...
def __init__(self, table: str, params: Dict[str, Union[Callable, Dict[str, int], str, int]]) -> None: ...
class DatabaseCache:
def _base_set(self, mode: str, key: str, value: Any, timeout: object = ...): ...
def _base_set(self, mode: str, key: str, value: object, timeout: object = ...): ...
def _cull(self, db: str, cursor: CursorWrapper, now: datetime) -> None: ...
def add(
self,

View File

@@ -14,7 +14,7 @@ class DummyCache:
def set(
self,
key: str,
value: Union[str, int, Dict[str, Any]],
value: Union[str, Dict[str, Any], int],
timeout: object = ...,
version: Optional[str] = ...
) -> None: ...

View File

@@ -13,7 +13,7 @@ from typing import (
)
def _write_content(f: Union[BufferedRandom, BufferedWriter], expiry: float, value: Any) -> None: ...
def _write_content(f: Union[BufferedRandom, BufferedWriter], expiry: float, value: object) -> None: ...
class FileBasedCache:

View File

@@ -14,7 +14,7 @@ class LocMemCache:
def add(
self,
key: str,
value: Union[int, Dict[str, int], str, Dict[str, str]],
value: Union[int, str, Dict[str, str], Dict[str, int]],
timeout: object = ...,
version: Optional[int] = ...
): ...
@@ -31,7 +31,7 @@ class LocMemCache:
def set(
self,
key: Union[str, int],
value: Any,
value: object,
timeout: object = ...,
version: Optional[int] = ...
) -> None: ...

View File

@@ -1,7 +1,4 @@
from typing import (
Any,
Optional,
)
from typing import Optional
class CheckMessage:
@@ -11,7 +8,7 @@ class CheckMessage:
level: int,
msg: str,
hint: Optional[str] = ...,
obj: Any = ...,
obj: object = ...,
id: Optional[str] = ...
) -> None: ...
def __str__(self) -> str: ...

View File

@@ -16,5 +16,5 @@ class CheckRegistry:
app_configs: None = ...,
tags: Optional[List[str]] = ...,
include_deployment_checks: bool = ...
) -> Union[List[str], List[Warning], List[int]]: ...
) -> Union[List[int], List[str], List[Warning]]: ...
def tag_exists(self, tag: str, include_deployment_checks: bool = ...) -> bool: ...

View File

@@ -22,8 +22,8 @@ def _load_all_namespaces(resolver: URLResolver, parents: Tuple = ...) -> List[st
def check_resolver(
resolver: Union[URLResolver, URLPattern]
) -> Union[List[Error], List[Warning]]: ...
resolver: Union[URLPattern, URLResolver]
) -> Union[List[Warning], List[Error]]: ...
def check_url_config(app_configs: None, **kwargs) -> List[Warning]: ...

View File

@@ -1,3 +1,4 @@
from collections.abc import Iterable
from django.forms.utils import ErrorDict
from typing import (
Any,
@@ -11,7 +12,12 @@ from typing import (
class ValidationError:
def __init__(self, message: Any, code: Optional[str] = ..., params: Any = ...) -> None: ...
def __init__(
self,
message: Iterable,
code: Optional[str] = ...,
params: Any = ...
) -> None: ...
def __iter__(self) -> Iterator[Union[str, Tuple[str, List[str]]]]: ...
def __str__(self) -> str: ...
@property

View File

@@ -6,11 +6,12 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
def get_storage_class(import_path: Optional[str] = ...) -> Any: ...
def get_storage_class(import_path: Optional[str] = ...) -> Type[Storage]: ...
class FileSystemStorage:
@@ -46,7 +47,7 @@ class FileSystemStorage:
def listdir(
self,
path: str
) -> Union[Tuple[List[Any], List[Any]], Tuple[List[Any], List[str]], Tuple[List[str], List[Any]], Tuple[List[str], List[str]]]: ...
) -> Union[Tuple[List[str], List[Any]], Tuple[List[Any], List[Any]], Tuple[List[Any], List[str]], Tuple[List[str], List[str]]]: ...
@cached_property
def location(self) -> str: ...
def path(self, name: str) -> str: ...

View File

@@ -45,7 +45,7 @@ class TemporaryUploadedFile:
class UploadedFile:
def __init__(
self,
file: Optional[Union[_TemporaryFileWrapper, StringIO, BytesIO]] = ...,
file: Optional[Union[StringIO, _TemporaryFileWrapper, BytesIO]] = ...,
name: str = ...,
content_type: str = ...,
size: Optional[int] = ...,

View File

@@ -1,7 +1,18 @@
from django.core.exceptions import (
PermissionDenied,
SuspiciousOperation,
)
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponse
from django.http.multipartparser import MultiPartParserError
from django.http.response import (
Http404,
HttpResponse,
)
from django.urls.resolvers import URLResolver
from typing import Callable
from typing import (
Callable,
Union,
)
def convert_exception_to_response(get_response: Callable) -> Callable: ...
@@ -11,7 +22,7 @@ def get_exception_response(
request: WSGIRequest,
resolver: URLResolver,
status_code: int,
exception: Exception,
exception: Union[MultiPartParserError, PermissionDenied, Http404, SuspiciousOperation],
sender: None = ...
) -> HttpResponse: ...

View File

@@ -1,5 +1,4 @@
from django.core.mail.backends.base import BaseEmailBackend
from mail.custombackend import EmailBackend
from typing import (
List,
Optional,
@@ -50,5 +49,5 @@ def send_mass_mail(
fail_silently: bool = ...,
auth_user: None = ...,
auth_password: None = ...,
connection: EmailBackend = ...
connection: BaseEmailBackend = ...
) -> int: ...

View File

@@ -2,7 +2,6 @@ from django.core.mail.backends.base import BaseEmailBackend
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from typing import (
Any,
Dict,
List,
Optional,
@@ -28,7 +27,7 @@ class EmailMessage:
from_email: Optional[str] = ...,
to: Optional[List[str]] = ...,
bcc: None = ...,
connection: Any = ...,
connection: Optional[BaseEmailBackend] = ...,
attachments: Optional[List[MIMEText]] = ...,
headers: Optional[Dict[str, str]] = ...,
cc: Optional[List[str]] = ...,
@@ -37,7 +36,7 @@ class EmailMessage:
def _create_attachment(
self,
filename: Optional[str],
content: Union[str, bytes, SafeMIMEText],
content: Union[bytes, str, SafeMIMEText],
mimetype: str = ...
) -> MIMEBase: ...
def _create_attachments(
@@ -71,7 +70,7 @@ class EmailMultiAlternatives:
from_email: Optional[str] = ...,
to: List[str] = ...,
bcc: None = ...,
connection: Any = ...,
connection: Optional[BaseEmailBackend] = ...,
attachments: None = ...,
headers: Optional[Dict[str, str]] = ...,
alternatives: None = ...,

View File

@@ -19,7 +19,7 @@ class Command:
connection: DatabaseWrapper,
table_name: str,
row: FieldInfo
) -> Union[Tuple[str, OrderedDict, List[str]], Tuple[str, OrderedDict, List[Any]]]: ...
) -> Union[Tuple[str, OrderedDict, List[Any]], Tuple[str, OrderedDict, List[str]]]: ...
def get_meta(
self,
table_name: str,
@@ -34,4 +34,4 @@ class Command:
col_name: str,
used_column_names: List[str],
is_relation: bool
) -> Union[Tuple[str, Dict[str, str], List[str]], Tuple[str, Dict[Any, Any], List[Any]]]: ...
) -> Union[Tuple[str, Dict[Any, Any], List[Any]], Tuple[str, Dict[str, str], List[str]]]: ...

View File

@@ -16,11 +16,11 @@ class Command:
def fixture_dirs(self) -> List[str]: ...
def handle(self, *fixture_labels, **options) -> None: ...
def load_label(self, fixture_label: str) -> None: ...
def loaddata(self, fixture_labels: Union[Tuple[str], Tuple[str, str]]) -> None: ...
def loaddata(self, fixture_labels: Union[Tuple[str, str], Tuple[str]]) -> None: ...
def parse_name(
self,
fixture_name: str
) -> Union[Tuple[str, str, str], Tuple[str, str, None], Tuple[str, None, None]]: ...
) -> Union[Tuple[str, None, None], Tuple[str, str, None], Tuple[str, str, str]]: ...
class SingleZipReader:

View File

@@ -1,8 +1,10 @@
from django.core.management.base import CommandParser
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.migrations.migration import Migration
from typing import (
Any,
List,
Optional,
Set,
)
@@ -10,5 +12,10 @@ from typing import (
class Command:
def _run_checks(self, **kwargs) -> List[Any]: ...
def add_arguments(self, parser: CommandParser) -> None: ...
def migration_progress_callback(self, action: str, migration: Any = ..., fake: bool = ...) -> None: ...
def migration_progress_callback(
self,
action: str,
migration: Optional[Migration] = ...,
fake: bool = ...
) -> None: ...
def sync_apps(self, connection: DatabaseWrapper, app_labels: Set[str]) -> None: ...

View File

@@ -8,10 +8,10 @@ from typing import (
class Page:
def __getitem__(self, index: Union[slice, int]) -> Union[str, List[Model]]: ...
def __getitem__(self, index: Union[slice, int]) -> Union[List[Model], str]: ...
def __init__(
self,
object_list: Union[QuerySet, str, List[object], List[int]],
object_list: Union[List[int], str, List[object], QuerySet],
number: int,
paginator: Paginator
) -> None: ...
@@ -28,7 +28,7 @@ class Page:
class Paginator:
def __init__(
self,
object_list: Union[List[object], QuerySet, List[int]],
object_list: Union[List[int], QuerySet, List[object]],
per_page: Union[str, int],
orphans: Union[str, int] = ...,
allow_empty_first_page: bool = ...
@@ -43,4 +43,4 @@ class Paginator:
def page(self, number: Union[str, int]) -> Page: ...
@property
def page_range(self) -> range: ...
def validate_number(self, number: Optional[Union[str, float, int]]) -> int: ...
def validate_number(self, number: Optional[Union[float, str]]) -> int: ...

View File

@@ -50,7 +50,7 @@ def serialize(
def sort_dependencies(
app_list: Union[List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None], Tuple[AppConfig, None]]], List[Tuple[str, List[Type[Model]]]], List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None]]]]
app_list: Union[List[Tuple[str, List[Type[Model]]]], List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None], Tuple[AppConfig, None]]], List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None]]]]
) -> List[Type[Model]]: ...

View File

@@ -17,12 +17,17 @@ from typing import (
Dict,
List,
Optional,
Type,
Union,
)
from uuid import UUID
def build_instance(Model: Any, data: Dict[str, Any], db: str) -> Model: ...
def build_instance(
Model: Type[Model],
data: Dict[str, Any],
db: str
) -> Model: ...
def deserialize_fk_value(
@@ -34,7 +39,7 @@ def deserialize_fk_value(
def deserialize_m2m_values(
field: ManyToManyField,
field_value: Union[List[List[str]], List[Union[int, str]], List[int]],
field_value: Union[List[List[str]], List[int], List[Union[int, str]]],
using: str
) -> List[int]: ...
@@ -57,7 +62,7 @@ class DeserializedObject:
class Deserializer:
def __init__(self, stream_or_string: Union[str, BufferedReader, TextIOWrapper], **options) -> None: ...
def __init__(self, stream_or_string: Union[str, TextIOWrapper, BufferedReader], **options) -> None: ...
def __iter__(self) -> Deserializer: ...

View File

@@ -16,7 +16,7 @@ def Deserializer(stream_or_string: Any, **options) -> None: ...
class DjangoJSONEncoder:
def default(self, o: Union[Decimal, UUID, date, timedelta]) -> str: ...
def default(self, o: Union[Decimal, date, timedelta, UUID]) -> str: ...
class Serializer:

View File

@@ -1,4 +1,5 @@
from collections import OrderedDict
from datetime import datetime
from django.core.serializers.base import DeserializedObject
from django.db.models.base import Model
from django.db.models.fields import Field
@@ -10,6 +11,9 @@ from typing import (
Any,
Iterator,
List,
Optional,
Type,
Union,
)
@@ -22,11 +26,15 @@ def Deserializer(
) -> Iterator[DeserializedObject]: ...
def _get_model(model_identifier: str) -> Any: ...
def _get_model(model_identifier: str) -> Type[Model]: ...
class Serializer:
def _value_from_field(self, obj: Model, field: Field) -> Any: ...
def _value_from_field(
self,
obj: Model,
field: Field
) -> Optional[Union[str, float, datetime]]: ...
def end_object(self, obj: Model) -> None: ...
def end_serialization(self) -> None: ...
def get_dump_object(self, obj: Model) -> OrderedDict: ...

View File

@@ -10,9 +10,9 @@ from django.db.models.fields.related import (
ManyToManyField,
)
from typing import (
Any,
List,
Optional,
Type,
Union,
)
from xml.dom.minidom import Element
@@ -36,7 +36,7 @@ class Deserializer:
**options
) -> None: ...
def __next__(self) -> DeserializedObject: ...
def _get_model_from_node(self, node: Element, attr: str) -> Any: ...
def _get_model_from_node(self, node: Element, attr: str) -> Type[Model]: ...
def _handle_fk_field_node(
self,
node: Element,

View File

@@ -20,10 +20,10 @@ def base64_hmac(salt: str, value: Union[str, bytes], key: Union[str, bytes]) ->
def dumps(
obj: Union[str, Dict[str, str], Dict[str, Union[str, datetime]], List[str]],
obj: Union[str, List[str], Dict[str, Union[str, datetime]], Dict[str, str]],
key: None = ...,
salt: str = ...,
serializer: Type[Union[JSONSerializer, PickleSerializer]] = ...,
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
compress: bool = ...
) -> str: ...
@@ -35,14 +35,14 @@ def loads(
s: str,
key: None = ...,
salt: str = ...,
serializer: Type[Union[JSONSerializer, PickleSerializer]] = ...,
serializer: Type[Union[PickleSerializer, JSONSerializer]] = ...,
max_age: Optional[int] = ...
) -> Union[str, Dict[str, str], List[str]]: ...
) -> Union[str, List[str], Dict[str, str]]: ...
class JSONSerializer:
def dumps(self, obj: Any) -> bytes: ...
def loads(self, data: bytes) -> Union[Dict[str, str], List[str]]: ...
def loads(self, data: bytes) -> Union[List[str], Dict[str, str]]: ...
class Signer:

View File

@@ -4,7 +4,6 @@ from django.core.files.base import ContentFile
from django.utils.functional import SimpleLazyObject
from re import RegexFlag
from typing import (
Any,
List,
Optional,
Union,
@@ -38,12 +37,16 @@ def validate_ipv6_address(value: str) -> None: ...
class BaseValidator:
def __call__(self, value: Any) -> None: ...
def __init__(self, limit_value: Any, message: None = ...) -> None: ...
def __call__(self, value: Union[Decimal, float, str, datetime]) -> None: ...
def __init__(
self,
limit_value: Optional[Union[Decimal, float, datetime]],
message: None = ...
) -> None: ...
def clean(
self,
x: Union[float, datetime, int, Decimal]
) -> Union[float, datetime, int, Decimal]: ...
x: Union[Decimal, datetime, float]
) -> Union[Decimal, datetime, float]: ...
def compare(self, a: bool, b: bool) -> bool: ...
@@ -82,7 +85,7 @@ class MaxLengthValidator:
class MaxValueValidator:
def compare(self, a: Union[float, Decimal, int], b: Union[float, Decimal, int]) -> bool: ...
def compare(self, a: Union[float, Decimal], b: Union[float, Decimal]) -> bool: ...
class MinLengthValidator:
@@ -93,8 +96,8 @@ class MinLengthValidator:
class MinValueValidator:
def compare(
self,
a: Union[float, Decimal, int, datetime],
b: Union[float, Decimal, int, datetime]
a: Union[float, Decimal, datetime],
b: Union[float, Decimal, datetime]
) -> bool: ...
@@ -102,7 +105,7 @@ class ProhibitNullCharactersValidator:
def __call__(self, value: Optional[str]) -> None: ...
def __eq__(
self,
other: Union[RegexValidator, ProhibitNullCharactersValidator]
other: Union[ProhibitNullCharactersValidator, RegexValidator]
) -> bool: ...
def __init__(self, message: Optional[str] = ..., code: Optional[str] = ...) -> None: ...

View File

@@ -15,4 +15,4 @@ def reset_queries(**kwargs) -> None: ...
class DefaultConnectionProxy:
def __eq__(self, other: DatabaseWrapper) -> bool: ...
def __getattr__(self, item: str) -> Any: ...
def __setattr__(self, name: str, value: Union[MagicMock, bool]) -> None: ...
def __setattr__(self, name: str, value: Union[bool, MagicMock]) -> None: ...

View File

@@ -27,5 +27,5 @@ class BaseDatabaseCreation:
suffix: None = ...
) -> None: ...
def serialize_db_to_string(self) -> str: ...
def set_as_test_mirror(self, primary_settings_dict: Dict[str, Union[str, int, None, Dict[str, None]]]) -> None: ...
def set_as_test_mirror(self, primary_settings_dict: Dict[str, Optional[Union[str, int, Dict[str, None]]]]) -> None: ...
def test_db_signature(self) -> Tuple[str, str, str, str]: ...

View File

@@ -5,18 +5,27 @@ from datetime import (
timedelta,
)
from decimal import Decimal
from django.contrib.auth.models import (
Group,
User,
)
from django.contrib.sites.models import Site
from django.core.management.color import Style
from django.db import DefaultConnectionProxy
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.expressions import Expression
from django.db.models.fields import Field
from django.db.models.sql.compiler import SQLCompiler
from typing import (
Any,
List,
Optional,
Set,
Tuple,
Type,
Union,
)
@@ -35,15 +44,15 @@ class BaseDatabaseOperations:
decimal_places: Optional[int] = ...
) -> Optional[str]: ...
def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ...
def adapt_timefield_value(self, value: Optional[Union[time, datetime]]) -> Optional[str]: ...
def adapt_unknown_value(self, value: Union[Decimal, time, date, int]) -> Union[str, int]: ...
def adapt_timefield_value(self, value: Optional[Union[datetime, time]]) -> Optional[str]: ...
def adapt_unknown_value(self, value: Union[date, time, int, Decimal]) -> Union[str, int]: ...
def autoinc_sql(self, table: str, column: str) -> None: ...
def binary_placeholder_sql(self, value: Optional[memoryview]) -> str: ...
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
def compiler(self, compiler_name: str) -> Any: ...
def compiler(self, compiler_name: str) -> Type[SQLCompiler]: ...
def convert_durationfield_value(
self,
value: Optional[Union[float, int]],
value: Optional[float],
expression: Expression,
connection: DatabaseWrapper
) -> Optional[timedelta]: ...
@@ -70,7 +79,11 @@ class BaseDatabaseOperations:
def savepoint_create_sql(self, sid: str) -> str: ...
def savepoint_rollback_sql(self, sid: str) -> str: ...
def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ...
def sequence_reset_sql(self, style: Style, model_list: Any) -> List[Any]: ...
def sequence_reset_sql(
self,
style: Style,
model_list: Union[Set[Type[Model]], List[Type[Model]], Set[Type[Union[Group, User]]], List[Type[Site]]]
) -> List[Any]: ...
def set_time_zone_sql(self) -> str: ...
def tablespace_sql(self, tablespace: str, inline: bool = ...) -> str: ...
def time_extract_sql(self, lookup_type: None, field_name: None): ...

View File

@@ -37,12 +37,12 @@ class BaseDatabaseSchemaEditor:
def _create_index_name(
self,
table_name: str,
column_names: Union[Tuple[str, str, str], Tuple[str], List[str]],
column_names: Union[Tuple[str, str, str], List[str], Tuple[str]],
suffix: str = ...
) -> str: ...
def _create_index_sql(
self,
model: Any,
model: Type[Model],
fields: Any,
*,
name = ...,
@@ -52,7 +52,11 @@ class BaseDatabaseSchemaEditor:
col_suffixes = ...,
sql = ...
) -> Statement: ...
def _create_unique_sql(self, model: Any, columns: List[str]) -> Statement: ...
def _create_unique_sql(
self,
model: Type[Model],
columns: List[str]
) -> Statement: ...
def _delete_composed_index(
self,
model: Type[Model],
@@ -64,6 +68,6 @@ class BaseDatabaseSchemaEditor:
def _digest(cls, *args) -> str: ...
def _field_indexes_sql(
self,
model: Any,
model: Type[Model],
field: Field
) -> List[Statement]: ...

View File

@@ -7,4 +7,4 @@ from typing import (
class DatabaseClient:
@classmethod
def settings_to_cmd_args(cls, settings_dict: Dict[str, Union[str, None]]) -> List[str]: ...
def settings_to_cmd_args(cls, settings_dict: Dict[str, Optional[str]]) -> List[str]: ...

View File

@@ -78,5 +78,5 @@ class SQLiteCursorWrapper:
def executemany(
self,
query: str,
param_list: Union[List[Tuple[int]], List[Tuple[int, int]]]
param_list: Union[List[Tuple[int, int]], List[Tuple[int]]]
) -> SQLiteCursorWrapper: ...

View File

@@ -27,7 +27,7 @@ class DatabaseIntrospection:
self,
cursor: CursorWrapper,
name: str
) -> List[Dict[str, Union[str, None, int]]]: ...
) -> List[Dict[str, Optional[Union[str, int]]]]: ...
def get_constraints(
self,
cursor: CursorWrapper,

View File

@@ -10,14 +10,19 @@ from django.db.backends.sqlite3.base import (
SQLiteCursorWrapper,
)
from django.db.backends.utils import CursorDebugWrapper
from django.db.models.aggregates import Aggregate
from django.db.models.aggregates import (
Aggregate,
Max,
)
from django.db.models.expressions import (
BaseExpression,
Col,
CombinedExpression,
Expression,
F,
OrderBy,
)
from django.db.models.functions.comparison import Cast
from django.db.models.functions.datetime import TruncBase
from typing import (
Any,
Callable,
@@ -40,7 +45,10 @@ class DatabaseOperations:
def adapt_timefield_value(self, value: Optional[time]) -> Optional[str]: ...
def bulk_batch_size(self, fields: Any, objs: Any) -> int: ...
def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> str: ...
def check_expression_support(self, expression: BaseExpression) -> None: ...
def check_expression_support(
self,
expression: Union[OrderBy, Expression]
) -> None: ...
def combine_duration_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ...
def convert_booleanfield_value(
@@ -52,7 +60,7 @@ class DatabaseOperations:
def convert_datefield_value(
self,
value: Optional[Union[str, date]],
expression: Expression,
expression: Union[Col, Cast, Aggregate, django.db.models.functions.TruncBase],
connection: DatabaseWrapper
) -> Optional[date]: ...
def convert_datetimefield_value(
@@ -64,7 +72,7 @@ class DatabaseOperations:
def convert_timefield_value(
self,
value: Optional[Union[str, time]],
expression: Expression,
expression: Union[Col, Max, django.db.models.functions.TruncBase],
connection: DatabaseWrapper
) -> Optional[time]: ...
def convert_uuidfield_value(
@@ -92,7 +100,7 @@ class DatabaseOperations:
self,
cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper],
sql: str,
params: Optional[Union[Tuple, List[str]]]
params: Optional[Union[List[str], Tuple]]
) -> str: ...
def no_limit_value(self) -> int: ...
def pk_default_value(self) -> str: ...
@@ -108,7 +116,7 @@ class DatabaseOperations:
self,
internal_type: str,
lhs: Tuple[str, List[Any]],
rhs: Union[Tuple[str, List[Any]], Tuple[str, List[str]]]
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
rhs: Union[Tuple[str, List[str]], Tuple[str, List[Any]]]
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def time_extract_sql(self, lookup_type: str, field_name: str) -> str: ...
def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ...

View File

@@ -20,13 +20,13 @@ class DatabaseSchemaEditor:
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
def _alter_field(
self,
model: Any,
model: Type[Model],
old_field: Field,
new_field: Field,
old_type: str,
new_type: str,
old_db_params: Dict[str, Union[str, None]],
new_db_params: Dict[str, Union[str, None]],
old_db_params: Dict[str, Optional[str]],
new_db_params: Dict[str, Optional[str]],
strict: bool = ...
) -> None: ...
def _is_referenced_by_fk_constraint(
@@ -37,7 +37,7 @@ class DatabaseSchemaEditor:
) -> bool: ...
def _remake_table(
self,
model: Any,
model: Type[Model],
create_field: Optional[Union[IntegerField, TimeField]] = ...,
delete_field: Optional[Union[AutoField, SlugField]] = ...,
alter_field: Any = ...
@@ -45,18 +45,18 @@ class DatabaseSchemaEditor:
def add_field(self, model: Type[Model], field: Field) -> None: ...
def alter_db_table(
self,
model: Any,
model: Type[Model],
old_db_table: str,
new_db_table: str,
disable_constraints: bool = ...
) -> None: ...
def alter_field(
self,
model: Any,
model: Type[Model],
old_field: Field,
new_field: Field,
strict: bool = ...
) -> None: ...
def delete_model(self, model: Any, handle_autom2m: bool = ...) -> None: ...
def delete_model(self, model: Type[Model], handle_autom2m: bool = ...) -> None: ...
def quote_value(self, value: Optional[Union[int, memoryview, str]]) -> str: ...
def remove_field(self, model: Type[Model], field: Field) -> None: ...

View File

@@ -47,7 +47,7 @@ def typecast_timestamp(s: str) -> date: ...
class CursorDebugWrapper:
def execute(self, sql: str, params: Optional[Union[Tuple, List[str]]] = ...): ...
def execute(self, sql: str, params: Optional[Union[List[str], Tuple]] = ...): ...
class CursorWrapper:

View File

@@ -1,12 +1,13 @@
from django.db.migrations.graph import MigrationGraph
from django.db.migrations.migration import Migration
from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.fields import FieldOperation
from django.db.migrations.operations.models import (
AddIndex,
CreateModel,
DeleteModel,
FieldRelatedOptionOperation,
ModelOperation,
RemoveIndex,
)
from django.db.migrations.questioner import MigrationQuestioner
from django.db.migrations.state import ProjectState
@@ -62,7 +63,7 @@ class MigrationAutodetector:
def add_operation(
self,
app_label: str,
operation: Operation,
operation: Union[FieldOperation, RemoveIndex, ModelOperation],
dependencies: Any = ...,
beginning: bool = ...
) -> None: ...
@@ -81,11 +82,11 @@ class MigrationAutodetector:
) -> Dict[str, List[Migration]]: ...
def check_dependency(
self,
operation: Operation,
dependency: Union[Tuple[str, str, str, str], Tuple[str, str, str, bool], Tuple[str, str, None, bool]]
operation: Union[FieldOperation, AddIndex, ModelOperation],
dependency: Union[Tuple[str, str, None, bool], Tuple[str, str, str, str], Tuple[str, str, str, bool]]
) -> bool: ...
def create_altered_indexes(self) -> None: ...
def deep_deconstruct(self, obj: Any) -> Any: ...
def deep_deconstruct(self, obj: object) -> Any: ...
def generate_added_fields(self) -> None: ...
def generate_added_indexes(self) -> None: ...
def generate_altered_db_table(self) -> None: ...

View File

@@ -20,12 +20,17 @@ class MigrationExecutor:
progress_callback: Optional[Callable] = ...
) -> None: ...
def _create_project_state(self, with_applied_migrations: bool = ...) -> ProjectState: ...
def _migrate_all_backwards(self, plan: Any, full_plan: Any, fake: bool) -> ProjectState: ...
def _migrate_all_backwards(
self,
plan: List[Tuple[Migration, bool]],
full_plan: Union[List[Any], List[Tuple[Migration, bool]]],
fake: bool
) -> ProjectState: ...
def _migrate_all_forwards(
self,
state: ProjectState,
plan: Any,
full_plan: Any,
plan: Union[List[Any], List[Tuple[Migration, bool]]],
full_plan: Union[List[Any], List[Tuple[Migration, bool]]],
fake: bool,
fake_initial: bool
) -> ProjectState: ...
@@ -44,17 +49,17 @@ class MigrationExecutor:
) -> Tuple[bool, ProjectState]: ...
def migrate(
self,
targets: Optional[Union[List[Tuple[str, str]], List[Tuple[str, None]]]],
plan: Any = ...,
targets: Optional[Union[List[Tuple[str, None]], List[Tuple[str, str]]]],
plan: Optional[Union[List[Any], List[Tuple[Migration, bool]]]] = ...,
state: Optional[ProjectState] = ...,
fake: bool = ...,
fake_initial: bool = ...
) -> ProjectState: ...
def migration_plan(
self,
targets: Union[Set[Tuple[str, str]], List[Tuple[str, str]], List[Tuple[str, None]]],
targets: Union[List[Tuple[str, None]], List[Tuple[str, str]], Set[Tuple[str, str]]],
clean_start: bool = ...
) -> Any: ...
) -> Union[List[Any], List[Tuple[Migration, bool]], List[Tuple[object, bool]]]: ...
def unapply_migration(
self,
state: ProjectState,

View File

@@ -1,7 +1,9 @@
from django.db.migrations.migration import SwappableTuple
from django.db.migrations.migration import (
Migration,
SwappableTuple,
)
from django.db.migrations.state import ProjectState
from typing import (
Any,
Callable,
List,
Optional,
@@ -11,7 +13,12 @@ from typing import (
class DummyNode:
def __init__(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
def __init__(
self,
key: Tuple[str, str],
origin: Union[Migration, str],
error_message: str
) -> None: ...
def promote(self) -> None: ...
def raise_error(self): ...
@@ -25,14 +32,19 @@ class MigrationGraph:
def _nodes_and_edges(self) -> Tuple[int, int]: ...
def add_dependency(
self,
migration: Any,
migration: Optional[Union[Migration, str]],
child: Tuple[str, str],
parent: Tuple[str, str],
skip_validation: bool = ...
) -> None: ...
def add_dummy_node(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
def add_node(self, key: Tuple[str, str], migration: Any) -> None: ...
def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ...
def add_dummy_node(
self,
key: Tuple[str, str],
origin: Union[Migration, str],
error_message: str
) -> None: ...
def add_node(self, key: Tuple[str, str], migration: object) -> None: ...
def backwards_plan(self, target: Union[Node, Tuple[str, str]]) -> List[Tuple[str, str]]: ...
def clear_cache(self) -> None: ...
def ensure_not_cyclic(
self,

View File

@@ -4,13 +4,18 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
class Operation:
@staticmethod
def __new__(cls: Any, *args, **kwargs) -> Operation: ...
def __new__(
cls: Type[Operation],
*args,
**kwargs
) -> Operation: ...
def _get_model_tuple(self, remote_model: str, app_label: str, model_name: str) -> Tuple[str, str]: ...
def reduce(
self,

View File

@@ -1,8 +1,10 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.models import (
AlterUniqueTogether,
CreateModel,
DeleteModel,
FieldRelatedOptionOperation,
ModelOperation,
)
from django.db.migrations.state import ProjectState
from django.db.models.fields import (
@@ -47,7 +49,7 @@ class AddField:
def describe(self) -> str: ...
def reduce(
self,
operation: Operation,
operation: Union[FieldOperation, CreateModel, FieldRelatedOptionOperation],
in_between: List[AddField],
app_label: Optional[str] = ...
) -> Union[bool, List[AddField]]: ...
@@ -82,7 +84,7 @@ class AlterField:
def describe(self) -> str: ...
def reduce(
self,
operation: Union[DeleteModel, AlterField, AlterUniqueTogether],
operation: Union[AlterField, DeleteModel, AlterUniqueTogether],
in_between: List[Any],
app_label: str = ...
) -> bool: ...
@@ -99,7 +101,7 @@ class FieldOperation:
def name_lower(self) -> str: ...
def reduce(
self,
operation: Operation,
operation: Union[ModelOperation, FieldOperation],
in_between: Any,
app_label: str = ...
) -> bool: ...

View File

@@ -1,5 +1,6 @@
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.operations.base import Operation
from django.db.migrations.operations.fields import FieldOperation
from django.db.migrations.state import ProjectState
from django.db.models.indexes import Index
from typing import (
@@ -183,7 +184,7 @@ class DeleteModel:
class FieldRelatedOptionOperation:
def reduce(
self,
operation: Operation,
operation: Union[FieldOperation, CreateModel, AlterIndexTogether],
in_between: List[DeleteModel],
app_label: Optional[str] = ...
) -> Any: ...
@@ -200,7 +201,7 @@ class ModelOperation:
def name_lower(self) -> str: ...
def reduce(
self,
operation: Operation,
operation: Union[FieldOperation, ModelOperation],
in_between: Any,
app_label: Optional[str] = ...
) -> bool: ...
@@ -210,7 +211,7 @@ class ModelOperation:
class ModelOptionOperation:
def reduce(
self,
operation: Operation,
operation: Union[FieldOperation, CreateModel, FieldRelatedOptionOperation],
in_between: List[DeleteModel],
app_label: Optional[str] = ...
) -> Union[bool, List[AlterUniqueTogether]]: ...

View File

@@ -77,7 +77,7 @@ class SeparateDatabaseAndState:
def __init__(
self,
database_operations: List[ModelOperation] = ...,
state_operations: Union[List[AddField], List[CreateModel], List[ModelOperation]] = ...
state_operations: Union[List[CreateModel], List[AddField], List[ModelOperation]] = ...
) -> None: ...
def database_forwards(
self,

View File

@@ -12,7 +12,7 @@ def serializer_factory(value: Any) -> BaseSerializer: ...
class BaseSequenceSerializer:
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
def serialize(self) -> Union[Tuple[str, Set[str]], Tuple[str, Set[Any]]]: ...
class BaseSerializer:
@@ -38,8 +38,8 @@ class DeconstructableSerializer:
@staticmethod
def serialize_deconstructed(
path: str,
args: Union[Tuple, List[str]],
kwargs: Dict[str, Any]
args: Union[List[str], Tuple],
kwargs: Dict[str, object]
) -> Tuple[str, Set[str]]: ...
@@ -96,7 +96,7 @@ class TupleSerializer:
class TypeSerializer:
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
def serialize(self) -> Union[Tuple[str, Set[str]], Tuple[str, Set[Any]]]: ...
class UUIDSerializer:

View File

@@ -1,9 +1,11 @@
from django.apps.registry import Apps
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.indexes import Index
from typing import (
Any,
Iterator,
Type,
)
@@ -27,7 +29,11 @@ class ModelState:
def clone(self) -> ModelState: ...
def construct_managers(self) -> Iterator[Any]: ...
@classmethod
def from_model(cls, model: Any, exclude_rels: bool = ...) -> ModelState: ...
def from_model(
cls,
model: Type[Model],
exclude_rels: bool = ...
) -> ModelState: ...
def get_field_by_name(self, name: str) -> Field: ...
def get_index_by_name(self, name: str) -> Index: ...
@cached_property

View File

@@ -19,7 +19,7 @@ class MigrationWriter:
@property
def path(self) -> str: ...
@classmethod
def serialize(cls, value: Any) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
def serialize(cls, value: Any) -> Union[Tuple[str, Set[str]], Tuple[str, Set[Any]]]: ...
class OperationWriter:
@@ -27,7 +27,7 @@ class OperationWriter:
def feed(self, line: str) -> None: ...
def indent(self) -> None: ...
def render(self) -> str: ...
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
def serialize(self) -> Union[Tuple[str, Set[str]], Tuple[str, Set[Any]]]: ...
def unindent(self) -> None: ...

View File

@@ -1,3 +1,8 @@
from django.contrib.auth.models import (
Permission,
User,
)
from django.contrib.contenttypes.models import ContentType
from django.db.models.base import Model
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
@@ -11,6 +16,7 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
@@ -50,7 +56,7 @@ class Collector:
def add(
self,
objs: Any,
source: Any = ...,
source: Optional[Union[Type[Model], Type[ContentType]]] = ...,
nullable: bool = ...,
reverse_dependency: bool = ...
) -> Any: ...
@@ -68,15 +74,19 @@ class Collector:
def collect(
self,
objs: Any,
source: Any = ...,
source: Optional[Union[Type[Model], Type[ContentType]]] = ...,
nullable: bool = ...,
collect_related: bool = ...,
source_attr: Optional[str] = ...,
reverse_dependency: bool = ...,
keep_parents: bool = ...
) -> None: ...
def delete(self) -> Union[Tuple[int, Dict[Any, Any]], Tuple[int, Dict[str, int]]]: ...
def get_del_batches(self, objs: Any, field: ForeignKey) -> Any: ...
def delete(self) -> Union[Tuple[int, Dict[str, int]], Tuple[int, Dict[Any, Any]]]: ...
def get_del_batches(
self,
objs: Union[List[User], List[Model], List[ContentType], List[Permission]],
field: ForeignKey
) -> Union[List[List[Model]], List[List[ContentType]], List[List[User]], List[List[Permission]]]: ...
def instances_with_model(self) -> Iterator[Any]: ...
def related_objects(
self,
@@ -90,5 +100,5 @@ class ProtectedError:
def __init__(
self,
msg: str,
protected_objects: Union[QuerySet, List[Model]]
protected_objects: Union[List[Model], QuerySet]
) -> None: ...

View File

@@ -4,10 +4,19 @@ from datetime import (
timedelta,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.aggregates import Count
from django.db.models.fields import Field
from django.db.models.aggregates import (
Aggregate,
Count,
)
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
OneToOneRel,
)
from django.db.models.functions.datetime import Trunc
from django.db.models.functions.text import BytesToCharFieldConversionMixin
from django.db.models.query_utils import Q
@@ -42,10 +51,17 @@ class BaseExpression:
connection: DatabaseWrapper
) -> str: ...
@cached_property
def _output_field_or_none(self) -> Any: ...
def _output_field_or_none(
self
) -> Optional[Union[Field, DateTimeCheckMixin]]: ...
def _parse_expressions(self, *expressions) -> Any: ...
def _prepare(self, field: Any) -> Expression: ...
def _resolve_output_field(self) -> Any: ...
def _prepare(
self,
field: Union[Field, DateTimeCheckMixin, reverse_related.OneToOneRel]
) -> Expression: ...
def _resolve_output_field(
self
) -> Optional[Union[Field, DateTimeCheckMixin]]: ...
def asc(self, **kwargs) -> OrderBy: ...
@cached_property
def contains_aggregate(self) -> bool: ...
@@ -55,21 +71,25 @@ class BaseExpression:
def contains_over_clause(self) -> bool: ...
@cached_property
def convert_value(self) -> Callable: ...
def copy(self) -> BaseExpression: ...
def copy(
self
) -> Union[OrderBy, Expression, SQLiteNumericMixin]: ...
def desc(self, **kwargs) -> OrderBy: ...
@property
def field(self) -> Any: ...
def field(
self
) -> Union[ForeignObjectRel, Field, DateTimeCheckMixin]: ...
def flatten(self) -> Iterator[Union[Value, Func]]: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ...
def get_group_by_cols(
self
) -> Union[List[CombinedExpression], List[Trunc], List[Col]]: ...
def get_lookup(self, lookup: str) -> Any: ...
def get_lookup(self, lookup: str) -> object: ...
def get_source_expressions(self) -> List[Any]: ...
def get_source_fields(self) -> Any: ...
def get_transform(self, name: str) -> Any: ...
@cached_property
def output_field(self) -> Field: ...
def output_field(self) -> Union[Field, DateTimeCheckMixin]: ...
def relabeled_clone(
self,
change_map: Union[OrderedDict, Dict[Union[str, None], str]]
@@ -81,7 +101,7 @@ class BaseExpression:
reuse: Optional[Set[str]] = ...,
summarize: bool = ...,
for_save: bool = ...
) -> BaseExpression: ...
) -> Union[OrderBy, Expression]: ...
def set_source_expressions(self, exprs: List[Any]) -> None: ...
@@ -110,7 +130,12 @@ class Case:
class Col:
def __init__(self, alias: str, target: Field, output_field: Any = ...) -> None: ...
def __init__(
self,
alias: str,
target: Union[Field, DateTimeCheckMixin],
output_field: Optional[Union[reverse_related.ForeignObjectRel, Field]] = ...
) -> None: ...
def __repr__(self) -> str: ...
def as_sql(
self,
@@ -126,7 +151,10 @@ class Col:
class Combinable:
def __add__(self, other: Any) -> CombinedExpression: ...
def __add__(
self,
other: Union[float, timedelta, F, Aggregate]
) -> CombinedExpression: ...
def __mod__(self, other: int) -> CombinedExpression: ...
def __mul__(
self,
@@ -134,16 +162,16 @@ class Combinable:
) -> CombinedExpression: ...
def __radd__(
self,
other: Optional[Union[float, int, timedelta]]
other: Optional[Union[float, timedelta]]
) -> CombinedExpression: ...
def __rand__(self, other: object): ...
def __rmul__(self, other: float) -> CombinedExpression: ...
def __ror__(self, other: object): ...
def __rsub__(self, other: Union[float, int]) -> CombinedExpression: ...
def __rsub__(self, other: float) -> CombinedExpression: ...
def __rtruediv__(self, other: int) -> CombinedExpression: ...
def __sub__(
self,
other: Union[float, timedelta, int, F]
other: Union[float, timedelta, F]
) -> CombinedExpression: ...
def __truediv__(
self,
@@ -158,7 +186,7 @@ class CombinedExpression:
self,
lhs: Combinable,
connector: str,
rhs: Combinable,
rhs: Union[F, Expression],
output_field: None = ...
) -> None: ...
def __str__(self) -> str: ...
@@ -166,7 +194,7 @@ class CombinedExpression:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[datetime]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[float]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[float]], Tuple[str, List[Any]], Tuple[str, List[datetime]]]: ...
def get_source_expressions(self) -> Any: ...
def resolve_expression(
self,
@@ -209,7 +237,7 @@ class Exists:
connection: DatabaseWrapper,
template: None = ...,
**extra_context
) -> Union[Tuple[str, Tuple[int]], Tuple[str, Tuple]]: ...
) -> Union[Tuple[str, Tuple], Tuple[str, Tuple[int]]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -236,10 +264,10 @@ class ExpressionWrapper:
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
def get_source_expressions(
self
) -> Union[List[Q], List[CombinedExpression], List[WhereNode]]: ...
) -> Union[List[CombinedExpression], List[Q], List[WhereNode]]: ...
def set_source_expressions(
self,
exprs: Union[List[WhereNode], List[CombinedExpression]]
exprs: Union[List[CombinedExpression], List[WhereNode]]
) -> None: ...
@@ -289,7 +317,7 @@ class Func:
class OrderBy:
def __init__(
self,
expression: Combinable,
expression: Union[F, Expression],
descending: bool = ...,
nulls_first: bool = ...,
nulls_last: bool = ...

View File

@@ -19,6 +19,7 @@ from typing import (
Any,
List,
Optional,
Type,
Union,
)
@@ -27,7 +28,7 @@ class AutoField:
def __init__(self, *args, **kwargs) -> None: ...
def _check_primary_key(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> None: ...
def get_db_prep_value(
@@ -86,7 +87,7 @@ class CharField:
def check(self, **kwargs) -> List[Error]: ...
def formfield(self, **kwargs) -> Union[CharField, TypedChoiceField]: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: Any) -> object: ...
def get_prep_value(self, value: object) -> object: ...
def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ...
@@ -100,15 +101,15 @@ class DateField:
**kwargs
) -> None: ...
def _check_fix_default_value(self) -> List[Warning]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(
self,
**kwargs
) -> Union[SplitDateTimeField, BaseTemporalField]: ...
) -> Union[BaseTemporalField, SplitDateTimeField]: ...
def get_db_prep_value(
self,
value: Optional[Union[date, str]],
value: Optional[Union[str, date]],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Optional[str]: ...

View File

@@ -18,13 +18,14 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
class FieldFile:
def __eq__(self, other: Optional[Union[Tuple, str, FieldFile]]) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, bool, None]]: ...
def __eq__(self, other: Optional[Union[str, Tuple, FieldFile]]) -> bool: ...
def __getstate__(self) -> Dict[str, Optional[Union[str, bool]]]: ...
def __init__(
self,
instance: Model,
@@ -51,8 +52,8 @@ class FieldFile:
class FileDescriptor:
def __get__(
self,
instance: Any,
cls: Any = ...
instance: Optional[Model],
cls: Type[Model] = ...
) -> Union[FileDescriptor, FieldFile]: ...
def __init__(self, field: FileField) -> None: ...
def __set__(
@@ -74,10 +75,10 @@ class FileField:
def _check_primary_key(self) -> List[Error]: ...
def _check_upload_to(self) -> List[Any]: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
def deconstruct(self) -> Any: ...
def formfield(self, **kwargs) -> FileField: ...
def generate_filename(self, instance: Any, filename: str) -> str: ...
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
def get_internal_type(self) -> str: ...
def get_prep_value(self, value: FieldFile) -> str: ...
def pre_save(

View File

@@ -1,9 +1,17 @@
from django.db.models.base import Model
from typing import Any
from typing import Optional
class FieldCacheMixin:
def delete_cached_value(self, instance: Model) -> None: ...
def get_cached_value(self, instance: Model, default: object = ...) -> Any: ...
def get_cached_value(
self,
instance: Model,
default: object = ...
) -> Optional[Model]: ...
def is_cached(self, instance: Model) -> bool: ...
def set_cached_value(self, instance: Model, value: Any) -> None: ...
def set_cached_value(
self,
instance: Model,
value: Optional[Model]
) -> None: ...

View File

@@ -3,11 +3,13 @@ from django.core.checks.messages import (
Warning,
)
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import Col
from django.db.models.fields import Field
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
ManyToOneRel,
OneToOneRel,
)
from django.db.models.query_utils import (
FilteredRelation,
@@ -21,6 +23,7 @@ from typing import (
List,
Optional,
Tuple,
Type,
Union,
)
from uuid import UUID
@@ -44,10 +47,10 @@ class ForeignKey:
def check(
self,
**kwargs
) -> Union[List[Error], List[Warning]]: ...
) -> Union[List[Warning], List[Error]]: ...
def contribute_to_related_class(
self,
cls: Any,
cls: Type[Model],
related: ManyToOneRel
) -> None: ...
def db_check(self, connection: DatabaseWrapper) -> List[Any]: ...
@@ -57,16 +60,20 @@ class ForeignKey:
def formfield(self, *, using = ..., **kwargs) -> ModelChoiceField: ...
def get_attname(self) -> str: ...
def get_attname_column(self) -> Tuple[str, str]: ...
def get_col(self, alias: str, output_field: Any = ...) -> Col: ...
def get_col(
self,
alias: str,
output_field: Optional[Union[Field, reverse_related.OneToOneRel]] = ...
) -> Col: ...
def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ...
def get_db_prep_save(
self,
value: Any,
value: object,
connection: DatabaseWrapper
) -> Optional[Union[str, int]]: ...
def get_db_prep_value(
self,
value: Union[str, UUID, int],
value: Union[str, int, UUID],
connection: DatabaseWrapper,
prepared: bool = ...
) -> Union[str, int]: ...
@@ -78,7 +85,7 @@ class ForeignKey:
@property
def target_field(self) -> Field: ...
def to_python(self, value: Union[str, int]) -> Union[str, int]: ...
def validate(self, value: int, model_instance: Any) -> None: ...
def validate(self, value: int, model_instance: Optional[Model]) -> None: ...
class ForeignObject:
@@ -86,8 +93,8 @@ class ForeignObject:
self,
to: Any,
on_delete: Callable,
from_fields: Union[Tuple[str, str], List[str]],
to_fields: Union[List[str], List[None], Tuple[str, str]],
from_fields: Union[List[str], Tuple[str, str]],
to_fields: Union[List[None], List[str], Tuple[str, str]],
rel: Optional[ForeignObjectRel] = ...,
related_name: Optional[str] = ...,
related_query_name: None = ...,

View File

@@ -1,5 +1,6 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields.related import ForeignObject
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
@@ -8,24 +9,33 @@ from django.db.models.fields.reverse_related import (
)
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
List,
Optional,
Tuple,
Type,
Union,
)
class ForwardManyToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __get__(
self,
instance: Optional[Model],
cls: Type[Model] = ...
) -> Optional[Union[Model, ForwardManyToOneDescriptor]]: ...
def __init__(self, field_with_rel: ForeignObject) -> None: ...
def __set__(self, instance: Model, value: Any) -> None: ...
def __set__(
self,
instance: Model,
value: Optional[Union[Model, F]]
) -> None: ...
def get_object(self, instance: Model) -> Model: ...
def get_prefetch_queryset(
self,
instances: Any,
instances: List[Model],
queryset: Optional[QuerySet] = ...
) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ...
def get_queryset(self, **hints) -> QuerySet: ...
@@ -33,7 +43,7 @@ class ForwardManyToOneDescriptor:
class ForwardOneToOneDescriptor:
def __set__(self, instance: Model, value: Any) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def get_object(self, instance: Model) -> Model: ...
@@ -45,7 +55,7 @@ class ReverseManyToOneDescriptor:
def __get__(
self,
instance: Optional[Model],
cls: Any = ...
cls: Type[Model] = ...
) -> ReverseManyToOneDescriptor: ...
def __init__(self, rel: ForeignObjectRel) -> None: ...
def _get_set_deprecation_msg_params(self) -> Tuple[str, str]: ...
@@ -54,7 +64,11 @@ class ReverseManyToOneDescriptor:
class ReverseOneToOneDescriptor:
@cached_property
def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ...
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __get__(
self,
instance: Optional[Model],
cls: Type[Model] = ...
) -> Union[Model, ReverseOneToOneDescriptor]: ...
def __init__(self, related: OneToOneRel) -> None: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
def get_queryset(self, **hints) -> QuerySet: ...

View File

@@ -32,13 +32,13 @@ class MultiColSource:
self,
alias: str,
targets: Union[Tuple[IntegerField, related.ForeignKey], Tuple[IntegerField, IntegerField]],
sources: Union[Tuple[AutoField, IntegerField], Tuple[IntegerField, AutoField]],
sources: Union[Tuple[IntegerField, AutoField], Tuple[AutoField, IntegerField]],
field: related.ForeignObject
) -> None: ...
def get_lookup(
self,
lookup: str
) -> Type[Union[RelatedIn, RelatedExact]]: ...
) -> Type[Union[RelatedExact, RelatedIn]]: ...
def relabeled_clone(
self,
relabels: OrderedDict
@@ -50,8 +50,8 @@ class RelatedIn:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
def get_prep_lookup(self) -> Union[List[UUID], Query, List[int], List[str]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def get_prep_lookup(self) -> Union[Query, List[int], List[UUID], List[str]]: ...
class RelatedLookupMixin:
@@ -59,5 +59,5 @@ class RelatedLookupMixin:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def get_prep_lookup(self) -> Any: ...

View File

@@ -44,7 +44,7 @@ class ForeignObjectRel:
def __repr__(self) -> str: ...
@property
def db_type(self) -> Callable: ...
def get_accessor_name(self, model: Any = ...) -> Optional[str]: ...
def get_accessor_name(self, model: Optional[Type[Model]] = ...) -> Optional[str]: ...
def get_cache_name(self) -> str: ...
def get_choices(
self,
@@ -62,7 +62,7 @@ class ForeignObjectRel:
def get_lookup(
self,
lookup_name: str
) -> Type[Union[RelatedIsNull, RelatedIn, RelatedExact]]: ...
) -> Type[Union[RelatedIsNull, RelatedExact, RelatedIn]]: ...
def get_path_info(
self,
filtered_relation: Optional[FilteredRelation] = ...
@@ -81,7 +81,7 @@ class ForeignObjectRel:
@cached_property
def one_to_one(self) -> bool: ...
@cached_property
def related_model(self) -> Any: ...
def related_model(self) -> Type[Model]: ...
@property
def remote_field(
self

View File

@@ -35,7 +35,7 @@ class Concat:
def __init__(self, *expressions, **extra) -> None: ...
def _paired(
self,
expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]]
expressions: Union[Tuple[Value, str, Value], Tuple[Value, str], Tuple[str, str]]
) -> ConcatPair: ...
@@ -75,7 +75,7 @@ class Ord:
compiler: SQLCompiler,
connection: DatabaseWrapper,
**extra_context
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class Replace:

View File

@@ -7,6 +7,7 @@ from django.db.models.expressions import (
Expression,
Ref,
)
from django.db.models.fields.related_lookups import MultiColSource
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
from django.utils.datastructures import OrderedSet
@@ -34,7 +35,7 @@ class BuiltinLookup:
compiler: SQLCompiler,
connection: DatabaseWrapper,
lhs: Optional[Col] = ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
class Exact:
@@ -64,11 +65,11 @@ class FieldGetDbPrepValueIterableMixin:
connection: DatabaseWrapper,
sql: str,
param: Any
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class FieldGetDbPrepValueMixin:
def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Any: ...
def get_db_prep_lookup(self, value: object, connection: DatabaseWrapper) -> Any: ...
class IExact:
@@ -76,7 +77,7 @@ class IExact:
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class In:
@@ -108,7 +109,11 @@ class IsNull:
class Lookup:
def __init__(self, lhs: Any, rhs: Any) -> None: ...
def __init__(
self,
lhs: Union[MultiColSource, Expression],
rhs: object
) -> None: ...
def apply_bilateral_transforms(
self,
value: Expression
@@ -130,7 +135,7 @@ class Lookup:
) -> Union[Tuple[str, List[int]], Tuple[str, List[SafeText]], Tuple[str, List[str]]]: ...
def get_group_by_cols(
self
) -> Union[List[Col], List[CombinedExpression]]: ...
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_prep_lookup(self) -> Any: ...
def get_source_expressions(self) -> List[Col]: ...
def process_lhs(
@@ -147,7 +152,7 @@ class Lookup:
def relabeled_clone(
self,
relabels: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
) -> BuiltinLookup: ...
) -> Union[IsNull, StartsWith, FieldGetDbPrepValueMixin, IContains]: ...
def rhs_is_direct_value(self) -> bool: ...
def set_source_expressions(self, new_exprs: List[Ref]) -> None: ...
@@ -158,7 +163,7 @@ class PatternLookup:
self,
qn: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class Range:
@@ -194,7 +199,7 @@ class YearExact:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
class YearGt:

View File

@@ -1,3 +1,5 @@
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Permission
from django.db.models.base import Model
from django.db.models.query import QuerySet
from typing import (
@@ -16,16 +18,20 @@ class BaseManager:
def __eq__(self, other: Optional[Manager]) -> bool: ...
def __init__(self) -> None: ...
@staticmethod
def __new__(cls: Any, *args, **kwargs) -> Manager: ...
def __new__(cls: Type[Manager], *args, **kwargs) -> Manager: ...
@classmethod
def _get_queryset_methods(cls, queryset_class: Any) -> Dict[str, Callable]: ...
def _get_queryset_methods(cls, queryset_class: Type[QuerySet]) -> Dict[str, Callable]: ...
def _set_creation_counter(self) -> None: ...
def all(self) -> QuerySet: ...
def check(self, **kwargs) -> List[Any]: ...
def contribute_to_class(self, model: Any, name: str) -> None: ...
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
@property
def db(self) -> str: ...
def db_manager(self, using: Optional[str] = ..., hints: Any = ...) -> Manager: ...
def db_manager(
self,
using: Optional[str] = ...,
hints: Optional[Union[Dict[str, Model], Dict[str, LogEntry], Dict[str, Permission]]] = ...
) -> Manager: ...
def deconstruct(
self
) -> Union[Tuple[bool, str, None, Tuple[str, str, int, int], Dict[Any, Any]], Tuple[bool, str, None, Tuple, Dict[Any, Any]]]: ...

View File

@@ -1,7 +1,17 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db.models.base import Model
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.utils.datastructures import ImmutableList
from typing import (
Any,
Dict,
Optional,
Set,
Type,
Union,
)
@@ -11,14 +21,16 @@ class Options:
def __str__(self) -> str: ...
def _expire_cache(self, forward: bool = ..., reverse: bool = ...) -> None: ...
@cached_property
def _forward_fields_map(self) -> Dict[str, Any]: ...
def _forward_fields_map(
self
) -> Dict[str, Union[GenericForeignKey, Field, DateTimeCheckMixin]]: ...
def _get_fields(
self,
forward: bool = ...,
reverse: bool = ...,
include_parents: object = ...,
include_hidden: bool = ...,
seen_models: Any = ...
seen_models: Optional[Set[Type[Model]]] = ...
) -> ImmutableList: ...
def _populate_directed_relation_graph(self) -> Any: ...
def _prepare(self, model: Any) -> None: ...
def _prepare(self, model: Type[Model]) -> None: ...

View File

@@ -6,6 +6,7 @@ from typing import (
Iterator,
Optional,
Tuple,
Type,
Union,
)
@@ -37,7 +38,7 @@ class NamedValuesListIterable:
class Prefetch:
def __eq__(self, other: None) -> bool: ...
def __getstate__(self) -> Dict[str, Union[str, QuerySet, None]]: ...
def __getstate__(self) -> Dict[str, Optional[Union[str, QuerySet]]]: ...
def __hash__(self) -> int: ...
def __init__(
self,
@@ -58,7 +59,7 @@ class QuerySet:
def __getstate__(self) -> Dict[str, Any]: ...
def __init__(
self,
model: Any = ...,
model: Type[Model] = ...,
query: Optional[Query] = ...,
using: Optional[str] = ...,
hints: Dict[str, Model] = ...

View File

@@ -2,9 +2,16 @@ from collections import OrderedDict
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
from django.db.models.expressions import F
from django.db.models.fields import Field
from django.db.models.fields import (
DateTimeCheckMixin,
Field,
)
from django.db.models.fields.related import ForeignKey
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.lookups import (
Lookup,
Transform,
)
from django.db.models.options import Options
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.query import Query
@@ -17,12 +24,13 @@ from typing import (
Optional,
Set,
Tuple,
Type,
Union,
)
def check_rel_lookup_compatibility(
model: Any,
model: Type[Model],
target_opts: Options,
field: Union[ManyToOneRel, ForeignKey]
) -> bool: ...
@@ -32,7 +40,7 @@ def refs_expression(lookup_parts: List[str], annotations: OrderedDict) -> Any: .
def select_related_descend(
field: Field,
field: Union[Field, DateTimeCheckMixin],
restricted: bool,
requested: Any,
load_fields: Optional[Set[str]],
@@ -40,15 +48,17 @@ def select_related_descend(
) -> bool: ...
def subclasses(cls: Any) -> Iterator[Any]: ...
def subclasses(
cls: Type[Union[Field, Transform]]
) -> Iterator[Type[Union[Field, Transform]]]: ...
class DeferredAttribute:
def __get__(
self,
instance: Any,
cls: Any = ...
) -> Optional[Union[DeferredAttribute, str, int]]: ...
instance: Optional[Model],
cls: Type[Model] = ...
) -> Optional[Union[str, int, DeferredAttribute]]: ...
def __init__(self, field_name: str) -> None: ...
def _check_parent_chain(self, instance: Model, name: str) -> None: ...
@@ -60,7 +70,7 @@ class FilteredRelation:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[int, str]]], Tuple[str, List[Any]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]], Tuple[str, List[Union[int, str]]]]: ...
def clone(self) -> FilteredRelation: ...
@@ -72,7 +82,7 @@ class Q:
def _combine(self, other: Q, conn: str) -> Q: ...
def deconstruct(
self
) -> Union[Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
) -> Union[Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ...
def resolve_expression(
self,
query: Query = ...,
@@ -98,12 +108,22 @@ class RegisterLookupMixin:
@classmethod
def _get_lookup(cls, lookup_name: str) -> Any: ...
@classmethod
def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> None: ...
def _unregister_lookup(
cls,
lookup: Type[Union[Lookup, Transform]],
lookup_name: Optional[str] = ...
) -> None: ...
def get_lookup(self, lookup_name: str) -> Any: ...
@classmethod
def get_lookups(cls) -> Dict[str, Any]: ...
def get_transform(self, lookup_name: str) -> Any: ...
def get_lookups(cls) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
def get_transform(self, lookup_name: str) -> object: ...
@staticmethod
def merge_dicts(dicts: Any) -> Dict[str, Any]: ...
def merge_dicts(
dicts: Any
) -> Dict[str, Type[Union[Lookup, Transform]]]: ...
@classmethod
def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Any: ...
def register_lookup(
cls,
lookup: Type[Union[Lookup, Transform]],
lookup_name: Optional[str] = ...
) -> Type[Union[Lookup, Transform]]: ...

View File

@@ -1,8 +1,12 @@
from django.apps.registry import Apps
from django.contrib.sites.models import Site
from django.db.models.base import Model
from typing import (
Any,
Callable,
Optional,
Type,
Union,
)
@@ -18,7 +22,7 @@ class ModelSignal:
def connect(
self,
receiver: Callable,
sender: Any = ...,
sender: Optional[Union[Type[Site], Type[Model]]] = ...,
weak: bool = ...,
dispatch_uid: None = ...,
apps: None = ...
@@ -26,7 +30,7 @@ class ModelSignal:
def disconnect(
self,
receiver: Callable = ...,
sender: Any = ...,
sender: Optional[Type[Model]] = ...,
dispatch_uid: None = ...,
apps: None = ...
) -> bool: ...

View File

@@ -1,5 +1,6 @@
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.backends.utils import CursorWrapper
from django.db.models.base import Model
from django.db.models.expressions import (
Col,
CombinedExpression,
@@ -21,6 +22,7 @@ from typing import (
Optional,
Set,
Tuple,
Type,
Union,
)
@@ -44,14 +46,14 @@ class SQLCompiler:
alias: str,
columns: List[str],
compiler: SQLCompiler
) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ...
) -> Union[Tuple[str, Tuple], Tuple[str, Tuple[str]]]: ...
def collapse_group_by(
self,
expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]],
having: Union[List[Col], Tuple, List[CombinedExpression]]
) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ...
expressions: Union[List[Union[Col, CombinedExpression]], List[Expression], List[Col], List[Union[Col, Trunc]]],
having: Union[List[CombinedExpression], List[Col], Tuple]
) -> Union[List[Union[Col, CombinedExpression]], List[Expression], List[Col], List[Union[Col, Trunc]]]: ...
def compile(self, node: Any, select_format: object = ...) -> Any: ...
def deferred_to_columns(self) -> Any: ...
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
def execute_sql(
self,
result_type: str = ...,
@@ -65,7 +67,7 @@ class SQLCompiler:
opts: Options,
alias: Optional[str] = ...,
default_order: str = ...,
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ...
already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]] = ...
) -> List[Tuple[OrderBy, bool]]: ...
def get_combinator_sql(
self,
@@ -77,22 +79,22 @@ class SQLCompiler:
self,
start_alias: Optional[str] = ...,
opts: Optional[Options] = ...,
from_parent: Any = ...
from_parent: Optional[Type[Model]] = ...
) -> List[Col]: ...
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
def get_extra_select(
self,
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]],
order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]]],
select: Any
) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ...
def get_from_clause(
self
) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ...
def get_group_by(
self,
select: Any,
order_by: Any
) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
) -> Union[List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ...
def get_order_by(self) -> Any: ...
def get_related_selections(
self,
@@ -102,7 +104,7 @@ class SQLCompiler:
cur_depth: int = ...,
requested: Any = ...,
restricted: Optional[bool] = ...
) -> Any: ...
) -> List[Dict[str, Any]]: ...
def get_select(self) -> Any: ...
def has_results(self) -> bool: ...
def pre_sql_setup(self) -> Any: ...

View File

@@ -31,7 +31,7 @@ class BaseTable:
class Join:
def __eq__(
self,
other: Union[Join, BaseTable]
other: Union[BaseTable, Join]
) -> bool: ...
def __init__(
self,
@@ -47,17 +47,17 @@ class Join:
self,
compiler: SQLCompiler,
connection: DatabaseWrapper
) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ...
) -> Union[Tuple[str, List[int]], Tuple[str, List[str]], Tuple[str, List[Any]]]: ...
def demote(self) -> Join: ...
def equals(
self,
other: Union[Join, BaseTable],
other: Union[BaseTable, Join],
with_filtered_relation: bool
) -> bool: ...
def promote(self) -> Join: ...
def relabeled_clone(
self,
change_map: Union[Dict[str, str], OrderedDict]
change_map: Union[OrderedDict, Dict[str, str]]
) -> Join: ...

View File

@@ -1,6 +1,6 @@
from django.db.models.base import Model
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Set,
Tuple,
Type,
@@ -10,9 +10,13 @@ from typing import (
class JoinPromoter:
def __init__(self, connector: str, num_children: int, negated: bool) -> None: ...
def add_votes(self, votes: Union[Tuple, Set[str]]) -> None: ...
def add_votes(self, votes: Union[Set[str], Tuple]) -> None: ...
def update_join_types(self, query: Query) -> Set[str]: ...
class Query:
def __init__(self, model: Any, where: Type[WhereNode] = ...) -> None: ...
def __init__(
self,
model: Type[Model],
where: Type[WhereNode] = ...
) -> None: ...

View File

@@ -41,4 +41,4 @@ class UpdateQuery:
def add_update_values(self, values: Dict[str, Any]) -> None: ...
def clone(self) -> UpdateQuery: ...
def get_related_updates(self) -> List[UpdateQuery]: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ...
def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ...

View File

@@ -79,7 +79,7 @@ class WhereNode:
) -> Union[List[CombinedExpression], List[Col]]: ...
def get_source_expressions(
self
) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ...
) -> Union[List[GreaterThan], List[LessThanOrEqual], List[Exact], List[IntegerLessThan]]: ...
def relabel_aliases(
self,
change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]]
@@ -96,4 +96,4 @@ class WhereNode:
def split_having(
self,
negated: bool = ...
) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ...
) -> Union[Tuple[None, WhereNode], Tuple[WhereNode, WhereNode], Tuple[WhereNode, None]]: ...

View File

@@ -1,4 +1,7 @@
from django.apps.config import AppConfig
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.models import Session
from django.contrib.sites.models import Site
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models.base import Model
@@ -7,6 +10,8 @@ from typing import (
Callable,
Dict,
List,
Type,
Union,
)
@@ -27,16 +32,16 @@ class ConnectionHandler:
class ConnectionRouter:
def __init__(self, routers: None = ...) -> None: ...
def allow_migrate(self, db: str, app_label: str, **hints) -> bool: ...
def allow_migrate_model(self, db: str, model: Any) -> bool: ...
def allow_migrate_model(self, db: str, model: Type[Model]) -> bool: ...
def allow_relation(self, obj1: Model, obj2: Model, **hints) -> bool: ...
def get_migratable_models(
self,
app_config: AppConfig,
db: str,
include_auto_created: bool = ...
) -> Any: ...
) -> Union[List[Type[Model]], List[Type[Site]], List[Type[Session]], List[Type[ContentType]]]: ...
@cached_property
def routers(self) -> Any: ...
def routers(self) -> List[object]: ...
class DatabaseErrorWrapper:

Some files were not shown because too many files have changed in this diff Show More