black reformat, some fixes

This commit is contained in:
Maxim Kurnikov
2018-12-06 19:13:06 +03:00
parent 25a71a7ef5
commit 5ec2830ba6
108 changed files with 673 additions and 187 deletions

View File

@@ -18,7 +18,9 @@ REDIRECT_FIELD_NAME: str
def load_backend(path: str) -> ModelBackend: ...
def get_backends() -> List[ModelBackend]: ...
def authenticate(request: Any = ..., **credentials: Any) -> Optional[AbstractBaseUser]: ...
def login(request: HttpRequest, user: AbstractBaseUser, backend: Optional[Union[Type[ModelBackend], str]] = ...) -> None: ...
def login(
request: HttpRequest, user: AbstractBaseUser, backend: Optional[Union[Type[ModelBackend], str]] = ...
) -> None: ...
def logout(request: HttpRequest) -> None: ...
def get_user_model() -> Type[Model]: ...
def get_user(request: HttpRequest) -> Union[AbstractBaseUser, AnonymousUser]: ...

View File

@@ -14,7 +14,9 @@ class ModelBackend:
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[AbstractBaseUser, AnonymousUser], perm: str, obj: Optional[str] = ...) -> bool: ...
def has_perm(
self, user_obj: Union[AbstractBaseUser, AnonymousUser], perm: str, obj: Optional[str] = ...
) -> bool: ...
def has_module_perms(self, user_obj: Union[AbstractBaseUser, AnonymousUser], app_label: str) -> bool: ...
def get_user(self, user_id: int) -> AbstractBaseUser: ...

View File

@@ -1,6 +1,8 @@
from typing import Any, Callable, List, Optional, Set, Union
def user_passes_test(test_func: Callable, login_url: Optional[str] = ..., redirect_field_name: str = ...) -> Callable: ...
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: Optional[str] = ...
) -> Callable: ...

View File

@@ -5,7 +5,9 @@ UNUSABLE_PASSWORD_PREFIX: str
UNUSABLE_PASSWORD_SUFFIX_LENGTH: int
def is_password_usable(encoded: Optional[str]) -> bool: ...
def check_password(password: Optional[str], encoded: str, setter: Optional[Callable] = ..., preferred: str = ...) -> bool: ...
def check_password(
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() -> List[BasePasswordHasher]: ...
def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ...

View File

@@ -4,7 +4,12 @@ from django.apps.config import AppConfig
from django.apps.registry import Apps
def create_permissions(
app_config: AppConfig, verbosity: int = ..., interactive: bool = ..., using: str = ..., apps: Apps = ..., **kwargs: Any
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: ...

View File

@@ -4,14 +4,18 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from django.contrib.auth.base_user import AbstractBaseUser
from django.contrib.auth.models import User
def get_default_password_validators() -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
def get_default_password_validators() -> Union[
List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]
]: ...
def get_password_validators(
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
) -> Union[List[NumericPasswordValidator], List[UserAttributeSimilarityValidator]]: ...
def validate_password(
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: Optional[List[Any]] = ...
) -> None: ...
def password_changed(password: str, user: Optional[AbstractBaseUser] = ..., password_validators: None = ...) -> None: ...
def password_changed(
password: str, user: Optional[AbstractBaseUser] = ..., password_validators: None = ...
) -> None: ...
def password_validators_help_texts(password_validators: Optional[List[Any]] = ...) -> List[str]: ...
password_validators_help_text_html: Any

View File

@@ -32,7 +32,9 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
def get_form_class(self) -> Type[AuthenticationForm]: ...
def get_form_kwargs(self) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest, MultiValueDict]]]: ...
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs: Any) -> Dict[str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]]: ...
def get_context_data(
self, **kwargs: Any
) -> Dict[str, Union[AuthenticationForm, LoginView, Site, RequestSite, str]]: ...
class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
next_page: Any = ...