fourth iteration

This commit is contained in:
Maxim Kurnikov
2018-08-11 02:23:18 +03:00
parent c6bceb19f4
commit 8cc446150c
113 changed files with 2285 additions and 9835 deletions

View File

@@ -6,6 +6,7 @@ from django.db.models.base import Model
from django.db.models.fields import BooleanField, DateField, Field
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import RelatedField
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query import QuerySet
@@ -47,7 +48,7 @@ class FieldListFilter(ListFilter):
title: Any = ...
def __init__(
self,
field: Union[Field, mixins.FieldCacheMixin],
field: Union[Field, ForeignObjectRel],
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],
@@ -76,7 +77,7 @@ class FieldListFilter(ListFilter):
@classmethod
def create(
cls,
field: Union[Field, mixins.FieldCacheMixin],
field: Union[Field, ForeignObjectRel],
request: WSGIRequest,
params: Dict[str, str],
model: Type[Model],

View File

@@ -23,13 +23,7 @@ class LogEntryManager(models.Manager):
action_flag: int,
change_message: Union[
Dict[str, Dict[str, List[str]]],
List[
Union[
Dict[str, Dict[str, List[str]]],
Dict[str, Dict[str, Union[List[str], str]]],
Dict[str, Dict[str, str]],
]
],
List[Dict[str, Dict[str, Union[List[str], str]]]],
str,
] = ...,
) -> LogEntry: ...

View File

@@ -100,14 +100,7 @@ class BaseModelAdmin:
],
Tuple[Tuple[None, Dict[str, Tuple[Tuple[str, str]]]]],
Tuple[
Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]],
Tuple[
str,
Union[
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
Dict[str, Union[Tuple[str, str], Tuple[str]]],
],
],
Tuple[str, Dict[str, Tuple[str]]], Tuple[str, Dict[str, Tuple[str]]]
],
]: ...
def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ...
@@ -137,16 +130,7 @@ class BaseModelAdmin:
class ModelAdmin(BaseModelAdmin):
formfield_overrides: Dict[
Type[
Union[
django.db.models.fields.CharField,
django.db.models.fields.DateField,
django.db.models.fields.IntegerField,
django.db.models.fields.TextField,
django.db.models.fields.TimeField,
django.db.models.fields.files.FileField,
]
],
Type[Any],
Dict[
str,
Type[
@@ -234,8 +218,7 @@ class ModelAdmin(BaseModelAdmin):
request: WSGIRequest,
object: Model,
message: Union[
Dict[str, Dict[Any, Any]],
List[Union[Dict[str, Dict[Any, Any]], Dict[str, Dict[str, str]]]],
Dict[str, Dict[Any, Any]], List[Dict[str, Dict[str, str]]]
],
) -> LogEntry: ...
def log_change(
@@ -244,13 +227,7 @@ class ModelAdmin(BaseModelAdmin):
object: Model,
message: Union[
Dict[str, Dict[str, List[str]]],
List[
Union[
Dict[str, Dict[str, List[str]]],
Dict[str, Dict[str, Union[List[str], str]]],
Dict[str, Dict[str, str]],
]
],
List[Dict[str, Dict[str, Union[List[str], str]]]],
],
) -> LogEntry: ...
def log_deletion(

View File

@@ -40,14 +40,7 @@ def result_list(
) -> Dict[
str,
Union[
List[
Union[
Dict[str, Optional[Union[int, str]]],
Dict[str, Union[bool, SafeText]],
Dict[str, Union[bool, str]],
Dict[str, Union[int, str]],
]
],
List[Dict[str, Optional[Union[int, str]]]],
List[ResultList],
List[BoundField],
ChangeList,

View File

@@ -1,5 +1,4 @@
from datetime import date, datetime
from decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
from uuid import UUID
@@ -11,10 +10,8 @@ from django.core.handlers.wsgi import WSGIRequest
from django.db.models.base import Model
from django.db.models.deletion import Collector
from django.db.models.fields import Field
from django.db.models.fields.files import FieldFile
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.reverse_related import (ForeignObjectRel,
ManyToOneRel)
from django.db.models.fields.reverse_related import ManyToOneRel, OneToOneRel
from django.db.models.options import Options
from django.db.models.query import QuerySet
@@ -48,28 +45,20 @@ def flatten_fieldsets(
],
]
],
List[Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]]],
List[Tuple[str, Dict[str, Tuple[str]]]],
Tuple[
Tuple[
None,
Union[
Dict[str, Tuple[Tuple[str, str]]],
Dict[str, Tuple[str, str, List[str]]],
Dict[str, Tuple[str, str, Tuple[str, str]]],
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
Union[
Tuple[Dict[str, Tuple[str]], Dict[str, Tuple[str]]],
Tuple[
None,
Union[
Dict[str, Tuple[Tuple[str, str]]],
Dict[str, Tuple[str, str, List[str]]],
Dict[str, Tuple[str, str, Tuple[str, str]]],
],
],
]
],
Tuple[
Tuple[str, Dict[str, Union[Tuple[str, str], Tuple[str]]]],
Tuple[
str,
Union[
Dict[str, Union[Tuple[str, str, str], Tuple[str]]],
Dict[str, Union[Tuple[str, str], Tuple[str]]],
],
],
],
]
) -> List[Union[Callable, str]]: ...
def get_deleted_objects(
@@ -112,12 +101,9 @@ def model_ngettext(
def lookup_field(
name: Union[Callable, str], obj: Model, model_admin: BaseModelAdmin = ...
) -> Union[
Tuple[None, Callable, Optional[Union[Callable, date, int, str]]],
Tuple[
Optional[Union[date, Model, FieldFile, float, int, str]],
Optional[Union[date, Model, FieldFile, float, int, str]],
Optional[Union[date, Model, FieldFile, float, int, str]],
],
Tuple[None, Callable, Optional[Callable]],
Tuple[None, Union[date, Model, int, str], Union[date, Model, int, str]],
Tuple[Field, None, Any],
]: ...
def label_for_field(
name: Union[Callable, str],
@@ -125,35 +111,32 @@ def label_for_field(
model_admin: Optional[BaseModelAdmin] = ...,
return_attr: bool = ...,
) -> Union[
Tuple[Callable, Callable],
Tuple[str, Optional[Union[Type[str], GenericForeignKey]]],
Tuple[
Optional[Union[Callable, GenericForeignKey]],
Optional[Union[Callable, GenericForeignKey]],
],
Tuple[str, Type[str]],
str,
]: ...
def help_text_for_field(name: str, model: Type[Model]) -> str: ...
def display_for_field(
value: Optional[Union[date, Decimal, Model, FieldFile, float, int, str]],
field: Union[Field, mixins.FieldCacheMixin],
empty_value_display: str,
value: Any, field: Union[Field, OneToOneRel], empty_value_display: str
) -> str: ...
def display_for_value(
value: Optional[
Union[Callable, List[Union[int, str]], date, Model, FieldFile, int, str]
],
empty_value_display: str,
boolean: bool = ...,
value: Any, empty_value_display: str, boolean: bool = ...
) -> str: ...
class NotRelationField(Exception): ...
def get_model_from_relation(
field: Union[Field, ForeignObjectRel]
field: Union[Field, mixins.FieldCacheMixin]
) -> Type[Model]: ...
def reverse_field_path(
model: Type[Model], path: str
) -> Tuple[Type[Model], str]: ...
def get_fields_from_path(
model: Type[Model], path: str
) -> List[Union[Field, ForeignObjectRel]]: ...
) -> List[Union[Field, mixins.FieldCacheMixin]]: ...
def construct_change_message(
form: AdminPasswordChangeForm, formsets: None, add: bool
) -> List[Dict[str, Dict[str, List[str]]]]: ...

View File

@@ -1,12 +1,12 @@
from collections import OrderedDict
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.contrib.admin.filters import FieldListFilter, SimpleListFilter
from django.contrib.admin.filters import ListFilter, 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 BaseExpression, CombinedExpression, F
from django.db.models.expressions import (Combinable, CombinedExpression,
OrderBy)
from django.db.models.query import QuerySet
ALL_VAR: str
@@ -64,16 +64,7 @@ class ChangeList:
def get_filters_params(self, params: None = ...) -> Dict[str, str]: ...
def get_filters(
self, request: WSGIRequest
) -> Union[
Tuple[List[Any], bool, Dict[str, datetime], bool],
Tuple[
List[Union[FieldListFilter, SimpleListFilter]],
bool,
Dict[str, bool],
bool,
],
Tuple[List[FieldListFilter], bool, Dict[str, str], bool],
]: ...
) -> Tuple[List[ListFilter], bool, bool, bool]: ...
def get_query_string(
self,
new_params: Optional[
@@ -95,7 +86,7 @@ class ChangeList:
) -> Optional[Union[CombinedExpression, str]]: ...
def get_ordering(
self, request: WSGIRequest, queryset: QuerySet
) -> List[Union[BaseExpression, F, str]]: ...
) -> Union[List[Union[Combinable, str]], List[Union[OrderBy, str]]]: ...
def get_ordering_field_columns(self) -> OrderedDict: ...
def get_queryset(self, request: WSGIRequest) -> QuerySet: ...
def apply_select_related(self, qs: QuerySet) -> QuerySet: ...

View File

@@ -1,19 +1,14 @@
from collections import OrderedDict
from datetime import datetime
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from uuid import UUID
from django import forms
from django.contrib.admin.sites import AdminSite, DefaultAdminSite
from django.contrib.auth.forms import (ReadOnlyPasswordHashField,
ReadOnlyPasswordHashWidget)
from django.db.models.fields.reverse_related import ForeignObjectRel
from django.db.models.query_utils import Q
from django.forms.fields import (BooleanField, CharField, Field, FileField,
IntegerField, SplitDateTimeField, URLField)
from django.forms.models import ModelChoiceField, ModelMultipleChoiceField
from django.forms.widgets import (CheckboxInput, ChoiceWidget, DateInput,
Media, Select, TimeInput, Widget)
from django.forms.fields import Field
from django.forms.widgets import ChoiceWidget, Media, Widget
from django.http.request import QueryDict
from django.utils.datastructures import MultiValueDict
@@ -35,24 +30,29 @@ class FilteredSelectMultiple(forms.SelectMultiple):
name: str,
value: Union[List[Any], str],
attrs: Optional[Dict[str, str]],
) -> Dict[
str,
) -> Union[
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[Dict[str, Union[Dict[Any, Any], int, str]]],
int,
]
],
List[str],
bool,
Dict[
str,
Union[
Dict[str, Union[int, str]],
List[
Tuple[
None,
List[Dict[str, Union[Dict[Any, Any], int, str]]],
int,
]
],
bool,
str,
],
],
],
Dict[
str,
Dict[str, Union[Dict[str, Union[int, str]], List[str], bool, str]],
],
]: ...
class AdminDateWidget(forms.DateInput):
@@ -291,62 +291,8 @@ class RelatedFieldWidgetWrapper(forms.Widget):
) -> None: ...
def __deepcopy__(
self,
memo: Union[
Dict[
int,
Union[
List[
Union[
AdminEmailInputWidget,
AdminTextInputWidget,
FilteredSelectMultiple,
RelatedFieldWidgetWrapper,
ReadOnlyPasswordHashField,
ReadOnlyPasswordHashWidget,
BooleanField,
CharField,
ModelMultipleChoiceField,
CheckboxInput,
]
],
List[
Union[
AdminFileWidget,
AdminTextInputWidget,
CharField,
FileField,
]
],
List[Union[AdminIntegerFieldWidget, IntegerField]],
List[
Union[
AdminSplitDateTime,
AdminTextInputWidget,
AdminTextareaWidget,
RelatedFieldWidgetWrapper,
CharField,
SplitDateTimeField,
ModelChoiceField,
DateInput,
Select,
TimeInput,
]
],
OrderedDict,
Field,
Widget,
],
],
Dict[
int,
Union[
List[Union[AdminURLFieldWidget, URLField]],
OrderedDict,
AdminURLFieldWidget,
URLField,
ModelChoiceField,
],
],
memo: Dict[
int, Union[List[Union[Field, Widget]], OrderedDict, Field, Widget]
],
) -> RelatedFieldWidgetWrapper: ...
@property
@@ -432,18 +378,7 @@ class AutocompleteMixin:
name: str,
value: List[str],
attr: Dict[str, Union[bool, str]] = ...,
) -> List[
Tuple[
None,
List[
Union[
Dict[str, Union[Dict[Any, Any], bool, str]],
Dict[str, Union[Dict[str, bool], Set[str], int, str]],
]
],
int,
]
]: ...
) -> List[Tuple[None, int, int]]: ...
@property
def media(self) -> Media: ...

View File

@@ -14,16 +14,7 @@ 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.CharField,
django.db.models.fields.DateField,
django.db.models.fields.IntegerField,
django.db.models.fields.TextField,
django.db.models.fields.TimeField,
django.db.models.fields.files.FileField,
]
],
Type[Any],
Dict[
str,
Type[
@@ -49,16 +40,7 @@ class GroupAdmin(admin.ModelAdmin):
class UserAdmin(admin.ModelAdmin):
admin_site: django.contrib.admin.sites.AdminSite
formfield_overrides: Dict[
Type[
Union[
django.db.models.fields.CharField,
django.db.models.fields.DateField,
django.db.models.fields.IntegerField,
django.db.models.fields.TextField,
django.db.models.fields.TimeField,
django.db.models.fields.files.FileField,
]
],
Type[Any],
Dict[
str,
Type[

View File

@@ -11,9 +11,7 @@ def get_default_password_validators() -> Union[
List[NumericPasswordValidator],
]: ...
def get_password_validators(
validator_config: List[
Union[Dict[str, Union[Dict[str, int], str]], Dict[str, str]]
]
validator_config: List[Dict[str, Union[Dict[str, int], str]]]
) -> Union[
List[Union[CommonPasswordValidator, MinimumLengthValidator]],
List[Union[MinimumLengthValidator, UserAttributeSimilarityValidator]],
@@ -48,7 +46,7 @@ class UserAttributeSimilarityValidator:
def __init__(
self,
user_attributes: Union[List[str], Tuple[str, str, str, str]] = ...,
max_similarity: Union[float, int] = ...,
max_similarity: float = ...,
) -> None: ...
def validate(self, password: str, user: Optional[User] = ...) -> None: ...
def get_help_text(self) -> str: ...

View File

@@ -10,7 +10,6 @@ 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.views.generic.base import TemplateView
from django.views.generic.edit import FormView
@@ -35,12 +34,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
def get_form_class(self) -> Type[AuthenticationForm]: ...
def get_form_kwargs(
self
) -> Dict[
str,
Optional[
Union[Dict[Any, Any], Dict[str, str], HttpRequest, MultiValueDict]
],
]: ...
) -> Dict[str, Optional[Union[Dict[str, str], HttpRequest]]]: ...
def form_valid(self, form: AuthenticationForm) -> HttpResponseRedirect: ...
def get_context_data(
self, **kwargs: Any
@@ -111,9 +105,7 @@ class PasswordResetConfirmView(PasswordContextMixin, FormView):
def get_user(self, uidb64: str) -> Optional[AbstractBaseUser]: ...
def get_form_kwargs(
self
) -> Dict[
str, Optional[Union[Dict[Any, Any], AbstractBaseUser, MultiValueDict]]
]: ...
) -> Dict[str, Optional[Union[Dict[Any, Any], AbstractBaseUser]]]: ...
def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ...
def get_context_data(self, **kwargs: Any): ...

View File

@@ -1,55 +1,43 @@
from typing import Dict, List, Optional, Tuple, Type, Union
from typing import Any, Dict, List, Optional, Tuple, Type
from django.apps.config import AppConfig
from django.apps.registry import Apps
from django.contrib.admin.migrations.0001_initial import Migration
from django.contrib.admin.migrations.0002_logentry_remove_auto_add import \
Migration
from django.contrib.admin.migrations.0003_logentry_add_action_flag_choices import \
Migration
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.migrations.0001_initial import Migration
from django.contrib.sites.migrations.0002_alter_domain_unique import Migration
from django.db import migrations
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.migration import Migration
from django.db.migrations.state import StateApps
from django.db.models.base import Model
class RenameContentType(migrations.RunPython):
app_label: Any = ...
old_model: Any = ...
new_model: Any = ...
def __init__(
self, app_label: str, old_model: str, new_model: str
) -> None: ...
def rename_forward(
self, apps: StateApps, schema_editor: DatabaseSchemaEditor
) -> None: ...
def rename_backward(
self, apps: StateApps, schema_editor: DatabaseSchemaEditor
) -> None: ...
def inject_rename_contenttypes_operations(
plan: List[Tuple[Migration, bool]] = ...,
apps: StateApps = ...,
using: str = ...,
**kwargs: Any
) -> None: ...
def get_contenttypes_and_models(
app_config: AppConfig, using: str, ContentType: Type[ContentType]
) -> Tuple[Dict[str, ContentType], Dict[str, Type[Model]]]: ...
def create_contenttypes(
app_config: AppConfig,
verbosity: int = ...,
interactive: bool = ...,
using: str = ...,
apps: Apps = ...,
**kwargs
**kwargs: Any
) -> None: ...
def get_contenttypes_and_models(
app_config: AppConfig,
using: str,
ContentType: Type[ContentType]
) -> Tuple[Dict[str, ContentType], Dict[str, Type[Model]]]: ...
def inject_rename_contenttypes_operations(
plan: List[Union[Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool], Tuple[Migration, bool]]] = ...,
apps: StateApps = ...,
using: str = ...,
**kwargs
) -> None: ...
class RenameContentType:
def __init__(self, app_label: str, 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

@@ -6,7 +6,7 @@ register: Any
def ordinal(value: Optional[str]) -> Optional[str]: ...
def intcomma(
value: Optional[Union[Decimal, float, int, str]], use_l10n: bool = ...
value: Optional[Union[Decimal, float, str]], use_l10n: bool = ...
) -> str: ...
intword_converters: Any

View File

@@ -1,6 +1,7 @@
from typing import Any, Dict, List, Optional, Tuple, Union
from django.contrib.postgres import lookups
from django.contrib.postgres.fields.mixins import CheckFieldDefaultMixin
from django.db.models import Field, Transform
from django.db.models.fields import Field
from django.db.models.lookups import Exact, In
@@ -16,7 +17,10 @@ class ArrayField(CheckFieldDefaultMixin, Field):
default_validators: Any = ...
from_db_value: Any = ...
def __init__(
self, base_field: Field, size: None = ..., **kwargs: Any
self,
base_field: Union[CheckFieldDefaultMixin, Field],
size: None = ...,
**kwargs: Any
) -> None: ...
@property
def model(self): ...

View File

@@ -26,7 +26,7 @@ class Command(BaseCommand):
ignore_patterns: Any = ...
post_process: Any = ...
def set_options(self, **options: Any) -> None: ...
def collect(self) -> Dict[str, Union[List[Any], List[str]]]: ...
def collect(self) -> Dict[str, List[str]]: ...
def handle(self, **options: Any) -> Optional[str]: ...
def log(self, msg: str, level: int = ...) -> None: ...
def is_local_storage(self) -> bool: ...