mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-09 21:46:43 +08:00
better stubs
This commit is contained in:
@@ -1,44 +1,39 @@
|
||||
# Stubs for django.contrib.auth (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
||||
from typing import Any, Optional
|
||||
from typing import Any, List, Optional, Type, Union
|
||||
|
||||
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.contrib.auth.models import AbstractUser, AnonymousUser
|
||||
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 typing import Any, Dict, List, Optional, Type, Union
|
||||
|
||||
from .signals import user_logged_in, user_logged_out, user_login_failed
|
||||
|
||||
SESSION_KEY: str
|
||||
BACKEND_SESSION_KEY: str
|
||||
HASH_SESSION_KEY: str
|
||||
REDIRECT_FIELD_NAME: str
|
||||
|
||||
def load_backend(path: str) -> object: ...
|
||||
def _get_backends(return_tuples: bool = ...) -> Any: ...
|
||||
def load_backend(path: str) -> ModelBackend: ...
|
||||
def get_backends() -> List[ModelBackend]: ...
|
||||
def _clean_credentials(
|
||||
credentials: Dict[str, Optional[str]]
|
||||
) -> Dict[str, Optional[str]]: ...
|
||||
def _get_user_session_key(request: HttpRequest) -> int: ...
|
||||
def authenticate(
|
||||
request: Optional[HttpRequest] = ..., **credentials: Any
|
||||
request: Any = ..., **credentials: Any
|
||||
) -> Optional[AbstractBaseUser]: ...
|
||||
def login(
|
||||
request: HttpRequest,
|
||||
user: User,
|
||||
user: AbstractBaseUser,
|
||||
backend: Optional[Union[str, Type[ModelBackend]]] = ...,
|
||||
) -> None: ...
|
||||
def logout(request: HttpRequest) -> None: ...
|
||||
def get_user_model() -> Type[Model]: ...
|
||||
def get_user(request: HttpRequest) -> Union[AnonymousUser, AbstractBaseUser]: ...
|
||||
def get_user(
|
||||
request: HttpRequest
|
||||
) -> Union[AbstractBaseUser, AnonymousUser]: ...
|
||||
def get_permission_codename(action: str, opts: Options) -> str: ...
|
||||
def update_session_auth_hash(request: WSGIRequest, user: SimpleLazyObject) -> None: ...
|
||||
def update_session_auth_hash(
|
||||
request: WSGIRequest, user: Union[SimpleLazyObject, AbstractUser]
|
||||
) -> None: ...
|
||||
|
||||
default_app_config: str
|
||||
|
||||
@@ -1,32 +1,121 @@
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from django.contrib import admin
|
||||
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.http.response import HttpResponse
|
||||
from django.urls.resolvers import URLPattern
|
||||
from typing import Dict, List, Tuple, Union
|
||||
|
||||
class GroupAdmin:
|
||||
csrf_protect_m: Any
|
||||
sensitive_post_parameters_m: Any
|
||||
|
||||
class GroupAdmin(admin.ModelAdmin):
|
||||
admin_site: django.contrib.admin.sites.AdminSite
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.files.FileField,
|
||||
]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
model: Type[django.contrib.auth.models.Group]
|
||||
opts: django.db.models.options.Options
|
||||
search_fields: Any = ...
|
||||
ordering: Any = ...
|
||||
filter_horizontal: Any = ...
|
||||
def formfield_for_manytomany(
|
||||
self, db_field: ManyToManyField, request: WSGIRequest = ..., **kwargs
|
||||
self,
|
||||
db_field: ManyToManyField,
|
||||
request: WSGIRequest = ...,
|
||||
**kwargs: Any
|
||||
) -> ModelMultipleChoiceField: ...
|
||||
|
||||
class UserAdmin:
|
||||
def _add_view(
|
||||
self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def add_view(
|
||||
self, request: WSGIRequest, form_url: str = ..., extra_context: None = ...
|
||||
): ...
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
admin_site: django.contrib.admin.sites.AdminSite
|
||||
formfield_overrides: Dict[
|
||||
Type[
|
||||
Union[
|
||||
django.db.models.fields.DateField,
|
||||
django.db.models.fields.TimeField,
|
||||
django.db.models.fields.TextField,
|
||||
django.db.models.fields.IntegerField,
|
||||
django.db.models.fields.CharField,
|
||||
django.db.models.fields.files.FileField,
|
||||
]
|
||||
],
|
||||
Dict[
|
||||
str,
|
||||
Type[
|
||||
Union[
|
||||
django.forms.fields.SplitDateTimeField,
|
||||
django.contrib.admin.widgets.AdminSplitDateTime,
|
||||
django.contrib.admin.widgets.AdminDateWidget,
|
||||
django.contrib.admin.widgets.AdminTimeWidget,
|
||||
django.contrib.admin.widgets.AdminTextareaWidget,
|
||||
django.contrib.admin.widgets.AdminURLFieldWidget,
|
||||
django.contrib.admin.widgets.AdminIntegerFieldWidget,
|
||||
django.contrib.admin.widgets.AdminTextInputWidget,
|
||||
django.contrib.admin.widgets.AdminFileWidget,
|
||||
django.contrib.admin.widgets.AdminEmailInputWidget,
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
model: Type[django.contrib.auth.models.User]
|
||||
opts: django.db.models.options.Options
|
||||
add_form_template: str = ...
|
||||
change_user_password_template: Any = ...
|
||||
fieldsets: Any = ...
|
||||
add_fieldsets: Any = ...
|
||||
form: Any = ...
|
||||
add_form: Any = ...
|
||||
change_password_form: Any = ...
|
||||
list_display: Any = ...
|
||||
list_filter: Any = ...
|
||||
search_fields: Any = ...
|
||||
ordering: Any = ...
|
||||
filter_horizontal: Any = ...
|
||||
def get_fieldsets(
|
||||
self, request: WSGIRequest, obj: None = ...
|
||||
) -> Tuple[Tuple[None, Dict[str, Union[Tuple[str], Tuple[str, str, str]]]]]: ...
|
||||
) -> Tuple[Tuple[None, Dict[str, Tuple[str]]]]: ...
|
||||
def get_form(
|
||||
self, request: Any, obj: Optional[Any] = ..., **kwargs: Any
|
||||
): ...
|
||||
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 add_view(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
form_url: str = ...,
|
||||
extra_context: None = ...,
|
||||
) -> Any: ...
|
||||
def user_change_password(
|
||||
self, request: WSGIRequest, id: str, form_url: str = ...
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
) -> HttpResponse: ...
|
||||
def response_add(
|
||||
self, request: WSGIRequest, obj: User, post_url_continue: None = ...
|
||||
) -> HttpResponse: ...
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
# Stubs for django.contrib.auth.apps (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
from .checks import check_models_permissions, check_user_model
|
||||
from .management import create_permissions
|
||||
from .signals import user_logged_in
|
||||
from django.apps import AppConfig
|
||||
from typing import Any
|
||||
|
||||
|
||||
class AuthConfig(AppConfig):
|
||||
apps: None
|
||||
label: str
|
||||
models: None
|
||||
models_module: None
|
||||
module: Any
|
||||
path: str
|
||||
name: str = ...
|
||||
verbose_name: Any = ...
|
||||
def ready(self) -> None: ...
|
||||
|
||||
@@ -1,42 +1,52 @@
|
||||
from typing import Any, Optional, Set, Union
|
||||
|
||||
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: ...
|
||||
UserModel: Any
|
||||
|
||||
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] = ...,
|
||||
request: Any,
|
||||
username: Optional[Union[str, int]] = ...,
|
||||
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
|
||||
**kwargs: Any
|
||||
) -> Optional[AbstractBaseUser]: ...
|
||||
def user_can_authenticate(
|
||||
self, user: Optional[AbstractBaseUser]
|
||||
) -> bool: ...
|
||||
def get_user_permissions(
|
||||
self, user_obj: AbstractBaseUser, obj: None = ...
|
||||
) -> Set[str]: ...
|
||||
def get_group_permissions(
|
||||
self, user_obj: AbstractBaseUser, obj: None = ...
|
||||
) -> Set[str]: ...
|
||||
def get_all_permissions(
|
||||
self, user_obj: AbstractBaseUser, obj: Optional[str] = ...
|
||||
) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self, user_obj: Union[AnonymousUser, User], perm: str, obj: None = ...
|
||||
self,
|
||||
user_obj: Union[AnonymousUser, AbstractBaseUser],
|
||||
perm: str,
|
||||
obj: Optional[str] = ...,
|
||||
) -> bool: ...
|
||||
def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ...
|
||||
def has_module_perms(
|
||||
self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str
|
||||
) -> bool: ...
|
||||
def get_user(self, user_id: int) -> AbstractBaseUser: ...
|
||||
|
||||
class RemoteUserBackend:
|
||||
class AllowAllUsersModelBackend(ModelBackend):
|
||||
def user_can_authenticate(self, user: AbstractBaseUser) -> bool: ...
|
||||
|
||||
class RemoteUserBackend(ModelBackend):
|
||||
create_unknown_user: bool = ...
|
||||
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: ...
|
||||
|
||||
class AllowAllUsersRemoteUserBackend(RemoteUserBackend):
|
||||
def user_can_authenticate(self, user: User) -> bool: ...
|
||||
|
||||
@@ -1,25 +1,44 @@
|
||||
from typing import Optional
|
||||
from typing import Any, Optional, Tuple, Union
|
||||
|
||||
class AbstractBaseUser:
|
||||
def __str__(self) -> str: ...
|
||||
def check_password(self, raw_password: str) -> bool: ...
|
||||
def clean(self) -> None: ...
|
||||
from django.db import models
|
||||
|
||||
|
||||
class BaseUserManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
@classmethod
|
||||
def get_email_field_name(cls) -> str: ...
|
||||
def get_session_auth_hash(self) -> str: ...
|
||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||
def make_random_password(
|
||||
self, length: int = ..., allowed_chars: str = ...
|
||||
) -> str: ...
|
||||
def get_by_natural_key(
|
||||
self, username: Optional[str]
|
||||
) -> AbstractBaseUser: ...
|
||||
|
||||
class AbstractBaseUser(models.Model):
|
||||
password: str = ...
|
||||
last_login: None = ...
|
||||
is_active: bool = ...
|
||||
REQUIRED_FIELDS: Any = ...
|
||||
class Meta:
|
||||
abstract: bool = ...
|
||||
def get_username(self) -> str: ...
|
||||
def has_usable_password(self) -> bool: ...
|
||||
def clean(self) -> None: ...
|
||||
def save(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def natural_key(self) -> Tuple[str]: ...
|
||||
@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 check_password(self, raw_password: str) -> bool: ...
|
||||
def set_unusable_password(self) -> None: ...
|
||||
|
||||
class BaseUserManager:
|
||||
def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ...
|
||||
def has_usable_password(self) -> bool: ...
|
||||
def get_session_auth_hash(self) -> str: ...
|
||||
@classmethod
|
||||
def normalize_email(cls, email: Optional[str]) -> str: ...
|
||||
def get_email_field_name(cls) -> str: ...
|
||||
@classmethod
|
||||
def normalize_username(
|
||||
cls, username: Union[str, int]
|
||||
) -> Union[str, int]: ...
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# Stubs for django.contrib.auth.checks (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
from .management import _get_builtin_permissions
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any, List
|
||||
|
||||
def check_user_model(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
def check_models_permissions(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
def check_user_model(
|
||||
app_configs: None = ..., **kwargs: Any
|
||||
) -> List[CheckMessage]: ...
|
||||
def check_models_permissions(
|
||||
app_configs: None = ..., **kwargs: Any
|
||||
) -> List[Any]: ...
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
# Stubs for django.contrib.auth.context_processors (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.http.request import HttpRequest
|
||||
from typing import Dict, Union
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
class PermLookupDict:
|
||||
def __init__(self, user: object, app_label: str) -> None: ...
|
||||
def __repr__(self): ...
|
||||
app_label: django.utils.safestring.SafeText
|
||||
user: django.utils.functional.SimpleLazyObject
|
||||
def __init__(self, user: SimpleLazyObject, app_label: str) -> None: ...
|
||||
def __getitem__(self, perm_name: str) -> bool: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
class PermWrapper:
|
||||
user: Any = ...
|
||||
def __init__(self, user: object) -> None: ...
|
||||
user: django.utils.functional.SimpleLazyObject = ...
|
||||
def __init__(
|
||||
self, user: Union[SimpleLazyObject, AnonymousUser, User]
|
||||
) -> None: ...
|
||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __contains__(self, perm_name: str) -> bool: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def __contains__(self, perm_name: Union[str, bool]) -> bool: ...
|
||||
|
||||
def auth(request: HttpRequest) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...
|
||||
def auth(
|
||||
request: HttpRequest
|
||||
) -> Dict[str, Union[SimpleLazyObject, PermWrapper, User, AnonymousUser]]: ...
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
# Stubs for django.contrib.auth.decorators (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Callable, List, Optional, Set, Union
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Callable, List, Optional, Union
|
||||
|
||||
def user_passes_test(
|
||||
test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...
|
||||
test_func: Callable,
|
||||
login_url: Optional[str] = ...,
|
||||
redirect_field_name: str = ...,
|
||||
) -> Callable: ...
|
||||
def login_required(
|
||||
function: Optional[Callable] = ...,
|
||||
redirect_field_name: str = ...,
|
||||
login_url: None = ...,
|
||||
login_url: Optional[str] = ...,
|
||||
) -> Callable: ...
|
||||
def permission_required(
|
||||
perm: Union[str, List[str]], login_url: None = ..., raise_exception: bool = ...
|
||||
perm: Union[str, List[str], Set[str]],
|
||||
login_url: None = ...,
|
||||
raise_exception: bool = ...,
|
||||
) -> Callable: ...
|
||||
|
||||
@@ -1,75 +1,198 @@
|
||||
from django.contrib.auth.models import User
|
||||
from typing import Any, Dict, Iterator, List, Optional, Union
|
||||
|
||||
from django import forms
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import AbstractUser, User
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from typing import Any, Dict, Iterator, List, Optional, Union
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
class AdminPasswordChangeForm:
|
||||
def __init__(self, user: User, *args, **kwargs) -> None: ...
|
||||
@property
|
||||
def changed_data(self) -> List[str]: ...
|
||||
UserModel: Any
|
||||
|
||||
class ReadOnlyPasswordHashWidget(forms.Widget):
|
||||
attrs: Dict[Any, Any]
|
||||
template_name: str = ...
|
||||
def get_context(
|
||||
self, name: str, value: Optional[str], attrs: Dict[str, str]
|
||||
) -> Dict[
|
||||
str,
|
||||
Union[
|
||||
Dict[str, Union[str, bool, None, Dict[Any, Any]]],
|
||||
List[Dict[str, str]],
|
||||
Dict[str, Union[str, bool, None, Dict[str, str]]],
|
||||
Dict[str, Union[str, bool, Dict[str, str]]],
|
||||
],
|
||||
]: ...
|
||||
|
||||
class ReadOnlyPasswordHashField(forms.Field):
|
||||
widget: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def bound_data(self, data: None, initial: str) -> str: ...
|
||||
def has_changed(self, initial: str, data: Optional[str]) -> bool: ...
|
||||
|
||||
class UsernameField(forms.CharField):
|
||||
def to_python(self, value: Optional[str]) -> str: ...
|
||||
|
||||
class UserCreationForm(forms.ModelForm):
|
||||
auto_id: str
|
||||
data: Dict[str, str]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[Any, Any]
|
||||
instance: django.contrib.auth.models.User
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
error_messages: Any = ...
|
||||
password1: Any = ...
|
||||
password2: Any = ...
|
||||
class Meta:
|
||||
model: Any = ...
|
||||
fields: Any = ...
|
||||
field_classes: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
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 UserChangeForm(forms.ModelForm):
|
||||
auto_id: str
|
||||
data: Dict[Any, Any]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[str, Optional[Union[int, str, datetime.datetime, List[Any]]]]
|
||||
instance: django.contrib.auth.models.User
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
password: Any = ...
|
||||
class Meta:
|
||||
model: Any = ...
|
||||
fields: str = ...
|
||||
field_classes: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def clean_password(self) -> str: ...
|
||||
|
||||
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]] = ...,
|
||||
class AuthenticationForm(forms.Form):
|
||||
auto_id: str
|
||||
data: django.http.request.QueryDict
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: django.utils.datastructures.MultiValueDict
|
||||
initial: Dict[Any, Any]
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
username: Any = ...
|
||||
password: Any = ...
|
||||
error_messages: Any = ...
|
||||
request: django.core.handlers.wsgi.WSGIRequest = ...
|
||||
user_cache: None = ...
|
||||
username_field: Any = ...
|
||||
def __init__(
|
||||
self, request: Any = ..., *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def clean(self) -> Dict[str, str]: ...
|
||||
def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ...
|
||||
def get_user(self) -> User: ...
|
||||
def get_invalid_login_error(self) -> ValidationError: ...
|
||||
|
||||
class PasswordResetForm(forms.Form):
|
||||
auto_id: str
|
||||
data: Dict[Any, Any]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[Any, Any]
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
email: Any = ...
|
||||
def send_mail(
|
||||
self,
|
||||
subject_template_name: str,
|
||||
email_template_name: str,
|
||||
context: Dict[str, Union[str, User]],
|
||||
context: Dict[str, Union[str, AbstractBaseUser]],
|
||||
from_email: Optional[str],
|
||||
to_email: str,
|
||||
html_email_template_name: None = ...,
|
||||
html_email_template_name: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
def get_users(self, email: str) -> Iterator[Any]: ...
|
||||
def save(
|
||||
self,
|
||||
domain_override: Optional[str] = ...,
|
||||
subject_template_name: str = ...,
|
||||
email_template_name: str = ...,
|
||||
use_https: bool = ...,
|
||||
token_generator: PasswordResetTokenGenerator = ...,
|
||||
from_email: Optional[str] = ...,
|
||||
request: Optional[WSGIRequest] = ...,
|
||||
html_email_template_name: Optional[str] = ...,
|
||||
extra_email_context: Optional[Dict[str, str]] = ...,
|
||||
) -> 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: ...
|
||||
class SetPasswordForm(forms.Form):
|
||||
auto_id: str
|
||||
data: Dict[Any, Any]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[Any, Any]
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
error_messages: Any = ...
|
||||
new_password1: Any = ...
|
||||
new_password2: Any = ...
|
||||
user: django.contrib.auth.models.User = ...
|
||||
def __init__(
|
||||
self,
|
||||
user: Optional[Union[SimpleLazyObject, AbstractBaseUser]],
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def clean_new_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
def save(
|
||||
self, commit: bool = ...
|
||||
) -> Union[AbstractBaseUser, SimpleLazyObject]: ...
|
||||
|
||||
class UserChangeForm:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def clean_password(self) -> str: ...
|
||||
class PasswordChangeForm(SetPasswordForm):
|
||||
auto_id: str
|
||||
data: Dict[Any, Any]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[Any, Any]
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
user: django.contrib.auth.models.User
|
||||
error_messages: Any = ...
|
||||
old_password: Any = ...
|
||||
field_order: Any = ...
|
||||
def clean_old_password(self) -> str: ...
|
||||
|
||||
class UserCreationForm:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _post_clean(self) -> None: ...
|
||||
class AdminPasswordChangeForm(forms.Form):
|
||||
auto_id: str
|
||||
data: Dict[Any, Any]
|
||||
empty_permitted: bool
|
||||
error_class: Type[django.forms.utils.ErrorList]
|
||||
fields: collections.OrderedDict
|
||||
files: Dict[Any, Any]
|
||||
initial: Dict[Any, Any]
|
||||
is_bound: bool
|
||||
label_suffix: str
|
||||
error_messages: Any = ...
|
||||
required_css_class: str = ...
|
||||
password1: Any = ...
|
||||
password2: Any = ...
|
||||
user: django.contrib.auth.models.User = ...
|
||||
def __init__(
|
||||
self, user: AbstractUser, *args: Any, **kwargs: Any
|
||||
) -> None: ...
|
||||
def clean_password2(self) -> str: ...
|
||||
def save(self, commit: bool = ...) -> User: ...
|
||||
|
||||
class UsernameField:
|
||||
def to_python(self, value: Optional[str]) -> str: ...
|
||||
def save(self, commit: bool = ...) -> AbstractUser: ...
|
||||
@property
|
||||
def changed_data(self) -> List[str]: ...
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
def check_password(environ: Dict[Any, Any], username: str, password: str): ...
|
||||
def groups_for_user(environ: Dict[Any, Any], username: str): ...
|
||||
UserModel: Any
|
||||
|
||||
def check_password(
|
||||
environ: Dict[Any, Any], username: str, password: str
|
||||
) -> Any: ...
|
||||
def groups_for_user(environ: Dict[Any, Any], username: str) -> Any: ...
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
# Stubs for django.contrib.auth.hashers (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from collections import OrderedDict
|
||||
from typing import Callable, Dict, List, Optional, Union
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
UNUSABLE_PASSWORD_PREFIX: str
|
||||
UNUSABLE_PASSWORD_SUFFIX_LENGTH: int
|
||||
|
||||
def is_password_usable(encoded: Optional[str]) -> bool: ...
|
||||
def check_password(
|
||||
password: str, encoded: str, setter: Optional[Callable] = ..., preferred: str = ...
|
||||
password: Optional[str],
|
||||
encoded: str,
|
||||
setter: Optional[Callable] = ...,
|
||||
preferred: str = ...,
|
||||
) -> bool: ...
|
||||
def make_password(
|
||||
password: Optional[str], salt: Optional[str] = ..., hasher: str = ...
|
||||
) -> str: ...
|
||||
def get_hashers() -> Union[
|
||||
List[UnsaltedMD5PasswordHasher],
|
||||
List[MD5PasswordHasher],
|
||||
List[BasePasswordHasher],
|
||||
List[PBKDF2PasswordHasher],
|
||||
]: ...
|
||||
def get_hashers() -> List[BasePasswordHasher]: ...
|
||||
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
|
||||
def reset_hashers(**kwargs: Any) -> None: ...
|
||||
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
|
||||
@@ -32,11 +24,10 @@ def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
||||
class BasePasswordHasher:
|
||||
algorithm: Any = ...
|
||||
library: Any = ...
|
||||
def _load_library(self): ...
|
||||
def salt(self) -> str: ...
|
||||
def verify(self, password: Any, encoded: Any) -> None: ...
|
||||
def encode(self, password: Any, salt: Any) -> None: ...
|
||||
def safe_summary(self, encoded: str) -> None: ...
|
||||
def verify(self, password: str, encoded: str) -> Any: ...
|
||||
def encode(self, password: str, salt: str) -> Any: ...
|
||||
def safe_summary(self, encoded: str) -> Any: ...
|
||||
def must_update(self, encoded: str) -> bool: ...
|
||||
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
||||
|
||||
@@ -44,11 +35,13 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
iterations: int = ...
|
||||
digest: Any = ...
|
||||
def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ...
|
||||
def encode(
|
||||
self, password: str, salt: str, iterations: Optional[int] = ...
|
||||
) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def safe_summary(self, encoded: str) -> OrderedDict: ...
|
||||
def must_update(self, encoded: str) -> bool: ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
def harden_runtime(self, password: str, encoded: str) -> None: ...
|
||||
|
||||
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher):
|
||||
algorithm: str = ...
|
||||
@@ -65,7 +58,6 @@ class Argon2PasswordHasher(BasePasswordHasher):
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def must_update(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
def _decode(self, encoded: Any): ...
|
||||
|
||||
class BCryptSHA256PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
@@ -107,7 +99,7 @@ class UnsaltedSHA1PasswordHasher(BasePasswordHasher):
|
||||
|
||||
class UnsaltedMD5PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
def salt(self): ...
|
||||
def salt(self) -> str: ...
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
# Stubs for django.contrib.auth.management (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
|
||||
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: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
def get_system_username() -> str: ...
|
||||
def get_default_username(check_db: bool = ...) -> str: ...
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
from django.core.management.base import CommandParser
|
||||
from typing import Any, Optional
|
||||
|
||||
class Command:
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
|
||||
UserModel: Any
|
||||
|
||||
class Command(BaseCommand):
|
||||
stderr: django.core.management.base.OutputWrapper
|
||||
stdout: django.core.management.base.OutputWrapper
|
||||
style: django.core.management.color.Style
|
||||
help: str = ...
|
||||
requires_migrations_checks: bool = ...
|
||||
requires_system_checks: bool = ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def handle(self, *args, **options) -> str: ...
|
||||
def handle(self, *args: Any, **options: Any) -> str: ...
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
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
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
class Command:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from django.db.models.fields import Field
|
||||
|
||||
|
||||
class NotRunningInTTYException(Exception): ...
|
||||
|
||||
class Command(BaseCommand):
|
||||
stderr: django.core.management.base.OutputWrapper
|
||||
stdout: django.core.management.base.OutputWrapper
|
||||
style: django.core.management.color.Style
|
||||
help: str = ...
|
||||
requires_migrations_checks: bool = ...
|
||||
stealth_options: Any = ...
|
||||
UserModel: Any = ...
|
||||
username_field: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def execute(self, *args, **options) -> None: ...
|
||||
stdin: Any = ...
|
||||
def execute(self, *args: Any, **options: Any) -> None: ...
|
||||
def handle(self, *args: Any, **options: Any) -> None: ...
|
||||
def get_input_data(
|
||||
self,
|
||||
field: Union[CharField, related.ForeignKey],
|
||||
message: str,
|
||||
default: Optional[str] = ...,
|
||||
) -> Optional[str]: ...
|
||||
def handle(self, *args, **options) -> None: ...
|
||||
self, field: Field, message: str, default: Optional[str] = ...
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
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
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
|
||||
def get_user(request: HttpRequest) -> Union[AnonymousUser, User]: ...
|
||||
|
||||
class AuthenticationMiddleware:
|
||||
def get_user(request: WSGIRequest) -> Union[AnonymousUser, User]: ...
|
||||
|
||||
class AuthenticationMiddleware(MiddlewareMixin):
|
||||
get_response: Callable
|
||||
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: ...
|
||||
class RemoteUserMiddleware(MiddlewareMixin):
|
||||
get_response: Callable
|
||||
header: str = ...
|
||||
force_logout_if_no_header: bool = ...
|
||||
def process_request(self, request: WSGIRequest) -> None: ...
|
||||
def clean_username(self, username: str, request: WSGIRequest) -> str: ...
|
||||
|
||||
class PersistentRemoteUserMiddleware(RemoteUserMiddleware):
|
||||
get_response: Callable
|
||||
force_logout_if_no_header: bool = ...
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
from typing import Any, Callable, List, Optional
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import HttpResponse
|
||||
from typing import Callable, List
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
|
||||
|
||||
class AccessMixin:
|
||||
login_url: Any = ...
|
||||
permission_denied_message: str = ...
|
||||
raise_exception: bool = ...
|
||||
redirect_field_name: Any = ...
|
||||
def get_login_url(self) -> str: ...
|
||||
def get_permission_denied_message(self) -> str: ...
|
||||
def get_redirect_field_name(self) -> str: ...
|
||||
def handle_no_permission(self): ...
|
||||
def handle_no_permission(self) -> HttpResponseRedirect: ...
|
||||
|
||||
class LoginRequiredMixin:
|
||||
def dispatch(self, request: WSGIRequest, *args, **kwargs): ...
|
||||
class LoginRequiredMixin(AccessMixin):
|
||||
def dispatch(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class PermissionRequiredMixin:
|
||||
def dispatch(self, request: WSGIRequest, *args, **kwargs) -> HttpResponse: ...
|
||||
class PermissionRequiredMixin(AccessMixin):
|
||||
permission_required: Any = ...
|
||||
def get_permission_required(self) -> List[str]: ...
|
||||
def has_permission(self) -> bool: ...
|
||||
def dispatch(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
class UserPassesTestMixin:
|
||||
class UserPassesTestMixin(AccessMixin):
|
||||
def test_func(self) -> None: ...
|
||||
def get_test_func(self) -> Callable: ...
|
||||
def dispatch(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
|
||||
@@ -1,65 +1,160 @@
|
||||
from typing import List, Optional, Set, Tuple, Type, Union
|
||||
from typing import Any, 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: ...
|
||||
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
|
||||
from django.db import models
|
||||
from django.db.models.manager import EmptyManager
|
||||
|
||||
class AbstractUser:
|
||||
def clean(self) -> None: ...
|
||||
def get_short_name(self) -> str: ...
|
||||
from .validators import UnicodeUsernameValidator
|
||||
|
||||
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[List[str], Tuple[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: ...
|
||||
def update_last_login(
|
||||
sender: Type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
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:
|
||||
class PermissionManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
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[List[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
class Permission(models.Model):
|
||||
content_type_id: int
|
||||
id: int
|
||||
name: str = ...
|
||||
content_type: Any = ...
|
||||
codename: str = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
unique_together: Any = ...
|
||||
ordering: Any = ...
|
||||
def natural_key(self) -> Tuple[str, str, str]: ...
|
||||
|
||||
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: ...
|
||||
class GroupManager(models.Manager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def get_by_natural_key(self, name: str) -> Group: ...
|
||||
|
||||
class Group(models.Model):
|
||||
id: None
|
||||
name: str = ...
|
||||
permissions: Any = ...
|
||||
objects: Any = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
def natural_key(self): ...
|
||||
|
||||
class UserManager(BaseUserManager):
|
||||
creation_counter: int
|
||||
model: None
|
||||
name: None
|
||||
use_in_migrations: bool = ...
|
||||
def create_user(
|
||||
self,
|
||||
username: str,
|
||||
email: Optional[str] = ...,
|
||||
password: Optional[str] = ...,
|
||||
**extra_fields,
|
||||
) -> User: ...
|
||||
**extra_fields: Any
|
||||
) -> AbstractUser: ...
|
||||
def create_superuser(
|
||||
self,
|
||||
username: str,
|
||||
email: Optional[str],
|
||||
password: Optional[str],
|
||||
**extra_fields: Any
|
||||
) -> AbstractBaseUser: ...
|
||||
|
||||
class PermissionsMixin(models.Model):
|
||||
is_superuser: Any = ...
|
||||
groups: Any = ...
|
||||
user_permissions: Any = ...
|
||||
class Meta:
|
||||
abstract: bool = ...
|
||||
def get_group_permissions(self, obj: None = ...) -> Set[str]: ...
|
||||
def get_all_permissions(self, obj: Optional[str] = ...) -> Set[str]: ...
|
||||
def has_perm(
|
||||
self, perm: Union[str, Tuple[str, Any]], obj: Optional[str] = ...
|
||||
) -> bool: ...
|
||||
def has_perms(
|
||||
self, perm_list: Union[Set[str], List[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
def has_module_perms(self, app_label: str) -> bool: ...
|
||||
|
||||
class AbstractUser(AbstractBaseUser, PermissionsMixin):
|
||||
is_superuser: bool
|
||||
last_login: None
|
||||
password: str
|
||||
username_validator: Any = ...
|
||||
username: str = ...
|
||||
first_name: str = ...
|
||||
last_name: str = ...
|
||||
email: str = ...
|
||||
is_staff: bool = ...
|
||||
is_active: bool = ...
|
||||
date_joined: datetime.datetime = ...
|
||||
objects: Any = ...
|
||||
EMAIL_FIELD: str = ...
|
||||
USERNAME_FIELD: str = ...
|
||||
REQUIRED_FIELDS: Any = ...
|
||||
class Meta:
|
||||
verbose_name: Any = ...
|
||||
verbose_name_plural: Any = ...
|
||||
abstract: bool = ...
|
||||
def clean(self) -> None: ...
|
||||
def get_full_name(self) -> str: ...
|
||||
def get_short_name(self) -> str: ...
|
||||
def email_user(
|
||||
self, subject: str, message: str, from_email: str = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
class User(AbstractUser):
|
||||
date_joined: datetime.datetime
|
||||
email: str
|
||||
first_name: str
|
||||
id: None
|
||||
is_active: bool
|
||||
is_staff: bool
|
||||
is_superuser: bool
|
||||
last_login: None
|
||||
last_name: str
|
||||
password: str
|
||||
username: str
|
||||
class Meta(AbstractUser.Meta):
|
||||
swappable: str = ...
|
||||
|
||||
class AnonymousUser:
|
||||
id: Any = ...
|
||||
pk: Any = ...
|
||||
username: str = ...
|
||||
is_staff: bool = ...
|
||||
is_active: bool = ...
|
||||
is_superuser: bool = ...
|
||||
def __eq__(self, other: Union[AnonymousUser, User]) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def save(self) -> Any: ...
|
||||
def delete(self) -> Any: ...
|
||||
def set_password(self, raw_password: str) -> Any: ...
|
||||
def check_password(self, raw_password: str) -> Any: ...
|
||||
@property
|
||||
def groups(self) -> EmptyManager: ...
|
||||
@property
|
||||
def user_permissions(self) -> EmptyManager: ...
|
||||
def get_group_permissions(self, obj: None = ...) -> Set[Any]: ...
|
||||
def get_all_permissions(self, obj: Any = ...) -> Set[str]: ...
|
||||
def has_perm(self, perm: str, obj: None = ...) -> bool: ...
|
||||
def has_perms(
|
||||
self, perm_list: Union[List[str], Tuple[str]], obj: None = ...
|
||||
) -> bool: ...
|
||||
def has_module_perms(self, module: str) -> bool: ...
|
||||
@property
|
||||
def is_anonymous(self) -> bool: ...
|
||||
@property
|
||||
def is_authenticated(self) -> bool: ...
|
||||
def get_username(self) -> str: ...
|
||||
|
||||
@@ -1,54 +1,68 @@
|
||||
# Stubs for django.contrib.auth.password_validation (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
from pathlib import PosixPath
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.models import User
|
||||
from pathlib import PosixPath
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
def get_default_password_validators() -> Union[
|
||||
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
]: ...
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, str]]
|
||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
validator_config: List[Dict[str, Union[str, Dict[str, int]]]]
|
||||
) -> Union[
|
||||
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
|
||||
List[Union[UserAttributeSimilarityValidator, MinimumLengthValidator]],
|
||||
List[NumericPasswordValidator],
|
||||
]: ...
|
||||
def validate_password(
|
||||
password: str, user: Optional[User] = ..., password_validators: None = ...
|
||||
password: str,
|
||||
user: Optional[Union[AbstractBaseUser, SimpleLazyObject]] = ...,
|
||||
password_validators: Optional[List[Any]] = ...,
|
||||
) -> None: ...
|
||||
def password_changed(
|
||||
password: str, user: AbstractBaseUser = ..., password_validators: None = ...
|
||||
password: str,
|
||||
user: Optional[AbstractBaseUser] = ...,
|
||||
password_validators: None = ...,
|
||||
) -> None: ...
|
||||
def password_validators_help_texts(password_validators: None = ...) -> List[str]: ...
|
||||
def _password_validators_help_text_html(password_validators: None = ...) -> str: ...
|
||||
def password_validators_help_texts(
|
||||
password_validators: Optional[List[Any]] = ...
|
||||
) -> List[str]: ...
|
||||
|
||||
password_validators_help_text_html: Any
|
||||
|
||||
class MinimumLengthValidator:
|
||||
min_length: Any = ...
|
||||
min_length: int = ...
|
||||
def __init__(self, min_length: int = ...) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class UserAttributeSimilarityValidator:
|
||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
||||
user_attributes: Any = ...
|
||||
max_similarity: Any = ...
|
||||
user_attributes: Tuple[str, str, str, str] = ...
|
||||
max_similarity: float = ...
|
||||
def __init__(
|
||||
self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...
|
||||
self,
|
||||
user_attributes: Union[Tuple[str, str, str, str], List[str]] = ...,
|
||||
max_similarity: float = ...,
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class CommonPasswordValidator:
|
||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
||||
passwords: Any = ...
|
||||
def __init__(self, password_list_path: PosixPath = ...) -> None: ...
|
||||
passwords: Set[str] = ...
|
||||
def __init__(
|
||||
self, password_list_path: Union[str, PosixPath] = ...
|
||||
) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self): ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class NumericPasswordValidator:
|
||||
def validate(self, password: str, user: User = ...) -> None: ...
|
||||
def get_help_text(self): ...
|
||||
def validate(
|
||||
self, password: str, user: Optional[AbstractBaseUser] = ...
|
||||
) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
# Stubs for django.contrib.auth.tokens (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
|
||||
from datetime import date
|
||||
from django.contrib.auth.models import User
|
||||
from typing import Optional
|
||||
|
||||
class PasswordResetTokenGenerator:
|
||||
key_salt: str = ...
|
||||
secret: Any = ...
|
||||
def make_token(self, user: User) -> str: ...
|
||||
def check_token(self, user: User, token: Optional[str]) -> bool: ...
|
||||
def _make_token_with_timestamp(self, user: User, timestamp: int) -> str: ...
|
||||
def _make_hash_value(self, user: User, timestamp: int) -> str: ...
|
||||
def _num_days(self, dt: date) -> int: ...
|
||||
def _today(self) -> date: ...
|
||||
def make_token(self, user: AbstractBaseUser) -> str: ...
|
||||
def check_token(
|
||||
self, user: Optional[AbstractBaseUser], token: Optional[str]
|
||||
) -> bool: ...
|
||||
|
||||
default_token_generator: Any
|
||||
|
||||
@@ -1,64 +1,142 @@
|
||||
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, Type, Union
|
||||
|
||||
def redirect_to_login(
|
||||
next: str, login_url: Optional[str] = ..., redirect_field_name: Optional[str] = ...
|
||||
) -> HttpResponseRedirect: ...
|
||||
from django.contrib.auth.base_user import AbstractBaseUser
|
||||
from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm,
|
||||
PasswordResetForm, SetPasswordForm)
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sites.models import Site
|
||||
from django.contrib.sites.requests import RequestSite
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import FormView
|
||||
|
||||
class LoginView:
|
||||
UserModel: Any
|
||||
|
||||
class SuccessURLAllowedHostsMixin:
|
||||
success_url_allowed_hosts: Any = ...
|
||||
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
||||
|
||||
class LoginView(SuccessURLAllowedHostsMixin, FormView):
|
||||
form_class: Any = ...
|
||||
authentication_form: Any = ...
|
||||
redirect_field_name: Any = ...
|
||||
template_name: str = ...
|
||||
redirect_authenticated_user: bool = ...
|
||||
extra_context: Any = ...
|
||||
def dispatch(
|
||||
self, request: HttpRequest, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
self, request: HttpRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
def get_redirect_url(self) -> str: ...
|
||||
def get_form_class(self) -> Type[AuthenticationForm]: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Optional[Union[MultiValueDict, WSGIRequest]]]: ...
|
||||
def get_redirect_url(self) -> str: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[
|
||||
Union[Dict[Any, Any], Dict[str, str], MultiValueDict, HttpRequest]
|
||||
],
|
||||
]: ...
|
||||
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(
|
||||
self, **kwargs: Any
|
||||
) -> Dict[
|
||||
str, Union[AuthenticationForm, LoginView, str, Site, RequestSite]
|
||||
]: ...
|
||||
|
||||
class LogoutView:
|
||||
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
|
||||
next_page: Any = ...
|
||||
redirect_field_name: Any = ...
|
||||
template_name: str = ...
|
||||
extra_context: Any = ...
|
||||
def dispatch(
|
||||
self, request: HttpRequest, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
self, request: HttpRequest, *args: Any, **kwargs: Any
|
||||
) -> HttpResponse: ...
|
||||
def post(
|
||||
self, request: WSGIRequest, *args: Any, **kwargs: Any
|
||||
) -> TemplateResponse: ...
|
||||
def get_next_page(self) -> Optional[str]: ...
|
||||
def post(self, request: WSGIRequest, *args, **kwargs) -> TemplateResponse: ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
class PasswordChangeDoneView:
|
||||
def dispatch(self, *args, **kwargs) -> TemplateResponse: ...
|
||||
def logout_then_login(
|
||||
request: HttpRequest, login_url: Optional[str] = ...
|
||||
) -> HttpResponseRedirect: ...
|
||||
def redirect_to_login(
|
||||
next: str,
|
||||
login_url: Optional[str] = ...,
|
||||
redirect_field_name: Optional[str] = ...,
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
class PasswordChangeView:
|
||||
def dispatch(
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
class PasswordContextMixin:
|
||||
extra_context: Any = ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
class PasswordResetConfirmView:
|
||||
def dispatch(
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Optional[Union[MultiValueDict, User]]]: ...
|
||||
def get_user(self, uidb64: str) -> Optional[User]: ...
|
||||
|
||||
class PasswordResetView:
|
||||
def dispatch(
|
||||
self, *args, **kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
class PasswordResetView(PasswordContextMixin, FormView):
|
||||
email_template_name: str = ...
|
||||
extra_email_context: Any = ...
|
||||
form_class: Any = ...
|
||||
from_email: Any = ...
|
||||
html_email_template_name: Any = ...
|
||||
subject_template_name: str = ...
|
||||
success_url: Any = ...
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
token_generator: Any = ...
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||
def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ...
|
||||
|
||||
class SuccessURLAllowedHostsMixin:
|
||||
def get_success_url_allowed_hosts(self) -> Set[str]: ...
|
||||
INTERNAL_RESET_URL_TOKEN: str
|
||||
INTERNAL_RESET_SESSION_TOKEN: str
|
||||
|
||||
class PasswordResetDoneView(PasswordContextMixin, TemplateView):
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
|
||||
class PasswordResetConfirmView(PasswordContextMixin, FormView):
|
||||
form_class: Any = ...
|
||||
post_reset_login: bool = ...
|
||||
post_reset_login_backend: Any = ...
|
||||
success_url: Any = ...
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
token_generator: Any = ...
|
||||
validlink: bool = ...
|
||||
user: Any = ...
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str, Optional[Union[Dict[Any, Any], MultiValueDict, AbstractBaseUser]]
|
||||
]: ...
|
||||
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
class PasswordResetCompleteView(PasswordContextMixin, TemplateView):
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
def get_context_data(self, **kwargs: Any): ...
|
||||
|
||||
class PasswordChangeView(PasswordContextMixin, FormView):
|
||||
form_class: Any = ...
|
||||
success_url: Any = ...
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[
|
||||
str,
|
||||
Optional[Union[Dict[Any, Any], User, MultiValueDict, SimpleLazyObject]],
|
||||
]: ...
|
||||
def form_valid(self, form: PasswordChangeForm) -> HttpResponseRedirect: ...
|
||||
|
||||
class PasswordChangeDoneView(PasswordContextMixin, TemplateView):
|
||||
template_name: str = ...
|
||||
title: Any = ...
|
||||
def dispatch(self, *args: Any, **kwargs: Any) -> TemplateResponse: ...
|
||||
|
||||
Reference in New Issue
Block a user