mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 22:11:54 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -2,9 +2,5 @@ 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]: ...
|
||||
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]: ...
|
||||
|
||||
@@ -2,9 +2,7 @@ from typing import Any, Optional
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
from .management import (create_contenttypes,
|
||||
inject_rename_contenttypes_operations)
|
||||
|
||||
from .management import create_contenttypes, inject_rename_contenttypes_operations
|
||||
|
||||
class ContentTypesConfig(AppConfig):
|
||||
apps: None
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
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]: ...
|
||||
def check_generic_foreign_keys(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
def check_model_name_lengths(app_configs: None = ..., **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -5,13 +5,11 @@ 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.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 = ...
|
||||
@@ -29,37 +27,21 @@ class GenericForeignKey(FieldCacheMixin):
|
||||
for_concrete_model: bool = ...
|
||||
rel: None = ...
|
||||
column: None = ...
|
||||
def __init__(
|
||||
self,
|
||||
ct_field: str = ...,
|
||||
fk_field: str = ...,
|
||||
for_concrete_model: bool = ...,
|
||||
) -> 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 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] = ...,
|
||||
self, obj: Optional[Model] = ..., id: Optional[int] = ..., using: Optional[str] = ...
|
||||
) -> ContentType: ...
|
||||
def get_prefetch_queryset(
|
||||
self,
|
||||
instances: Union[List[Model], QuerySet],
|
||||
queryset: Optional[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 __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Optional[Union[GenericForeignKey, Model]]: ...
|
||||
def __set__(self, instance: Model, value: Optional[Model]) -> None: ...
|
||||
|
||||
class GenericRel(ForeignObjectRel):
|
||||
@@ -104,32 +86,17 @@ class GenericRelation(ForeignObject):
|
||||
) -> 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 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 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: ...
|
||||
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
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Any, Optional
|
||||
|
||||
from django.forms.models import BaseModelFormSet
|
||||
|
||||
|
||||
class BaseGenericInlineFormSet(BaseModelFormSet):
|
||||
instance: Any = ...
|
||||
rel_name: Any = ...
|
||||
|
||||
@@ -9,35 +9,20 @@ 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 __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
|
||||
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
|
||||
app_config: AppConfig, verbosity: int = ..., interactive: bool = ..., using: str = ..., apps: Apps = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
@@ -6,7 +6,6 @@ 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
|
||||
|
||||
@@ -4,7 +4,6 @@ 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
|
||||
@@ -12,12 +11,8 @@ class ContentTypeManager(models.Manager):
|
||||
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_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: ...
|
||||
|
||||
|
||||
@@ -3,9 +3,4 @@ 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: ...
|
||||
def shortcut(request: HttpRequest, content_type_id: Union[int, str], object_id: Union[int, str]) -> HttpResponseRedirect: ...
|
||||
|
||||
Reference in New Issue
Block a user