mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-24 04:41:31 +08:00
merge with stubgen output
This commit is contained in:
@@ -1,67 +1,35 @@
|
||||
# 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 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 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 typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _clean_credentials(credentials: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]: ...
|
||||
|
||||
|
||||
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]: ...
|
||||
|
||||
from typing import Any, Dict, List, Optional, Type, Union
|
||||
SESSION_KEY: str
|
||||
BACKEND_SESSION_KEY: str
|
||||
HASH_SESSION_KEY: str
|
||||
REDIRECT_FIELD_NAME: str
|
||||
|
||||
def load_backend(path: str) -> object: ...
|
||||
|
||||
|
||||
def login(
|
||||
request: HttpRequest,
|
||||
user: User,
|
||||
backend: Optional[Union[str, Type[ModelBackend]]] = ...
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def _get_backends(return_tuples: bool = ...) -> Any: ...
|
||||
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) -> Optional[AbstractBaseUser]: ...
|
||||
def login(request: HttpRequest, user: User, 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_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: SimpleLazyObject
|
||||
) -> None: ...
|
||||
default_app_config: str
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
class AuthConfig:
|
||||
def ready(self) -> None: ...
|
||||
# Stubs for django.contrib.auth.apps (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
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):
|
||||
name: str = ...
|
||||
verbose_name: Any = ...
|
||||
def ready(self) -> None: ...
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
)
|
||||
# Stubs for django.contrib.auth.checks (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .management import _get_builtin_permissions
|
||||
from typing import Any, Optional
|
||||
|
||||
def check_models_permissions(app_configs: None = ..., **kwargs) -> List[Any]: ...
|
||||
|
||||
|
||||
def check_user_model(app_configs: None = ..., **kwargs) -> List[Any]: ...
|
||||
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]: ...
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
from django.contrib.auth.models import (
|
||||
AnonymousUser,
|
||||
User,
|
||||
)
|
||||
# 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 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[PermWrapper, AnonymousUser, User]]: ...
|
||||
|
||||
|
||||
from typing import Dict, Union
|
||||
class PermLookupDict:
|
||||
def __bool__(self) -> bool: ...
|
||||
def __getitem__(self, perm_name: str) -> bool: ...
|
||||
def __init__(self, user: object, app_label: str) -> None: ...
|
||||
|
||||
def __repr__(self): ...
|
||||
def __getitem__(self, perm_name: str) -> bool: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
class PermWrapper:
|
||||
def __contains__(self, perm_name: str) -> bool: ...
|
||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||
user: Any = ...
|
||||
def __init__(self, user: object) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __getitem__(self, app_label: str) -> PermLookupDict: ...
|
||||
def __iter__(self) -> None: ...
|
||||
def __contains__(self, perm_name: str) -> bool: ...
|
||||
|
||||
def auth(request: HttpRequest) -> Dict[str, Union[PermWrapper, AnonymousUser, User]]: ...
|
||||
|
||||
@@ -1,27 +1,10 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
# Stubs for django.contrib.auth.decorators (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
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: ...
|
||||
from typing import Callable, List, Optional, Union
|
||||
def user_passes_test(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 = ...) -> Callable: ...
|
||||
def permission_required(perm: Union[str, List[str]], login_url: None = ..., raise_exception: bool = ...) -> Callable: ...
|
||||
|
||||
@@ -1,76 +1,113 @@
|
||||
# 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,
|
||||
)
|
||||
|
||||
|
||||
def check_password(
|
||||
password: str,
|
||||
encoded: str,
|
||||
setter: Optional[Callable] = ...,
|
||||
preferred: str = ...
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
|
||||
|
||||
|
||||
def get_hashers(
|
||||
) -> Union[List[UnsaltedMD5PasswordHasher], List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher]]: ...
|
||||
|
||||
|
||||
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
|
||||
|
||||
|
||||
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
|
||||
|
||||
from typing import Callable, Dict, List, Optional, Union
|
||||
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 = ...) -> 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_by_algorithm() -> Dict[str, BasePasswordHasher]: ...
|
||||
def reset_hashers(**kwargs: Any) -> None: ...
|
||||
def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ...
|
||||
def identify_hasher(encoded: str) -> BasePasswordHasher: ...
|
||||
def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ...
|
||||
|
||||
|
||||
def reset_hashers(**kwargs) -> None: ...
|
||||
|
||||
|
||||
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 must_update(self, encoded: str) -> bool: ...
|
||||
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:
|
||||
class PBKDF2PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
iterations: int = ...
|
||||
digest: Any = ...
|
||||
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 must_update(self, encoded: str) -> bool: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher):
|
||||
algorithm: str = ...
|
||||
digest: Any = ...
|
||||
|
||||
class SHA1PasswordHasher:
|
||||
class Argon2PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
library: str = ...
|
||||
time_cost: int = ...
|
||||
memory_cost: int = ...
|
||||
parallelism: int = ...
|
||||
def encode(self, password: Any, salt: Any): ...
|
||||
def verify(self, password: Any, encoded: Any): ...
|
||||
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 = ...
|
||||
digest: Any = ...
|
||||
library: Any = ...
|
||||
rounds: int = ...
|
||||
def salt(self): ...
|
||||
def encode(self, password: Any, salt: Any): ...
|
||||
def verify(self, password: Any, encoded: Any): ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def must_update(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
class BCryptPasswordHasher(BCryptSHA256PasswordHasher):
|
||||
algorithm: str = ...
|
||||
digest: Any = ...
|
||||
|
||||
class SHA1PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
|
||||
class UnsaltedMD5PasswordHasher:
|
||||
class MD5PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: str) -> OrderedDict: ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
|
||||
class UnsaltedSHA1PasswordHasher:
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
class UnsaltedSHA1PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
def salt(self) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
class UnsaltedMD5PasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
def salt(self): ...
|
||||
def encode(self, password: str, salt: str) -> str: ...
|
||||
def verify(self, password: str, encoded: str) -> bool: ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
class CryptPasswordHasher(BasePasswordHasher):
|
||||
algorithm: str = ...
|
||||
library: str = ...
|
||||
def salt(self): ...
|
||||
def encode(self, password: Any, salt: Any): ...
|
||||
def verify(self, password: Any, encoded: Any): ...
|
||||
def safe_summary(self, encoded: Any): ...
|
||||
def harden_runtime(self, password: Any, encoded: Any) -> None: ...
|
||||
|
||||
@@ -1,29 +1,15 @@
|
||||
# Stubs for django.contrib.auth.management (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
from django.apps.config import AppConfig
|
||||
from django.apps.registry import Apps
|
||||
from django.db.models.options import Options
|
||||
from typing import (
|
||||
List,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
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 create_permissions(app_config: AppConfig, verbosity: int = ..., interactive: bool = ..., using: str = ..., apps: Apps = ..., **kwargs: Any) -> None: ...
|
||||
def get_system_username() -> str: ...
|
||||
def get_default_username(check_db: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def get_system_username() -> str: ...
|
||||
@@ -1,60 +1,43 @@
|
||||
# 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 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 typing import Dict, List, Optional, Tuple, Union
|
||||
def get_default_password_validators() -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
def get_password_validators(validator_config: List[Dict[str, str]]) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
def validate_password(password: str, user: Optional[User] = ..., password_validators: None = ...) -> None: ...
|
||||
def password_changed(password: str, user: 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 get_default_password_validators(
|
||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
|
||||
|
||||
def get_password_validators(
|
||||
validator_config: List[Dict[str, str]]
|
||||
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
|
||||
|
||||
|
||||
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: ...
|
||||
|
||||
password_validators_help_text_html: Any
|
||||
|
||||
class MinimumLengthValidator:
|
||||
min_length: Any = ...
|
||||
def __init__(self, min_length: int = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class UserAttributeSimilarityValidator:
|
||||
DEFAULT_USER_ATTRIBUTES: Any = ...
|
||||
user_attributes: Any = ...
|
||||
max_similarity: Any = ...
|
||||
def __init__(self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self) -> str: ...
|
||||
|
||||
class CommonPasswordValidator:
|
||||
DEFAULT_PASSWORD_LIST_PATH: Any = ...
|
||||
passwords: Any = ...
|
||||
def __init__(self, password_list_path: PosixPath = ...) -> None: ...
|
||||
def validate(self, password: str, user: None = ...) -> None: ...
|
||||
def get_help_text(self): ...
|
||||
|
||||
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: ...
|
||||
def get_help_text(self): ...
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
# Stubs for django.contrib.auth.tokens (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
|
||||
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: ...
|
||||
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 check_token(self, user: User, token: Optional[str]) -> bool: ...
|
||||
def make_token(self, user: User) -> str: ...
|
||||
|
||||
default_token_generator: Any
|
||||
|
||||
Reference in New Issue
Block a user