initial commit

This commit is contained in:
Maxim Kurnikov
2018-07-29 18:12:23 +03:00
commit a9f215bf64
311 changed files with 13433 additions and 0 deletions

1
django/__init__.pyi Normal file
View File

@@ -0,0 +1 @@
def setup(set_prefix: bool = ...) -> None: ...

15
django/apps/config.pyi Normal file
View File

@@ -0,0 +1,15 @@
from typing import (
Any,
Iterator,
)
class AppConfig:
def __init__(self, app_name: str, app_module: Any) -> None: ...
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 import_models(self) -> None: ...
def ready(self) -> None: ...

23
django/apps/registry.pyi Normal file
View File

@@ -0,0 +1,23 @@
from django.apps.config import AppConfig
from django.db.migrations.state import AppConfigStub
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class Apps:
def __init__(
self,
installed_apps: Union[Tuple, List[AppConfigStub], List[str]] = ...
) -> 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 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: ...

27
django/conf/__init__.pyi Normal file
View File

@@ -0,0 +1,27 @@
from typing import (
Any,
List,
)
class LazySettings:
def __delattr__(self, name: str) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: object) -> None: ...
def _setup(self, name: None = ...): ...
def configure(self, default_settings: Any = ..., **options): ...
@property
def configured(self) -> bool: ...
class Settings:
def __init__(self, settings_module: str): ...
def is_overridden(self, setting: str) -> bool: ...
class UserSettingsHolder:
def __delattr__(self, name: str) -> None: ...
def __dir__(self) -> List[str]: ...
def __getattr__(self, name: str) -> Any: ...
def __init__(self, default_settings: Any) -> None: ...
def __setattr__(self, name: str, value: Any) -> None: ...

View File

@@ -0,0 +1,17 @@
from django.urls.resolvers import (
URLPattern,
URLResolver,
)
from typing import (
Any,
Optional,
Union,
)
def url(
regex: str,
view: Any,
kwargs: Any = ...,
name: Optional[str] = ...
) -> Union[URLResolver, URLPattern]: ...

16
django/conf/urls/i18n.pyi Normal file
View File

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

View File

@@ -0,0 +1,8 @@
from django.urls.resolvers import URLPattern
from typing import (
Callable,
List,
)
def static(prefix: str, view: Callable = ..., **kwargs) -> List[URLPattern]: ...

View File

@@ -0,0 +1 @@
def autodiscover() -> None: ...

View File

@@ -0,0 +1,11 @@
from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.query import QuerySet
from django.template.response import TemplateResponse
def delete_selected(
modeladmin: ModelAdmin,
request: WSGIRequest,
queryset: QuerySet
) -> TemplateResponse: ...

View File

@@ -0,0 +1,6 @@
class AdminConfig:
def ready(self) -> None: ...
class SimpleAdminConfig:
def ready(self) -> None: ...

View File

@@ -0,0 +1,132 @@
from django.contrib.admin.options import (
BaseModelAdmin,
InlineModelAdmin,
ModelAdmin,
TabularInline,
)
from django.contrib.auth.models import (
Group,
User,
)
from django.core.checks.messages import Error
from django.db.models.base import Model
from typing import (
Any,
List,
Tuple,
Type,
Union,
)
class BaseModelAdminChecks:
def _check_autocomplete_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_autocomplete_fields_item(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_exclude(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_field_spec(
self,
obj: BaseModelAdmin,
model: Any,
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,
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_fieldsets_item(
self,
obj: BaseModelAdmin,
model: Any,
fieldset: Any,
label: str,
seen_fields: List[str]
) -> List[Any]: ...
def _check_filter_horizontal(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_filter_item(
self,
obj: ModelAdmin,
model: Type[Union[Group, User]],
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_ordering_item(
self,
obj: ModelAdmin,
model: Any,
field_name: str,
label: str
) -> List[Any]: ...
def _check_prepopulated_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_prepopulated_fields_key(
self,
obj: Union[ModelAdmin, InlineModelAdmin],
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_prepopulated_fields_value(
self,
obj: BaseModelAdmin,
model: Type[Model],
val: Union[Tuple[str], List[str]],
label: str
) -> List[Any]: ...
def _check_prepopulated_fields_value_item(
self,
obj: Union[ModelAdmin, TabularInline],
model: Type[Model],
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_raw_id_fields_item(
self,
obj: ModelAdmin,
model: Type[Model],
field_name: str,
label: str
) -> List[Any]: ...
def _check_readonly_fields(self, obj: BaseModelAdmin) -> List[Any]: ...
def _check_readonly_fields_item(
self,
obj: BaseModelAdmin,
model: Any,
field_name: str,
label: str
) -> List[Any]: ...
def _check_view_on_site_url(self, obj: BaseModelAdmin) -> List[Any]: ...
def check(
self,
admin_obj: BaseModelAdmin,
**kwargs
) -> List[Error]: ...
class InlineModelAdminChecks:
def _check_exclude_of_parent_model(
self,
obj: InlineModelAdmin,
parent_model: Any
) -> 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]: ...

View File

@@ -0,0 +1,4 @@
from typing import Callable
def register(*models, site = ...) -> Callable: ...

View File

@@ -0,0 +1,159 @@
from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.fields import (
BooleanField,
DateField,
Field,
)
from django.db.models.fields.related import (
ForeignKey,
ManyToManyField,
)
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class AllValuesFieldListFilter:
def __init__(
self,
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
def expected_parameters(self) -> List[str]: ...
class BooleanFieldListFilter:
def __init__(
self,
field: BooleanField,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
def expected_parameters(self) -> List[str]: ...
class ChoicesFieldListFilter:
def __init__(
self,
field: Field,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
def expected_parameters(self) -> List[str]: ...
class DateFieldListFilter:
def __init__(
self,
field: DateField,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin,
field_path: str
) -> None: ...
def expected_parameters(self) -> List[str]: ...
class FieldListFilter:
def __init__(
self,
field: Any,
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model_admin: ModelAdmin,
field_path: str
) -> None: ...
@classmethod
def create(
cls,
field: Any,
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model_admin: ModelAdmin,
field_path: str
) -> FieldListFilter: ...
def has_output(self) -> bool: ...
def queryset(
self,
request: WSGIRequest,
queryset: QuerySet
) -> QuerySet: ...
@classmethod
def register(cls, test: Callable, list_filter_class: Any, take_priority: bool = ...) -> None: ...
class ListFilter:
def __init__(
self,
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model_admin: ModelAdmin
) -> None: ...
class RelatedFieldListFilter:
def __init__(
self,
field: Union[ForeignObjectRel, ManyToManyField, ForeignKey],
request: WSGIRequest,
params: Dict[str, str],
model: Any,
model_admin: ModelAdmin,
field_path: str
) -> None: ...
def expected_parameters(self) -> List[str]: ...
def field_choices(
self,
field: Union[ForeignObjectRel, ManyToManyField, ForeignKey],
request: WSGIRequest,
model_admin: ModelAdmin
) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ...
def has_output(self) -> bool: ...
@property
def include_empty_choice(self) -> bool: ...
class RelatedOnlyFieldListFilter:
def field_choices(
self,
field: Union[ManyToManyField, ForeignKey],
request: WSGIRequest,
model_admin: ModelAdmin
) -> Union[List[Tuple[int, str]], List[Tuple[str, str]]]: ...
class SimpleListFilter:
def __init__(
self,
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
model_admin: ModelAdmin
) -> None: ...
def has_output(self) -> bool: ...
def value(self) -> Optional[str]: ...

View File

@@ -0,0 +1,5 @@
from django.contrib.auth.models import User
class AdminAuthenticationForm:
def confirm_login_allowed(self, user: User) -> None: ...

View File

@@ -0,0 +1,75 @@
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.fields import AutoField
from django.forms.utils import ErrorDict
from django.forms.widgets import Media
from django.utils.safestring import SafeText
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
Tuple,
Union,
)
class AdminField:
def errors(self) -> SafeText: ...
def label_tag(self) -> SafeText: ...
class AdminForm:
def __init__(
self,
form: AdminPasswordChangeForm,
fieldsets: List[Tuple[None, Dict[str, List[str]]]],
prepopulated_fields: Dict[Any, Any],
readonly_fields: None = ...,
model_admin: None = ...
) -> None: ...
def __iter__(self) -> Iterator[Fieldset]: ...
@property
def errors(self) -> ErrorDict: ...
@property
def media(self) -> Media: ...
@property
def non_field_errors(self) -> Callable: ...
class AdminReadonlyField:
def contents(self) -> SafeText: ...
def label_tag(self) -> SafeText: ...
class Fieldline:
def __iter__(
self
) -> Iterator[Union[AdminField, AdminReadonlyField]]: ...
def errors(self) -> SafeText: ...
class Fieldset:
def __iter__(self) -> Iterator[Fieldline]: ...
@property
def media(self) -> Media: ...
class InlineAdminForm:
def __iter__(self) -> Iterator[InlineFieldset]: ...
def deletion_field(self) -> AdminField: ...
def fk_field(self) -> AdminField: ...
def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ...
def pk_field(self) -> AdminField: ...
class InlineAdminFormSet:
def __iter__(self) -> Iterator[InlineAdminForm]: ...
def fields(self) -> Iterator[Dict[str, Any]]: ...
def inline_formset_data(self) -> str: ...
@property
def media(self) -> Media: ...
class InlineFieldset:
def __iter__(self) -> Iterator[Fieldline]: ...

View File

@@ -0,0 +1,22 @@
from typing import Any
class LogEntry:
def __str__(self) -> str: ...
def get_admin_url(self) -> str: ...
def get_change_message(self) -> str: ...
def is_addition(self) -> bool: ...
def is_change(self) -> bool: ...
def is_deletion(self) -> bool: ...
class LogEntryManager:
def log_action(
self,
user_id: int,
content_type_id: int,
object_id: int,
object_repr: str,
action_flag: int,
change_message: Any = ...
) -> LogEntry: ...

View File

@@ -0,0 +1,73 @@
from django.core.checks.messages import Error
from django.core.handlers.wsgi import WSGIRequest
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.models import (
ModelChoiceField,
ModelMultipleChoiceField,
)
from django.utils.safestring import SafeText
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
)
class BaseModelAdmin:
def __init__(self) -> None: ...
def check(self, **kwargs) -> List[Error]: ...
def formfield_for_choice_field(
self,
db_field: Field,
request: object,
**kwargs
) -> TypedChoiceField: ...
def formfield_for_dbfield(self, db_field: Field, request: object, **kwargs) -> Any: ...
def formfield_for_foreignkey(
self,
db_field: ForeignKey,
request: object,
**kwargs
) -> Optional[ModelChoiceField]: ...
def formfield_for_manytomany(
self,
db_field: ManyToManyField,
request: WSGIRequest,
**kwargs
) -> 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_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_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
def get_prepopulated_fields(
self,
request: WSGIRequest,
obj: Any = ...
) -> 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 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_module_permission(self, request: object) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Any = ...) -> bool: ...

View File

@@ -0,0 +1,77 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import (
HttpResponse,
HttpResponseRedirect,
)
from django.template.response import TemplateResponse
from django.urls.resolvers import (
URLPattern,
URLResolver,
)
from typing import (
Any,
Callable,
Dict,
List,
Tuple,
Union,
)
class AdminSite:
def __init__(self, name: str = ...) -> None: ...
def _build_app_dict(self, request: WSGIRequest, label: None = ...) -> Dict[Any, Any]: ...
def add_action(self, action: Callable, name: None = ...) -> None: ...
def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ...
def app_index(
self,
request: WSGIRequest,
app_label: str,
extra_context: None = ...
) -> TemplateResponse: ...
def check(self, app_configs: None) -> List[Any]: ...
def get_action(self, name: str) -> Callable: ...
def get_app_list(self, request: WSGIRequest) -> List[Any]: ...
def get_urls(self) -> List[Union[URLPattern, URLResolver]]: ...
def has_permission(self, request: WSGIRequest) -> bool: ...
def i18n_javascript(
self,
request: WSGIRequest,
extra_context: None = ...
) -> HttpResponse: ...
def index(
self,
request: WSGIRequest,
extra_context: None = ...
) -> TemplateResponse: ...
def is_registered(self, model: Any) -> bool: ...
def login(
self,
request: WSGIRequest,
extra_context: None = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def logout(
self,
request: WSGIRequest,
extra_context: None = ...
) -> TemplateResponse: ...
def password_change(
self,
request: WSGIRequest,
extra_context: Dict[str, str] = ...
) -> TemplateResponse: ...
def password_change_done(
self,
request: WSGIRequest,
extra_context: None = ...
) -> TemplateResponse: ...
def register(self, model_or_iterable: Any, admin_class: Any = ..., **options) -> None: ...
def unregister(self, model_or_iterable: Any) -> None: ...
@property
def urls(
self
) -> Union[Tuple[List[Union[URLPattern, URLResolver]], str, str], Tuple[List[URLPattern], str, str]]: ...
class DefaultAdminSite:
def _setup(self) -> None: ...

View File

@@ -0,0 +1,109 @@
from django.contrib.admin.filters import FieldListFilter
from django.contrib.admin.templatetags.base import InclusionAdminNode
from django.contrib.admin.views.main import ChangeList
from django.db.models.base import Model
from django.forms.boundfield import BoundField
from django.template.base import (
Parser,
Token,
)
from django.template.context import RequestContext
from django.utils.safestring import SafeText
from typing import (
Any,
Callable,
Dict,
Iterator,
Optional,
Union,
)
def _boolean_icon(field_val: Optional[bool]) -> SafeText: ...
def _coerce_field_name(field_name: Union[str, Callable], field_index: int) -> str: ...
def admin_actions(context: RequestContext) -> RequestContext: ...
def admin_actions_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def admin_list_filter(
cl: ChangeList,
spec: FieldListFilter
) -> SafeText: ...
def change_list_object_tools_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def date_hierarchy(cl: ChangeList) -> Any: ...
def date_hierarchy_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def items_for_result(
cl: ChangeList,
result: Model,
form: None
) -> Iterator[SafeText]: ...
def pagination(cl: ChangeList) -> Dict[str, Any]: ...
def pagination_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def paginator_number(cl: ChangeList, i: int) -> SafeText: ...
def result_headers(cl: ChangeList) -> Iterator[Dict[str, Union[None, int, str]]]: ...
def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ...
def result_list(cl: ChangeList) -> Dict[str, Any]: ...
def result_list_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def results(
cl: ChangeList
) -> Iterator[ResultList]: ...
def search_form(
cl: ChangeList
) -> Dict[str, Union[ChangeList, bool, str]]: ...
def search_form_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
class ResultList:
def __init__(self, form: None, *items) -> None: ...

View File

@@ -0,0 +1,37 @@
from django.contrib.admin.helpers import InlineAdminForm
from django.contrib.admin.templatetags.base import InclusionAdminNode
from django.template.base import (
Parser,
Token,
)
from django.template.context import (
Context,
RequestContext,
)
def cell_count(inline_admin_form: InlineAdminForm) -> int: ...
def change_form_object_tools_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def prepopulated_fields_js(context: RequestContext) -> RequestContext: ...
def prepopulated_fields_js_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...
def submit_row(context: RequestContext) -> Context: ...
def submit_row_tag(
parser: Parser,
token: Token
) -> InclusionAdminNode: ...

View File

@@ -0,0 +1 @@
def static(path: str) -> str: ...

View File

@@ -0,0 +1,23 @@
from django.db.models.options import Options
from django.template.context import RequestContext
from django.utils.safestring import SafeText
from typing import (
Dict,
Optional,
Union,
)
from uuid import UUID
def add_preserved_filters(
context: Union[Dict[str, Union[str, Options]], RequestContext],
url: str,
popup: bool = ...,
to_field: Optional[str] = ...
) -> str: ...
def admin_urlname(value: Options, arg: SafeText) -> str: ...
def admin_urlquote(value: Union[str, UUID, int]) -> Union[str, UUID, int]: ...

View File

@@ -0,0 +1,19 @@
from django.template.base import (
Parser,
Token,
)
from django.template.context import Context
from django.utils.safestring import SafeText
from typing import Callable
class InclusionAdminNode:
def __init__(
self,
parser: Parser,
token: Token,
func: Callable,
template_name: str,
takes_context: bool = ...
) -> None: ...
def render(self, context: Context) -> SafeText: ...

View File

@@ -0,0 +1,16 @@
from django.template.base import (
Parser,
Token,
)
from django.template.context import Context
def get_admin_log(
parser: Parser,
token: Token
) -> AdminLogNode: ...
class AdminLogNode:
def __init__(self, limit: str, varname: str, user: str) -> None: ...
def render(self, context: Context) -> str: ...

View File

@@ -0,0 +1,99 @@
from datetime import datetime
from django.contrib.admin.options import (
ModelAdmin,
TabularInline,
)
from django.contrib.auth.forms import AdminPasswordChangeForm
from django.db.models.base import Model
from django.db.models.fields.reverse_related import ManyToOneRel
from django.db.models.options import Options
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
from uuid import UUID
def _get_non_gfk_field(opts: Options, name: Union[str, Callable]) -> Any: ...
def construct_change_message(
form: AdminPasswordChangeForm,
formsets: None,
add: bool
) -> List[Dict[str, Dict[str, List[str]]]]: ...
def display_for_field(value: Any, field: Any, empty_value_display: str) -> str: ...
def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ...
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 get_fields_from_path(model: Any, path: str) -> Any: ...
def get_model_from_relation(field: Any) -> Any: ...
def help_text_for_field(name: str, model: Any) -> str: ...
def label_for_field(
name: Union[str, Callable],
model: Any,
model_admin: Optional[Union[ModelAdmin, TabularInline]] = ...,
return_attr: bool = ...
) -> Any: ...
def lookup_field(
name: Union[str, Callable],
obj: Model,
model_admin: Union[ModelAdmin, TabularInline] = ...
) -> Any: ...
def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ...
def model_ngettext(obj: QuerySet, n: None = ...) -> str: ...
def prepare_lookup_value(key: str, value: Union[str, datetime]) -> Union[bool, datetime, str]: ...
def quote(s: Union[str, UUID, int]) -> Union[str, UUID, int]: ...
def reverse_field_path(model: Type[Model], path: str) -> Any: ...
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 can_fast_delete(self, *args, **kwargs) -> bool: ...
def collect(self, objs: Any, source: Any = ..., source_attr: Optional[str] = ..., **kwargs) -> None: ...
def nested(self, format_callback: Callable = ...) -> Any: ...
def related_objects(
self,
related: ManyToOneRel,
objs: Any
) -> QuerySet: ...

View File

@@ -0,0 +1,11 @@
from django.core.handlers.wsgi import WSGIRequest
from django.core.paginator import Paginator
from django.db.models.query import QuerySet
from django.http.response import JsonResponse
class AutocompleteJsonView:
def get(self, request: WSGIRequest, *args, **kwargs) -> JsonResponse: ...
def get_paginator(self, *args, **kwargs) -> Paginator: ...
def get_queryset(self) -> QuerySet: ...
def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ...

View File

@@ -0,0 +1,8 @@
from typing import Callable
def staff_member_required(
view_func: None = ...,
redirect_field_name: str = ...,
login_url: str = ...
) -> Callable: ...

View File

@@ -0,0 +1,55 @@
from collections import OrderedDict
from django.contrib.admin.filters import SimpleListFilter
from django.contrib.admin.options import ModelAdmin
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.expressions import CombinedExpression
from django.db.models.query import QuerySet
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
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]],
date_hierarchy: Optional[str],
search_fields: Union[List[str], Tuple],
list_select_related: bool,
list_per_page: int,
list_max_show_all: int,
list_editable: Union[List[str], Tuple],
model_admin: ModelAdmin,
sortable_by: Any
) -> None: ...
def _get_default_ordering(self) -> Union[List[str], Tuple[str], Tuple[str, str]]: ...
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...
def get_filters(self, request: WSGIRequest) -> Any: ...
def get_filters_params(self, params: None = ...) -> Dict[str, str]: ...
def get_ordering(
self,
request: WSGIRequest,
queryset: QuerySet
) -> List[str]: ...
def get_ordering_field(
self,
field_name: Union[str, Callable]
) -> Optional[Union[str, CombinedExpression]]: ...
def get_ordering_field_columns(self) -> OrderedDict: ...
def get_query_string(self, new_params: Any = ..., remove: Optional[List[str]] = ...) -> str: ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
def get_results(self, request: WSGIRequest) -> None: ...
def has_related_field_in_list_display(self) -> bool: ...
def url_for_result(self, result: Model) -> str: ...

View File

@@ -0,0 +1,149 @@
from datetime import datetime
from django.contrib.admin.sites import AdminSite
from django.db.models.fields.reverse_related import (
ForeignObjectRel,
ManyToOneRel,
)
from django.forms.widgets import (
Media,
Select,
)
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
from typing import (
Any,
Dict,
List,
Optional,
Set,
Tuple,
Union,
)
def url_params_from_lookup_dict(lookups: Dict[str, Union[str, int]]) -> Dict[str, str]: ...
class AdminDateWidget:
def __init__(self, attrs: None = ..., format: None = ...) -> None: ...
@property
def media(self) -> Media: ...
class AdminEmailInputWidget:
def __init__(self, attrs: None = ...) -> None: ...
class AdminIntegerFieldWidget:
def __init__(self, attrs: None = ...) -> None: ...
class AdminSplitDateTime:
def __init__(self, attrs: None = ...) -> None: ...
def get_context(
self,
name: str,
value: Optional[datetime],
attrs: Dict[str, Union[bool, str]]
) -> Dict[str, Any]: ...
class AdminTextInputWidget:
def __init__(self, attrs: None = ...) -> None: ...
class AdminTextareaWidget:
def __init__(self, attrs: None = ...) -> None: ...
class AdminTimeWidget:
def __init__(self, attrs: None = ..., format: None = ...) -> None: ...
@property
def media(self) -> Media: ...
class AdminURLFieldWidget:
def __init__(self, attrs: None = ...) -> None: ...
def get_context(
self,
name: str,
value: None,
attrs: Dict[str, str]
) -> Dict[str, Union[Dict[str, Union[str, bool, None, Dict[str, str]]], str]]: ...
class AutocompleteMixin:
def __init__(
self,
rel: ManyToOneRel,
admin_site: AdminSite,
attrs: None = ...,
choices: Tuple = ...,
using: None = ...
) -> None: ...
def build_attrs(self, base_attrs: Dict[Any, Any], extra_attrs: Dict[str, str] = ...) -> Dict[str, str]: ...
def get_url(self) -> str: ...
@property
def media(self) -> Media: ...
def optgroups(
self,
name: str,
value: List[str],
attr: Dict[str, str] = ...
) -> Union[List[Tuple[None, List[Dict[str, Union[str, int, Set[str], Dict[str, bool]]]], int]], List[Tuple[None, List[Dict[str, Union[bool, str]]], int]]]: ...
class FilteredSelectMultiple:
def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ...
@property
def media(self) -> Media: ...
class ForeignKeyRawIdWidget:
def __init__(
self,
rel: ManyToOneRel,
admin_site: AdminSite,
attrs: None = ...,
using: None = ...
) -> None: ...
def base_url_parameters(self) -> Dict[str, str]: ...
def get_context(
self,
name: str,
value: None,
attrs: Dict[str, Union[bool, str]]
) -> Dict[str, Union[Dict[str, Union[str, bool, None, Dict[str, Union[bool, str]]]], str]]: ...
def url_parameters(self) -> Dict[str, str]: ...
class RelatedFieldWidgetWrapper:
def __deepcopy__(self, memo: Dict[int, Any]) -> RelatedFieldWidgetWrapper: ...
def __init__(
self,
widget: Union[Select, AdminRadioSelect],
rel: ForeignObjectRel,
admin_site: AdminSite,
can_add_related: Optional[bool] = ...,
can_change_related: bool = ...,
can_delete_related: bool = ...,
can_view_related: bool = ...
) -> None: ...
def get_context(
self,
name: str,
value: Optional[Union[str, int]],
attrs: Dict[str, str]
) -> Dict[str, Union[bool, str]]: ...
def get_related_url(self, info: Tuple[str, str], action: str, *args) -> str: ...
def id_for_label(self, id_: str) -> str: ...
@property
def is_hidden(self) -> bool: ...
@property
def media(self) -> Media: ...
def value_from_datadict(
self,
data: QueryDict,
files: MultiValueDict,
name: str
) -> Optional[str]: ...

View File

@@ -0,0 +1,19 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponse
from typing import (
Any,
Callable,
Dict,
Optional,
Tuple,
)
class XViewMiddleware:
def process_view(
self,
request: WSGIRequest,
view_func: Callable,
view_args: Tuple,
view_kwargs: Dict[Any, Any]
) -> Optional[HttpResponse]: ...

View File

@@ -0,0 +1,10 @@
from typing import Callable
def get_view_name(view_func: Callable) -> str: ...
def replace_named_groups(pattern: str) -> str: ...
def replace_unnamed_groups(pattern: str) -> str: ...

View File

@@ -0,0 +1,4 @@
from django.db.models.fields import Field
def get_readable_field_data_type(field: Field) -> str: ...

View File

@@ -0,0 +1,70 @@
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import (
AnonymousUser,
User,
)
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.options import Options
from django.http.request import HttpRequest
from django.utils.functional import SimpleLazyObject
from test_client.auth_backends import BackendWithoutGetUserMethod
from typing import (
Any,
Dict,
List,
Optional,
Type,
Union,
)
def _clean_credentials(credentials: Dict[str, Union[str, None]]) -> Dict[str, Union[str, None]]: ...
def _get_backends(return_tuples: bool = ...) -> Any: ...
def _get_user_session_key(request: HttpRequest) -> int: ...
def authenticate(
request: Optional[HttpRequest] = ...,
**credentials
) -> Optional[AbstractBaseUser]: ...
def get_backends() -> List[ModelBackend]: ...
def get_permission_codename(action: str, opts: Options) -> str: ...
def get_user(
request: HttpRequest
) -> Union[AnonymousUser, AbstractBaseUser]: ...
def get_user_model() -> Type[Model]: ...
def load_backend(
path: str
) -> Union[ModelBackend, BackendWithoutGetUserMethod]: ...
def login(
request: HttpRequest,
user: User,
backend: Optional[Union[str, Type[ModelBackend]]] = ...
) -> None: ...
def logout(request: HttpRequest) -> None: ...
def update_session_auth_hash(
request: WSGIRequest,
user: SimpleLazyObject
) -> None: ...

View File

@@ -0,0 +1,56 @@
from django.contrib.auth.models import User
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.fields.related import ManyToManyField
from django.forms.models import ModelMultipleChoiceField
from django.http.response import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.urls.resolvers import URLPattern
from typing import (
Dict,
List,
Tuple,
Union,
)
class GroupAdmin:
def formfield_for_manytomany(
self,
db_field: ManyToManyField,
request: WSGIRequest = ...,
**kwargs
) -> ModelMultipleChoiceField: ...
class UserAdmin:
def _add_view(
self,
request: WSGIRequest,
form_url: str = ...,
extra_context: None = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def add_view(
self,
request: WSGIRequest,
form_url: str = ...,
extra_context: None = ...
): ...
def get_fieldsets(
self,
request: WSGIRequest,
obj: None = ...
) -> Tuple[Tuple[None, Dict[str, Union[Tuple[str], Tuple[str, str, str]]]]]: ...
def get_urls(self) -> List[URLPattern]: ...
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
def response_add(
self,
request: WSGIRequest,
obj: User,
post_url_continue: None = ...
) -> HttpResponseRedirect: ...
def user_change_password(
self,
request: WSGIRequest,
id: str,
form_url: str = ...
) -> Union[HttpResponseRedirect, TemplateResponse]: ...

View File

@@ -0,0 +1,2 @@
class AuthConfig:
def ready(self) -> None: ...

View File

@@ -0,0 +1,60 @@
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import (
AnonymousUser,
User,
)
from django.core.handlers.wsgi import WSGIRequest
from django.db.models.query import QuerySet
from django.http.request import HttpRequest
from typing import (
Optional,
Set,
Union,
)
class AllowAllUsersModelBackend:
def user_can_authenticate(self, user: User) -> bool: ...
class AllowAllUsersRemoteUserBackend:
def user_can_authenticate(self, user: User) -> bool: ...
class ModelBackend:
def _get_group_permissions(self, user_obj: User) -> QuerySet: ...
def _get_permissions(self, user_obj: User, obj: None, from_name: str) -> Set[str]: ...
def _get_user_permissions(self, user_obj: User) -> QuerySet: ...
def authenticate(
self,
request: Optional[HttpRequest],
username: Optional[str] = ...,
password: Optional[str] = ...,
**kwargs
) -> Optional[User]: ...
def get_all_permissions(self, user_obj: User, obj: Optional[str] = ...) -> Set[str]: ...
def get_group_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ...
def get_user(self, user_id: int) -> User: ...
def get_user_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ...
def has_module_perms(
self,
user_obj: Union[AnonymousUser, User],
app_label: str
) -> bool: ...
def has_perm(
self,
user_obj: Union[AnonymousUser, User],
perm: str,
obj: None = ...
) -> bool: ...
def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ...
class RemoteUserBackend:
def authenticate(
self,
request: WSGIRequest,
remote_user: Optional[str]
) -> Optional[User]: ...
def clean_username(self, username: str) -> str: ...
def configure_user(self, user: User) -> User: ...

View File

@@ -0,0 +1,27 @@
from typing import Optional
class AbstractBaseUser:
def __str__(self) -> str: ...
def check_password(self, raw_password: str) -> bool: ...
def clean(self) -> None: ...
@classmethod
def get_email_field_name(cls) -> str: ...
def get_session_auth_hash(self) -> str: ...
def get_username(self) -> str: ...
def has_usable_password(self) -> bool: ...
@property
def is_anonymous(self) -> bool: ...
@property
def is_authenticated(self) -> bool: ...
@classmethod
def normalize_username(cls, username: str) -> str: ...
def save(self, *args, **kwargs) -> None: ...
def set_password(self, raw_password: Optional[str]) -> None: ...
def set_unusable_password(self) -> None: ...
class BaseUserManager:
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
@classmethod
def normalize_email(cls, email: Optional[str]) -> str: ...

View File

@@ -0,0 +1,10 @@
from typing import (
Any,
List,
)
def check_models_permissions(app_configs: None = ..., **kwargs) -> List[Any]: ...
def check_user_model(app_configs: None = ..., **kwargs) -> List[Any]: ...

View File

@@ -0,0 +1,31 @@
from auth_tests.test_context_processors import MockUser
from django.contrib.auth.models import (
AnonymousUser,
User,
)
from django.http.request import HttpRequest
from typing import (
Dict,
Union,
)
def auth(
request: HttpRequest
) -> Dict[str, Union[AnonymousUser, PermWrapper, User]]: ...
class PermLookupDict:
def __bool__(self) -> bool: ...
def __getitem__(self, perm_name: str) -> bool: ...
def __init__(self, user: MockUser, 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 __iter__(self): ...

View File

@@ -0,0 +1,27 @@
from typing import (
Callable,
List,
Optional,
Union,
)
def login_required(
function: Optional[Callable] = ...,
redirect_field_name: str = ...,
login_url: None = ...
) -> Callable: ...
def permission_required(
perm: Union[str, List[str]],
login_url: None = ...,
raise_exception: bool = ...
) -> Callable: ...
def user_passes_test(
test_func: Callable,
login_url: Optional[str] = ...,
redirect_field_name: str = ...
) -> Callable: ...

View File

@@ -0,0 +1,93 @@
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.core.exceptions import ValidationError
from django.core.handlers.wsgi import WSGIRequest
from typing import (
Any,
Dict,
Iterator,
List,
Optional,
Union,
)
class AdminPasswordChangeForm:
def __init__(self, user: User, *args, **kwargs) -> None: ...
@property
def changed_data(self) -> List[str]: ...
def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> User: ...
class AuthenticationForm:
def __init__(self, request: object = ..., *args, **kwargs) -> None: ...
def clean(self) -> Dict[str, str]: ...
def confirm_login_allowed(self, user: User) -> None: ...
def get_invalid_login_error(self) -> ValidationError: ...
def get_user(self) -> User: ...
class PasswordChangeForm:
def clean_old_password(self) -> str: ...
class PasswordResetForm:
def get_users(self, email: str) -> Iterator[Any]: ...
def save(
self,
domain_override: None = ...,
subject_template_name: str = ...,
email_template_name: str = ...,
use_https: bool = ...,
token_generator: PasswordResetTokenGenerator = ...,
from_email: None = ...,
request: Optional[WSGIRequest] = ...,
html_email_template_name: None = ...,
extra_email_context: Optional[Dict[str, str]] = ...
) -> None: ...
def send_mail(
self,
subject_template_name: str,
email_template_name: str,
context: Dict[str, Union[str, User]],
from_email: Optional[str],
to_email: str,
html_email_template_name: None = ...
) -> None: ...
class ReadOnlyPasswordHashField:
def __init__(self, *args, **kwargs) -> None: ...
def has_changed(self, initial: str, data: None) -> bool: ...
class ReadOnlyPasswordHashWidget:
def get_context(
self,
name: str,
value: str,
attrs: Dict[str, str]
) -> Dict[str, Union[Dict[str, Union[str, bool, Dict[str, str]]], List[Dict[str, str]]]]: ...
class SetPasswordForm:
def __init__(self, user: Optional[User], *args, **kwargs) -> None: ...
def clean_new_password2(self) -> str: ...
def save(self, commit: bool = ...) -> User: ...
class UserChangeForm:
def __init__(self, *args, **kwargs) -> None: ...
def clean_password(self) -> str: ...
class UserCreationForm:
def __init__(self, *args, **kwargs) -> None: ...
def _post_clean(self) -> None: ...
def clean_password2(self) -> str: ...
def save(self, commit: bool = ...) -> User: ...
class UsernameField:
def to_python(self, value: Optional[str]) -> str: ...

View File

@@ -0,0 +1,10 @@
from typing import (
Any,
Dict,
)
def check_password(environ: Dict[Any, Any], username: str, password: str): ...
def groups_for_user(environ: Dict[Any, Any], username: str): ...

View File

@@ -0,0 +1,76 @@
from collections import OrderedDict
from typing import (
Callable,
Dict,
List,
Optional,
Union,
)
def check_password(
password: str,
encoded: str,
setter: Optional[Callable] = ...,
preferred: str = ...
) -> bool: ...
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
def get_hashers(
) -> Union[List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher], List[UnsaltedMD5PasswordHasher]]: ...
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
def is_password_usable(encoded: Optional[str]) -> bool: ...
def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ...
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
def reset_hashers(**kwargs) -> None: ...
class BasePasswordHasher:
def harden_runtime(self, password: str, encoded: str) -> None: ...
def must_update(self, encoded: str) -> bool: ...
def safe_summary(self, encoded: str): ...
def salt(self) -> str: ...
class MD5PasswordHasher:
def encode(self, password: str, salt: str) -> str: ...
def safe_summary(self, encoded: str) -> OrderedDict: ...
def verify(self, password: str, encoded: str) -> bool: ...
class PBKDF2PasswordHasher:
def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ...
def must_update(self, encoded: str) -> bool: ...
def verify(self, password: str, encoded: str) -> bool: ...
class SHA1PasswordHasher:
def encode(self, password: str, salt: str) -> str: ...
def verify(self, password: str, encoded: str) -> bool: ...
class UnsaltedMD5PasswordHasher:
def encode(self, password: str, salt: str) -> str: ...
def verify(self, password: str, encoded: str) -> bool: ...
class UnsaltedSHA1PasswordHasher:
def encode(self, password: str, salt: str) -> str: ...
def salt(self) -> str: ...
def verify(self, password: str, encoded: str) -> bool: ...

View File

@@ -0,0 +1,29 @@
from django.apps.config import AppConfig
from django.apps.registry import Apps
from django.db.models.options import Options
from typing import (
List,
Tuple,
)
def _get_all_permissions(opts: Options) -> List[Tuple[str, str]]: ...
def _get_builtin_permissions(opts: Options) -> List[Tuple[str, str]]: ...
def create_permissions(
app_config: AppConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs
) -> None: ...
def get_default_username(check_db: bool = ...) -> str: ...
def get_system_username() -> str: ...

View File

@@ -0,0 +1,6 @@
from django.core.management.base import CommandParser
class Command:
def add_arguments(self, parser: CommandParser) -> None: ...
def handle(self, *args, **options) -> str: ...

View File

@@ -0,0 +1,20 @@
from django.core.management.base import CommandParser
from django.db.models.fields import CharField
from django.db.models.fields.related import ForeignKey
from typing import (
Optional,
Union,
)
class Command:
def __init__(self, *args, **kwargs) -> None: ...
def add_arguments(self, parser: CommandParser) -> None: ...
def execute(self, *args, **options) -> None: ...
def get_input_data(
self,
field: Union[CharField, related.ForeignKey],
message: str,
default: Optional[str] = ...
) -> Optional[str]: ...
def handle(self, *args, **options) -> None: ...

View File

@@ -0,0 +1,22 @@
from django.contrib.auth.models import (
AnonymousUser,
User,
)
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from typing import Union
def get_user(
request: HttpRequest
) -> Union[AnonymousUser, User]: ...
class AuthenticationMiddleware:
def process_request(self, request: HttpRequest) -> None: ...
class RemoteUserMiddleware:
def _remove_invalid_user(self, request: WSGIRequest) -> None: ...
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
def process_request(self, request: WSGIRequest) -> None: ...

View File

@@ -0,0 +1,30 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponse
from typing import (
Callable,
List,
)
class AccessMixin:
def get_permission_denied_message(self) -> str: ...
def get_redirect_field_name(self) -> str: ...
def handle_no_permission(self): ...
class LoginRequiredMixin:
def dispatch(self, request: WSGIRequest, *args, **kwargs): ...
class PermissionRequiredMixin:
def dispatch(
self,
request: WSGIRequest,
*args,
**kwargs
) -> HttpResponse: ...
def get_permission_required(self) -> List[str]: ...
class UserPassesTestMixin:
def get_test_func(self) -> Callable: ...

View File

@@ -0,0 +1,98 @@
from typing import (
List,
Optional,
Set,
Tuple,
Type,
Union,
)
def _user_get_all_permissions(user: User, obj: Optional[str]) -> Set[str]: ...
def _user_has_module_perms(
user: Union[AnonymousUser, User],
app_label: str
) -> bool: ...
def _user_has_perm(
user: Union[AnonymousUser, User],
perm: str,
obj: Optional[str]
) -> bool: ...
def update_last_login(
sender: Type[User],
user: User,
**kwargs
) -> None: ...
class AbstractUser:
def clean(self) -> None: ...
def get_short_name(self) -> str: ...
class AnonymousUser:
def __str__(self) -> str: ...
def delete(self): ...
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: ...
@property
def is_anonymous(self) -> bool: ...
@property
def is_authenticated(self) -> bool: ...
def set_password(self, raw_password: str): ...
class Group:
def __str__(self) -> str: ...
class GroupManager:
def get_by_natural_key(self, name: str) -> Group: ...
class Permission:
def __str__(self) -> str: ...
def natural_key(self) -> Tuple[str, str, str]: ...
class PermissionManager:
def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ...
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: ...
class UserManager:
def _create_user(
self,
username: str,
email: Optional[str],
password: Optional[str],
**extra_fields
) -> User: ...
def create_superuser(
self,
username: str,
email: str,
password: Optional[str],
**extra_fields
) -> User: ...
def create_user(
self,
username: str,
email: Optional[str] = ...,
password: Optional[str] = ...,
**extra_fields
) -> User: ...

View File

@@ -0,0 +1,60 @@
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import User
from pathlib import PosixPath
from typing import (
Dict,
List,
Optional,
Tuple,
Union,
)
def _password_validators_help_text_html(password_validators: None = ...) -> str: ...
def get_default_password_validators(
) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ...
def get_password_validators(
validator_config: List[Dict[str, str]]
) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ...
def password_changed(
password: str,
user: AbstractBaseUser = ...,
password_validators: None = ...
) -> None: ...
def password_validators_help_texts(password_validators: None = ...) -> List[str]: ...
def validate_password(
password: str,
user: Optional[User] = ...,
password_validators: None = ...
) -> None: ...
class CommonPasswordValidator:
def __init__(self, password_list_path: PosixPath = ...) -> None: ...
def validate(self, password: str, user: None = ...) -> None: ...
class MinimumLengthValidator:
def __init__(self, min_length: int = ...) -> None: ...
def get_help_text(self) -> str: ...
def validate(self, password: str, user: None = ...) -> None: ...
class NumericPasswordValidator:
def validate(self, password: str, user: User = ...) -> None: ...
class UserAttributeSimilarityValidator:
def __init__(self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...) -> None: ...
def get_help_text(self) -> str: ...
def validate(self, password: str, user: None = ...) -> None: ...

View File

@@ -0,0 +1,12 @@
from datetime import date
from django.contrib.auth.models import User
from typing import Optional
class PasswordResetTokenGenerator:
def _make_hash_value(self, user: User, timestamp: int) -> str: ...
def _make_token_with_timestamp(self, user: User, timestamp: int) -> str: ...
def _num_days(self, dt: date) -> int: ...
def _today(self) -> date: ...
def check_token(self, user: User, token: Optional[str]) -> bool: ...
def make_token(self, user: User) -> str: ...

View File

@@ -0,0 +1,107 @@
from django.contrib.auth.forms import (
AuthenticationForm,
PasswordChangeForm,
PasswordResetForm,
SetPasswordForm,
)
from django.contrib.auth.models import User
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
from django.template.response import TemplateResponse
from django.utils.datastructures import MultiValueDict
from typing import (
Any,
Dict,
Optional,
Set,
Union,
)
def redirect_to_login(
next: str,
login_url: Optional[str] = ...,
redirect_field_name: Optional[str] = ...
) -> HttpResponseRedirect: ...
class LoginView:
def dispatch(
self,
request: HttpRequest,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
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_kwargs(
self
) -> Dict[str, Union[None, MultiValueDict, WSGIRequest]]: ...
def get_redirect_url(self) -> str: ...
def get_success_url(self) -> str: ...
class LogoutView:
def dispatch(
self,
request: HttpRequest,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def get_next_page(self) -> Optional[str]: ...
def post(
self,
request: WSGIRequest,
*args,
**kwargs
) -> TemplateResponse: ...
class PasswordChangeDoneView:
def dispatch(self, *args, **kwargs) -> TemplateResponse: ...
class PasswordChangeView:
def dispatch(
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def form_valid(
self,
form: PasswordChangeForm
) -> HttpResponseRedirect: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, User, MultiValueDict]]: ...
class PasswordResetConfirmView:
def dispatch(
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
def get_form_kwargs(
self
) -> Dict[str, Union[None, User, MultiValueDict]]: ...
def get_user(self, uidb64: str) -> Optional[User]: ...
class PasswordResetView:
def dispatch(
self,
*args,
**kwargs
) -> Union[HttpResponseRedirect, TemplateResponse]: ...
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...
class SuccessURLAllowedHostsMixin:
def get_success_url_allowed_hosts(self) -> Set[str]: ...

View File

@@ -0,0 +1,19 @@
from django.db.models.base import Model
from typing import (
Any,
List,
Type,
)
class GenericInlineModelAdminChecks:
def _check_exclude_of_parent_model(
self,
obj: GenericTabularInline,
parent_model: Type[Model]
) -> List[Any]: ...
def _check_relation(
self,
obj: GenericTabularInline,
parent_model: Type[Model]
) -> List[Any]: ...

View File

@@ -0,0 +1,2 @@
class ContentTypesConfig:
def ready(self) -> None: ...

View File

@@ -0,0 +1,10 @@
from typing import (
Any,
List,
)
def check_generic_foreign_keys(app_configs: None = ..., **kwargs) -> List[Any]: ...
def check_model_name_lengths(app_configs: None = ..., **kwargs) -> List[Any]: ...

View File

@@ -0,0 +1,103 @@
from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import Error
from django.db.models.base import Model
from django.db.models.fields import (
AutoField,
PositiveIntegerField,
)
from django.db.models.fields.related import OneToOneField
from django.db.models.query import QuerySet
from django.db.models.query_utils import (
FilteredRelation,
PathInfo,
)
from django.db.models.sql.where import WhereNode
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Type,
Union,
)
class GenericForeignKey:
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ...
def __set__(self, instance: Model, value: Any) -> 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 get_cache_name(self) -> str: ...
def get_content_type(
self,
obj: Any = ...,
id: Optional[int] = ...,
using: Optional[str] = ...
) -> ContentType: ...
def get_filter_kwargs_for_object(
self,
obj: Model
) -> Dict[str, Union[None, ContentType, int]]: ...
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
def get_prefetch_queryset(
self,
instances: Union[List[Model], QuerySet],
queryset: Optional[QuerySet] = ...
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
class GenericRel:
def __init__(
self,
field: GenericRelation,
to: Any,
related_name: None = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: None = ...
) -> None: ...
class GenericRelation:
def __init__(
self,
to: Any,
object_id_field: str = ...,
content_type_field: str = ...,
for_concrete_model: bool = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: None = ...,
**kwargs
) -> None: ...
def _check_generic_foreign_key_existence(self) -> List[Any]: ...
def _get_path_info_with_parent(self, filtered_relation: None) -> List[PathInfo]: ...
def _is_matching_generic_foreign_key(
self,
field: Optional[Union[GenericForeignKey, GenericRelation]]
) -> bool: ...
def bulk_related_objects(self, objs: Any, using: str = ...) -> QuerySet: ...
def check(self, **kwargs) -> List[Error]: ...
def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ...
def get_content_type(self) -> ContentType: ...
def get_extra_restriction(
self,
where_class: Type[WhereNode],
alias: Optional[str],
remote_alias: str
) -> WhereNode: ...
def get_internal_type(self) -> str: ...
def get_path_info(
self,
filtered_relation: Optional[FilteredRelation] = ...
) -> List[PathInfo]: ...
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]]]: ...
def set_attributes_from_rel(self) -> None: ...

View File

View File

@@ -0,0 +1,55 @@
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.state import StateApps
from typing import (
Any,
Type,
)
def create_contenttypes(
app_config: AppConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs
) -> None: ...
def get_contenttypes_and_models(
app_config: AppConfig,
using: str,
ContentType: Type[ContentType]
) -> Any: ...
def inject_rename_contenttypes_operations(
plan: Any = ...,
apps: StateApps = ...,
using: str = ...,
**kwargs
) -> None: ...
class RenameContentType:
def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ...
def _rename(
self,
apps: StateApps,
schema_editor: DatabaseSchemaEditor,
old_model: str,
new_model: str
) -> None: ...
def rename_backward(
self,
apps: StateApps,
schema_editor: DatabaseSchemaEditor
) -> None: ...
def rename_forward(
self,
apps: StateApps,
schema_editor: DatabaseSchemaEditor
) -> None: ...

View File

@@ -0,0 +1,10 @@
from django.core.management.base import CommandParser
class Command:
def add_arguments(self, parser: CommandParser) -> None: ...
def handle(self, **options) -> None: ...
class NoFastDeleteCollector:
def can_fast_delete(self, *args, **kwargs) -> bool: ...

View File

@@ -0,0 +1,39 @@
from django.db.models.base import Model
from django.db.models.options import Options
from django.db.models.query import QuerySet
from typing import (
Any,
Dict,
Tuple,
Type,
)
class ContentType:
def __str__(self) -> str: ...
def get_all_objects_for_this_type(self, **kwargs) -> QuerySet: ...
def get_object_for_this_type(self, **kwargs) -> Model: ...
def model_class(self) -> Any: ...
@property
def name(self) -> str: ...
def natural_key(self) -> Tuple[str, str]: ...
class ContentTypeManager:
def __init__(self, *args, **kwargs) -> None: ...
def _add_to_cache(self, using: str, ct: ContentType) -> None: ...
def _get_from_cache(self, opts: Options) -> ContentType: ...
def _get_opts(self, model: Any, for_concrete_model: bool) -> Options: ...
def clear_cache(self) -> None: ...
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
def get_for_id(self, id: int) -> ContentType: ...
def get_for_model(
self,
model: Any,
for_concrete_model: bool = ...
) -> ContentType: ...
def get_for_models(
self,
*models,
for_concrete_models = ...
) -> Dict[Type[Model], ContentType]: ...

View File

@@ -0,0 +1,10 @@
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
from typing import Union
def shortcut(
request: HttpRequest,
content_type_id: Union[str, int],
object_id: Union[str, int]
) -> HttpResponseRedirect: ...

View File

View File

View File

View File

@@ -0,0 +1,5 @@
from django.db.models.query import QuerySet
class FlatPageSitemap:
def items(self) -> QuerySet: ...

View File

View File

@@ -0,0 +1,26 @@
from datetime import (
date,
datetime,
)
from typing import (
Optional,
Union,
)
def apnumber(value: str) -> str: ...
def intcomma(value: Optional[Union[str, float, int]], use_l10n: bool = ...) -> str: ...
def intword(value: Optional[str]) -> Optional[str]: ...
def naturalday(value: Optional[date], arg: None = ...) -> Optional[str]: ...
def naturaltime(value: datetime) -> str: ...
def ordinal(value: Optional[str]) -> Optional[str]: ...

View File

@@ -0,0 +1,65 @@
from django.contrib.messages.storage.base import BaseStorage
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from typing import (
Optional,
Union,
)
def add_message(
request: Optional[WSGIRequest],
level: int,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...
def debug(
request: WSGIRequest,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...
def error(
request: WSGIRequest,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...
def get_level(request: HttpRequest) -> int: ...
def get_messages(request: HttpRequest) -> BaseStorage: ...
def info(
request: WSGIRequest,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...
def set_level(request: HttpRequest, level: int) -> bool: ...
def success(
request: WSGIRequest,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...
def warning(
request: WSGIRequest,
message: str,
extra_tags: str = ...,
fail_silently: Union[str, bool] = ...
) -> None: ...

View File

@@ -0,0 +1,11 @@
from django.contrib.messages.storage.base import BaseStorage
from django.http.request import HttpRequest
from typing import (
Dict,
Union,
)
def messages(
request: HttpRequest
) -> Dict[str, Union[Dict[str, int], BaseStorage]]: ...

View File

@@ -0,0 +1,12 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.request import HttpRequest
from django.http.response import HttpResponseBase
class MessageMiddleware:
def process_request(self, request: WSGIRequest) -> None: ...
def process_response(
self,
request: HttpRequest,
response: HttpResponseBase
) -> HttpResponseBase: ...

View File

@@ -0,0 +1,5 @@
from django.contrib.messages.storage.base import BaseStorage
from django.http.request import HttpRequest
def default_storage(request: HttpRequest) -> BaseStorage: ...

View File

@@ -0,0 +1,30 @@
from django.http.request import HttpRequest
from django.http.response import HttpResponseBase
from typing import (
List,
Optional,
Union,
)
class BaseStorage:
def __init__(self, request: HttpRequest, *args, **kwargs) -> None: ...
def __len__(self) -> int: ...
def _get_level(self) -> int: ...
@property
def _loaded_messages(self) -> Union[List[str], List[Message]]: ...
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: ...
def update(self, response: HttpResponseBase) -> None: ...
class Message:
def __eq__(self, other: Union[str, Message]) -> bool: ...
def __init__(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ...
def __str__(self) -> str: ...
def _prepare(self) -> None: ...
@property
def level_tag(self) -> str: ...
@property
def tags(self) -> str: ...

View File

@@ -0,0 +1,46 @@
from django.contrib.messages.storage.base import Message
from django.http.response import HttpResponse
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class CookieStorage:
def _decode(self, data: Optional[str]) -> Any: ...
def _encode(
self,
messages: Union[List[str], List[Message]],
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]]: ...
def _hash(self, value: str) -> str: ...
def _store(
self,
messages: List[Message],
response: HttpResponse,
remove_oldest: bool = ...,
*args,
**kwargs
) -> List[Message]: ...
def _update_cookie(self, encoded_data: Optional[str], response: HttpResponse) -> None: ...
class MessageDecoder:
def decode(
self,
s: str,
**kwargs
) -> Union[List[Message], List[Union[Message, str]], List[str]]: ...
def process_messages(self, obj: Any) -> Any: ...
class MessageEncoder:
def default(self, obj: Message) -> List[Union[int, str]]: ...

View File

@@ -0,0 +1,24 @@
from django.contrib.messages.storage.base import Message
from django.http.response import HttpResponse
from typing import (
Any,
List,
Tuple,
Union,
)
class FallbackStorage:
def __init__(self, *args, **kwargs) -> None: ...
def _get(
self,
*args,
**kwargs
) -> Union[Tuple[List[str], bool], Tuple[List[Any], bool], Tuple[List[Message], bool]]: ...
def _store(
self,
messages: List[Message],
response: HttpResponse,
*args,
**kwargs
) -> List[Any]: ...

View File

@@ -0,0 +1,31 @@
from django.contrib.messages.storage.base import Message
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from typing import (
Any,
List,
Optional,
Tuple,
Union,
)
class SessionStorage:
def __init__(self, request: HttpRequest, *args, **kwargs) -> None: ...
def _get(
self,
*args,
**kwargs
) -> Union[Tuple[None, bool], Tuple[List[str], bool], Tuple[List[Message], bool]]: ...
def _store(
self,
messages: List[Message],
response: HttpResponse,
*args,
**kwargs
) -> List[Any]: ...
def deserialize_messages(
self,
data: Optional[str]
) -> Optional[Union[List[str], List[Message]]]: ...
def serialize_messages(self, messages: Union[List[Message], List[str]]) -> str: ...

View File

@@ -0,0 +1,4 @@
from typing import Dict
def get_level_tags() -> Dict[int, str]: ...

View File

View File

@@ -0,0 +1,43 @@
from datetime import (
datetime,
timedelta,
)
from django.db.models.base import Model
from typing import (
Dict,
Optional,
Union,
)
class SessionBase:
def __contains__(self, key: str) -> bool: ...
def __delitem__(self, key: str) -> None: ...
def __getitem__(self, key: str) -> Union[str, Model, int]: ...
def __init__(self, session_key: Optional[str] = ...) -> None: ...
def __setitem__(self, key: str, value: Union[str, datetime, int]) -> None: ...
def _get_new_session_key(self) -> str: ...
def _get_or_create_session_key(self) -> str: ...
def _get_session(
self,
no_load: bool = ...
) -> Dict[str, Union[Model, int, str, datetime]]: ...
def _get_session_key(self) -> Optional[str]: ...
def _hash(self, value: bytes) -> str: ...
def _set_session_key(self, value: Optional[str]) -> None: ...
def _validate_session_key(self, key: Optional[str]) -> Optional[Union[str, bool]]: ...
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 flush(self) -> None: ...
def get(self, key: str, default: Optional[str] = ...) -> Optional[Union[str, datetime, int]]: ...
def get_expire_at_browser_close(self) -> bool: ...
def get_expiry_age(self, **kwargs) -> int: ...
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 setdefault(self, key: str, value: str) -> str: ...
def test_cookie_worked(self) -> bool: ...
def update(self, dict_: Dict[str, int]) -> None: ...

View File

@@ -0,0 +1,16 @@
from typing import (
Any,
Dict,
Optional,
)
class SessionStore:
def __init__(self, session_key: None = ...) -> None: ...
@property
def cache_key(self) -> str: ...
def create(self) -> None: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...
def load(self) -> Dict[Any, Any]: ...
def save(self, must_create: bool = ...) -> None: ...

View File

@@ -0,0 +1,16 @@
from typing import (
Any,
Dict,
Optional,
)
class SessionStore:
def __init__(self, session_key: Optional[str] = ...) -> None: ...
@property
def cache_key(self) -> str: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: str) -> bool: ...
def flush(self) -> None: ...
def load(self) -> Dict[Any, Any]: ...
def save(self, must_create: bool = ...) -> None: ...

View File

@@ -0,0 +1,29 @@
from datetime import datetime
from django.contrib.sessions.base_session import AbstractBaseSession
from django.contrib.sessions.models import Session
from typing import (
Dict,
Optional,
Type,
Union,
)
class SessionStore:
def __init__(self, session_key: Optional[str] = ...) -> None: ...
def _get_session_from_db(self) -> Optional[AbstractBaseSession]: ...
@classmethod
def clear_expired(cls) -> None: ...
def create(self) -> None: ...
def create_model_instance(
self,
data: Dict[str, Union[int, str, datetime]]
) -> AbstractBaseSession: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...
@classmethod
def get_model_class(cls) -> Type[Session]: ...
def load(self) -> Dict[str, Union[str, int]]: ...
@cached_property
def model(self) -> Type[AbstractBaseSession]: ...
def save(self, must_create: bool = ...) -> None: ...

View File

@@ -0,0 +1,18 @@
from typing import (
Dict,
Optional,
)
class SessionStore:
def __init__(self, session_key: Optional[str] = ...) -> None: ...
@classmethod
def _get_storage_path(cls) -> str: ...
def _key_to_file(self, session_key: Optional[str] = ...) -> str: ...
@classmethod
def clear_expired(cls) -> None: ...
def create(self) -> None: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: Optional[str]) -> bool: ...
def load(self) -> Dict[str, str]: ...
def save(self, must_create: bool = ...) -> None: ...

View File

@@ -0,0 +1,14 @@
from datetime import datetime
from typing import (
Dict,
Optional,
Union,
)
class SessionStore:
def _get_session_key(self) -> str: ...
def delete(self, session_key: Optional[str] = ...) -> None: ...
def exists(self, session_key: str = ...) -> bool: ...
def load(self) -> Dict[str, Union[str, datetime]]: ...
def save(self, must_create: bool = ...) -> None: ...

View File

@@ -0,0 +1,6 @@
from typing import Dict
class AbstractBaseSession:
def __str__(self) -> str: ...
def get_decoded(self) -> Dict[str, int]: ...

View File

@@ -0,0 +1,2 @@
class Command:
def handle(self, **options) -> None: ...

View File

@@ -0,0 +1,16 @@
from django.core.handlers.wsgi import WSGIRequest
from django.http.response import HttpResponseBase
from typing import (
Callable,
Optional,
)
class SessionMiddleware:
def __init__(self, get_response: Optional[Callable] = ...) -> None: ...
def process_request(self, request: WSGIRequest) -> None: ...
def process_response(
self,
request: WSGIRequest,
response: HttpResponseBase
) -> HttpResponseBase: ...

View File

@@ -0,0 +1,7 @@
from django.contrib.sessions.backends.db import SessionStore
from typing import Type
class Session:
@classmethod
def get_session_store_class(cls) -> Type[SessionStore]: ...

View File

@@ -0,0 +1,11 @@
from datetime import datetime
from django.db.models.base import Model
from typing import (
Dict,
Union,
)
class PickleSerializer:
def dumps(self, obj: Dict[str, Union[str, datetime]]) -> bytes: ...
def loads(self, data: bytes) -> Dict[str, Model]: ...

View File

@@ -0,0 +1,49 @@
from datetime import datetime
from django.contrib.sites.models import Site
from django.contrib.sites.requests import RequestSite
from django.core.paginator import Paginator
from django.db.models.base import Model
from django.db.models.query import QuerySet
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
def _get_sitemap_full_url(sitemap_url: None): ...
def ping_google(sitemap_url: None = ..., ping_url: str = ...) -> None: ...
class GenericSitemap:
def __init__(
self,
info_dict: Dict[str, Union[QuerySet, datetime]],
priority: Optional[float] = ...,
changefreq: Optional[str] = ...,
protocol: Optional[str] = ...
) -> None: ...
def lastmod(self, item: Model) -> None: ...
class Sitemap:
def _urls(
self,
page: Union[str, int],
protocol: str,
domain: str
) -> Union[List[Dict[str, Union[Model, str, None]]], List[Dict[str, object]]]: ...
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]]]: ...
def items(self) -> List[Any]: ...
def location(self, obj: Model) -> str: ...
@property
def paginator(self) -> Paginator: ...

View File

@@ -0,0 +1,2 @@
class Command:
def handle(self, *args, **options) -> None: ...

View File

@@ -0,0 +1,31 @@
from django.contrib.sitemaps import Sitemap
from django.core.handlers.wsgi import WSGIRequest
from django.template.response import TemplateResponse
from typing import (
Any,
Callable,
Dict,
Optional,
Type,
)
def index(
request: WSGIRequest,
sitemaps: Dict[str, Type[Sitemap]],
template_name: str = ...,
content_type: str = ...,
sitemap_url_name: str = ...
) -> TemplateResponse: ...
def sitemap(
request: WSGIRequest,
sitemaps: Dict[str, Any],
section: Optional[str] = ...,
template_name: str = ...,
content_type: str = ...
) -> TemplateResponse: ...
def x_robots_tag(func: Callable) -> Callable: ...

View File

@@ -0,0 +1,2 @@
class SitesConfig:
def ready(self) -> None: ...

View File

@@ -0,0 +1,12 @@
from django.apps.registry import Apps
from django.contrib.sites.apps import SitesConfig
def create_default_site(
app_config: SitesConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs
) -> None: ...

View File

@@ -0,0 +1,11 @@
from django.core.checks.messages import Error
from django.db.models.query import QuerySet
from typing import List
class CurrentSiteManager:
def __init__(self, field_name: None = ...) -> None: ...
def _check_field_name(self) -> List[Error]: ...
def _get_field_name(self) -> str: ...
def check(self, **kwargs) -> List[Error]: ...
def get_queryset(self) -> QuerySet: ...

View File

@@ -0,0 +1,5 @@
from django.http.request import HttpRequest
class CurrentSiteMiddleware:
def process_request(self, request: HttpRequest) -> None: ...

View File

@@ -0,0 +1,26 @@
from django.http.request import HttpRequest
from typing import (
Optional,
Type,
)
def _simple_domain_name_validator(value: str): ...
def clear_site_cache(sender: Type[Site], **kwargs) -> None: ...
class Site:
def __str__(self) -> str: ...
class SiteManager:
def _get_site_by_id(self, site_id: int) -> Site: ...
def _get_site_by_request(self, request: HttpRequest) -> Site: ...
def clear_cache(self) -> None: ...
def get_by_natural_key(self, domain: str) -> Site: ...
def get_current(
self,
request: Optional[HttpRequest] = ...
) -> Site: ...

View File

@@ -0,0 +1,6 @@
from django.http.request import HttpRequest
class RequestSite:
def __init__(self, request: HttpRequest) -> None: ...
def __str__(self) -> str: ...

View File

@@ -0,0 +1,12 @@
from django.contrib.sites.models import Site
from django.contrib.sites.requests import RequestSite
from django.http.request import HttpRequest
from typing import (
Optional,
Union,
)
def get_current_site(
request: Optional[HttpRequest]
) -> Union[RequestSite, Site]: ...

View File

@@ -0,0 +1,2 @@
class StaticFilesConfig:
def ready(self) -> None: ...

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