move generated stubs to separate directory, too messty

This commit is contained in:
Maxim Kurnikov
2018-11-10 17:49:18 +03:00
parent 7436d641e3
commit 96cd3ddb27
446 changed files with 58 additions and 71 deletions

View File

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

View File

@@ -0,0 +1,18 @@
from typing import Any, Optional
from django.apps import AppConfig
from .management import (create_contenttypes,
inject_rename_contenttypes_operations)
class ContentTypesConfig(AppConfig):
apps: None
label: str
models: None
models_module: None
module: Any
path: str
name: str = ...
verbose_name: Any = ...
def ready(self) -> None: ...

View File

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

View File

@@ -0,0 +1,139 @@
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.contrib.contenttypes.models import ContentType
from django.core.checks.messages import Error
from django.db.models.base import Model
from django.db.models.fields import Field, PositiveIntegerField
from django.db.models.fields.mixins import FieldCacheMixin
from django.db.models.fields.related import (ForeignObject, ForeignObjectRel,
ReverseManyToOneDescriptor)
from django.db.models.query import QuerySet
from django.db.models.query_utils import FilteredRelation, PathInfo
from django.db.models.sql.where import WhereNode
class GenericForeignKey(FieldCacheMixin):
auto_created: bool = ...
concrete: bool = ...
editable: bool = ...
hidden: bool = ...
is_relation: bool = ...
many_to_many: bool = ...
many_to_one: bool = ...
one_to_many: bool = ...
one_to_one: bool = ...
related_model: Any = ...
remote_field: Any = ...
ct_field: str = ...
fk_field: str = ...
for_concrete_model: bool = ...
rel: None = ...
column: None = ...
def __init__(
self,
ct_field: str = ...,
fk_field: str = ...,
for_concrete_model: bool = ...,
) -> None: ...
name: Any = ...
model: Any = ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def get_filter_kwargs_for_object(
self, obj: Model
) -> Dict[str, Optional[ContentType]]: ...
def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ...
def check(self, **kwargs: Any) -> List[Error]: ...
def get_cache_name(self) -> str: ...
def get_content_type(
self,
obj: Optional[Model] = ...,
id: Optional[int] = ...,
using: Optional[str] = ...,
) -> ContentType: ...
def get_prefetch_queryset(
self,
instances: Union[List[Model], QuerySet],
queryset: Optional[QuerySet] = ...,
) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ...
def __get__(
self, instance: Optional[Model], cls: Type[Model] = ...
) -> Optional[Union[GenericForeignKey, Model]]: ...
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
class GenericRel(ForeignObjectRel):
field: django.contrib.contenttypes.fields.GenericRelation
limit_choices_to: Dict[Any, Any]
model: Type[django.db.models.base.Model]
multiple: bool
on_delete: Callable
parent_link: bool
related_name: str
related_query_name: None
symmetrical: bool
def __init__(
self,
field: GenericRelation,
to: Union[Type[Model], str],
related_name: None = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: None = ...,
) -> None: ...
class GenericRelation(ForeignObject):
auto_created: bool = ...
many_to_many: bool = ...
many_to_one: bool = ...
one_to_many: bool = ...
one_to_one: bool = ...
rel_class: Any = ...
mti_inherited: bool = ...
object_id_field_name: Any = ...
content_type_field_name: Any = ...
for_concrete_model: Any = ...
def __init__(
self,
to: Union[Type[Model], str],
object_id_field: str = ...,
content_type_field: str = ...,
for_concrete_model: bool = ...,
related_query_name: Optional[str] = ...,
limit_choices_to: None = ...,
**kwargs: Any
) -> None: ...
def check(self, **kwargs: Any) -> List[Error]: ...
to_fields: Any = ...
def resolve_related_fields(
self
) -> List[Tuple[PositiveIntegerField, Field]]: ...
def get_path_info(
self, filtered_relation: Optional[FilteredRelation] = ...
) -> List[PathInfo]: ...
def get_reverse_path_info(
self, filtered_relation: None = ...
) -> List[PathInfo]: ...
def value_to_string(self, obj: Model) -> str: ...
model: Any = ...
def contribute_to_class(
self, cls: Type[Model], name: str, **kwargs: Any
) -> None: ...
def set_attributes_from_rel(self) -> None: ...
def get_internal_type(self) -> str: ...
def get_content_type(self) -> ContentType: ...
def get_extra_restriction(
self,
where_class: Type[WhereNode],
alias: Optional[str],
remote_alias: str,
) -> WhereNode: ...
def bulk_related_objects(
self, objs: List[Model], using: str = ...
) -> QuerySet: ...
class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor):
field: django.contrib.contenttypes.fields.GenericRelation
rel: django.contrib.contenttypes.fields.GenericRel
def related_manager_cls(self): ...
def create_generic_related_manager(superclass: Any, rel: Any): ...

View File

@@ -0,0 +1,42 @@
from typing import Any, Optional
from django.forms.models import BaseModelFormSet
class BaseGenericInlineFormSet(BaseModelFormSet):
instance: Any = ...
rel_name: Any = ...
save_as_new: Any = ...
def __init__(
self,
data: Optional[Any] = ...,
files: Optional[Any] = ...,
instance: Optional[Any] = ...,
save_as_new: bool = ...,
prefix: Optional[Any] = ...,
queryset: Optional[Any] = ...,
**kwargs: Any
) -> None: ...
def initial_form_count(self): ...
@classmethod
def get_default_prefix(cls): ...
def save_new(self, form: Any, commit: bool = ...): ...
def generic_inlineformset_factory(
model: Any,
form: Any = ...,
formset: Any = ...,
ct_field: str = ...,
fk_field: str = ...,
fields: Optional[Any] = ...,
exclude: Optional[Any] = ...,
extra: int = ...,
can_order: bool = ...,
can_delete: bool = ...,
max_num: Optional[Any] = ...,
formfield_callback: Optional[Any] = ...,
validate_max: bool = ...,
for_concrete_model: bool = ...,
min_num: Optional[Any] = ...,
validate_min: bool = ...,
): ...

View File

@@ -0,0 +1,43 @@
from typing import Any, Dict, List, Optional, Tuple, Type
from django.apps.config import AppConfig
from django.apps.registry import Apps
from django.contrib.contenttypes.models import ContentType
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: Any
) -> None: ...

View File

@@ -0,0 +1,23 @@
from typing import Any, Optional
from django.core.management import BaseCommand
from django.core.management.base import CommandParser
from django.db.models.deletion import Collector
from ...management import get_contenttypes_and_models
class Command(BaseCommand):
stderr: django.core.management.base.OutputWrapper
stdout: django.core.management.base.OutputWrapper
style: django.core.management.color.Style
def add_arguments(self, parser: CommandParser) -> None: ...
def handle(self, **options: Any) -> None: ...
class NoFastDeleteCollector(Collector):
data: collections.OrderedDict
dependencies: Dict[Any, Any]
fast_deletes: List[Any]
field_updates: Dict[Any, Any]
using: str
def can_fast_delete(self, *args: Any, **kwargs: Any) -> bool: ...

View File

@@ -0,0 +1,39 @@
from typing import Any, Dict, Optional, Tuple, Type, Union
from django.db import models
from django.db.models.base import Model
from django.db.models.query import QuerySet
class ContentTypeManager(models.Manager):
creation_counter: int
model: None
name: None
use_in_migrations: bool = ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ...
def get_for_model(
self, model: Union[Type[Model], Model], for_concrete_model: bool = ...
) -> ContentType: ...
def get_for_models(
self, *models: Any, for_concrete_models: bool = ...
) -> Dict[Type[Model], ContentType]: ...
def get_for_id(self, id: int) -> ContentType: ...
def clear_cache(self) -> None: ...
class ContentType(models.Model):
id: int
app_label: str = ...
model: str = ...
objects: Any = ...
class Meta:
verbose_name: Any = ...
verbose_name_plural: Any = ...
db_table: str = ...
unique_together: Any = ...
@property
def name(self) -> str: ...
def model_class(self) -> Optional[Type[Model]]: ...
def get_object_for_this_type(self, **kwargs: Any) -> Model: ...
def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ...
def natural_key(self) -> Tuple[str, str]: ...

View File

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