mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 12:44:29 +08:00
enable bunch of folders
This commit is contained in:
@@ -79,6 +79,7 @@ class GenericRelation(ForeignObject):
|
|||||||
object_id_field_name: Any = ...
|
object_id_field_name: Any = ...
|
||||||
content_type_field_name: Any = ...
|
content_type_field_name: Any = ...
|
||||||
for_concrete_model: Any = ...
|
for_concrete_model: Any = ...
|
||||||
|
to_fields: Any = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
to: Union[Type[Model], str],
|
to: Union[Type[Model], str],
|
||||||
@@ -90,13 +91,11 @@ class GenericRelation(ForeignObject):
|
|||||||
**kwargs: Any
|
**kwargs: Any
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Error]: ...
|
def check(self, **kwargs: Any) -> List[Error]: ...
|
||||||
to_fields: Any = ...
|
|
||||||
def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ...
|
def resolve_related_fields(self) -> List[Tuple[PositiveIntegerField, Field]]: ...
|
||||||
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
|
def get_path_info(self, filtered_relation: Optional[FilteredRelation] = ...) -> List[PathInfo]: ...
|
||||||
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ...
|
||||||
def value_to_string(self, obj: Model) -> str: ...
|
def value_to_string(self, obj: Model) -> str: ...
|
||||||
model: Any = ...
|
model: Any = ...
|
||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
|
||||||
def set_attributes_from_rel(self) -> None: ...
|
def set_attributes_from_rel(self) -> None: ...
|
||||||
def get_internal_type(self) -> str: ...
|
def get_internal_type(self) -> str: ...
|
||||||
def get_content_type(self) -> ContentType: ...
|
def get_content_type(self) -> ContentType: ...
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from datetime import date, datetime
|
from datetime import date, datetime as datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
from .api import get_level as get_level, set_level as set_level
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ from django.http.response import HttpResponse, HttpResponseBase
|
|||||||
logger: Any
|
logger: Any
|
||||||
|
|
||||||
class BaseHandler:
|
class BaseHandler:
|
||||||
|
_view_middleware: None = ...
|
||||||
|
_template_response_middleware: None = ...
|
||||||
|
_exception_middleware: None = ...
|
||||||
|
_middleware_chain: None = ...
|
||||||
def load_middleware(self) -> None: ...
|
def load_middleware(self) -> None: ...
|
||||||
def make_view_atomic(self, view: Callable) -> Callable: ...
|
def make_view_atomic(self, view: Callable) -> Callable: ...
|
||||||
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
|
def get_exception_response(self, request: Any, resolver: Any, status_code: Any, exception: Any): ...
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ from . import migrations
|
|||||||
|
|
||||||
connections: Any
|
connections: Any
|
||||||
router: Any
|
router: Any
|
||||||
|
connection: Any
|
||||||
|
|
||||||
class DefaultConnectionProxy:
|
class DefaultConnectionProxy:
|
||||||
def __getattr__(self, item: str) -> Any: ...
|
def __getattr__(self, item: str) -> Any: ...
|
||||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||||
def __delattr__(self, name: str) -> None: ...
|
def __delattr__(self, name: str) -> None: ...
|
||||||
|
|
||||||
connection: Any
|
def close_old_connections(**kwargs): ...
|
||||||
|
|||||||
@@ -80,3 +80,5 @@ from .aggregates import (
|
|||||||
Sum as Sum,
|
Sum as Sum,
|
||||||
Aggregate as Aggregate,
|
Aggregate as Aggregate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .indexes import Index as Index
|
||||||
|
|||||||
@@ -23,3 +23,10 @@ class Model(metaclass=ModelBase):
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
def refresh_from_db(self, using: None = ..., fields: Optional[List[str]] = ...) -> None: ...
|
def refresh_from_db(self, using: None = ..., fields: Optional[List[str]] = ...) -> None: ...
|
||||||
def get_deferred_fields(self) -> Set[str]: ...
|
def get_deferred_fields(self) -> Set[str]: ...
|
||||||
|
|
||||||
|
class ModelStateFieldsCacheDescriptor: ...
|
||||||
|
|
||||||
|
class ModelState:
|
||||||
|
db: None = ...
|
||||||
|
adding: bool = ...
|
||||||
|
fields_cache: ModelStateFieldsCacheDescriptor = ...
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
from django.db import IntegrityError
|
||||||
|
|
||||||
def CASCADE(collector, field, sub_objs, using): ...
|
def CASCADE(collector, field, sub_objs, using): ...
|
||||||
def SET_NULL(collector, field, sub_objs, using): ...
|
def SET_NULL(collector, field, sub_objs, using): ...
|
||||||
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
||||||
def DO_NOTHING(collector, field, sub_objs, using): ...
|
def DO_NOTHING(collector, field, sub_objs, using): ...
|
||||||
def PROTECT(collector, field, sub_objs, using): ...
|
def PROTECT(collector, field, sub_objs, using): ...
|
||||||
|
|
||||||
|
class ProtectedError(IntegrityError): ...
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from typing import Any, Optional, Tuple, Iterable, Callable, Dict, Union
|
from typing import Any, Optional, Tuple, Iterable, Callable, Dict, Union, Type
|
||||||
|
|
||||||
|
from django.db.models import Model
|
||||||
from django.db.models.query_utils import RegisterLookupMixin
|
from django.db.models.query_utils import RegisterLookupMixin
|
||||||
|
from django.forms import Widget, Field as FormField
|
||||||
from django.forms.widgets import Widget
|
|
||||||
|
|
||||||
_Choice = Tuple[Any, str]
|
_Choice = Tuple[Any, str]
|
||||||
_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]]
|
_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]]
|
||||||
@@ -15,11 +15,13 @@ class Field(RegisterLookupMixin):
|
|||||||
widget: Widget
|
widget: Widget
|
||||||
help_text: str
|
help_text: str
|
||||||
db_table: str
|
db_table: str
|
||||||
|
remote_field: Field
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
verbose_name: Optional[str] = ...,
|
verbose_name: Optional[str] = ...,
|
||||||
name: Optional[str] = ...,
|
name: Optional[str] = ...,
|
||||||
primary_key: bool = ...,
|
primary_key: bool = ...,
|
||||||
|
max_length: Optional[int] = ...,
|
||||||
unique: bool = ...,
|
unique: bool = ...,
|
||||||
blank: bool = ...,
|
blank: bool = ...,
|
||||||
null: bool = ...,
|
null: bool = ...,
|
||||||
@@ -36,6 +38,12 @@ class Field(RegisterLookupMixin):
|
|||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
def __get__(self, instance, owner) -> Any: ...
|
def __get__(self, instance, owner) -> Any: ...
|
||||||
|
def deconstruct(self) -> Any: ...
|
||||||
|
def set_attributes_from_name(self, name: str) -> None: ...
|
||||||
|
def db_parameters(self, connection: Any) -> Dict[str, str]: ...
|
||||||
|
def get_prep_value(self, value: Any) -> Any: ...
|
||||||
|
def formfield(self, **kwargs) -> FormField: ...
|
||||||
|
def contribute_to_class(self, cls: Type[Model], name: str, private_only: bool = ...) -> None: ...
|
||||||
|
|
||||||
class IntegerField(Field):
|
class IntegerField(Field):
|
||||||
def __get__(self, instance, owner) -> int: ...
|
def __get__(self, instance, owner) -> int: ...
|
||||||
@@ -91,6 +99,9 @@ class CharField(Field):
|
|||||||
editable: bool = ...,
|
editable: bool = ...,
|
||||||
auto_created: bool = ...,
|
auto_created: bool = ...,
|
||||||
serialize: bool = ...,
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
choices: Optional[_FieldChoices] = ...,
|
choices: Optional[_FieldChoices] = ...,
|
||||||
help_text: str = ...,
|
help_text: str = ...,
|
||||||
db_column: Optional[str] = ...,
|
db_column: Optional[str] = ...,
|
||||||
@@ -117,6 +128,9 @@ class SlugField(CharField):
|
|||||||
editable: bool = ...,
|
editable: bool = ...,
|
||||||
auto_created: bool = ...,
|
auto_created: bool = ...,
|
||||||
serialize: bool = ...,
|
serialize: bool = ...,
|
||||||
|
unique_for_date: Optional[str] = ...,
|
||||||
|
unique_for_month: Optional[str] = ...,
|
||||||
|
unique_for_year: Optional[str] = ...,
|
||||||
choices: Optional[_FieldChoices] = ...,
|
choices: Optional[_FieldChoices] = ...,
|
||||||
help_text: str = ...,
|
help_text: str = ...,
|
||||||
db_column: Optional[str] = ...,
|
db_column: Optional[str] = ...,
|
||||||
@@ -196,7 +210,30 @@ class DateField(DateTimeCheckMixin, Field):
|
|||||||
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
): ...
|
): ...
|
||||||
|
|
||||||
class TimeField(DateTimeCheckMixin, Field): ...
|
class TimeField(DateTimeCheckMixin, Field):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
verbose_name: Optional[str] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
auto_now: bool = ...,
|
||||||
|
auto_now_add: bool = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
class DateTimeField(DateField): ...
|
class DateTimeField(DateField): ...
|
||||||
class UUIDField(Field): ...
|
class UUIDField(Field): ...
|
||||||
|
|
||||||
@@ -211,6 +248,7 @@ class FilePathField(Field):
|
|||||||
allow_files: bool = ...,
|
allow_files: bool = ...,
|
||||||
allow_folders: bool = ...,
|
allow_folders: bool = ...,
|
||||||
primary_key: bool = ...,
|
primary_key: bool = ...,
|
||||||
|
max_length: int = ...,
|
||||||
unique: bool = ...,
|
unique: bool = ...,
|
||||||
blank: bool = ...,
|
blank: bool = ...,
|
||||||
null: bool = ...,
|
null: bool = ...,
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ class FileField(Field):
|
|||||||
def get_internal_type(self) -> str: ...
|
def get_internal_type(self) -> str: ...
|
||||||
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
|
def get_prep_value(self, value: Union[FieldFile, str]) -> str: ...
|
||||||
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
|
def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ...
|
||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
|
||||||
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
|
def generate_filename(self, instance: Optional[Model], filename: str) -> str: ...
|
||||||
def save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ...
|
def save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ...
|
||||||
def formfield(self, **kwargs: Any) -> form_fields.FileField: ...
|
def formfield(self, **kwargs: Any) -> form_fields.FileField: ...
|
||||||
@@ -75,6 +74,5 @@ class ImageField(FileField):
|
|||||||
) -> None: ...
|
) -> None: ...
|
||||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||||
def deconstruct(self) -> Any: ...
|
def deconstruct(self) -> Any: ...
|
||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs: Any) -> None: ...
|
|
||||||
def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ...
|
def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||||
def formfield(self, **kwargs: Any) -> form_fields.ImageField: ...
|
def formfield(self, **kwargs: Any) -> form_fields.ImageField: ...
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
from typing import Type, Union, TypeVar, Any, Generic, List, Optional, Dict, Callable, Tuple, Sequence, TYPE_CHECKING
|
from typing import (
|
||||||
|
Type,
|
||||||
|
Union,
|
||||||
|
TypeVar,
|
||||||
|
Any,
|
||||||
|
Generic,
|
||||||
|
List,
|
||||||
|
Optional,
|
||||||
|
Dict,
|
||||||
|
Callable,
|
||||||
|
Tuple,
|
||||||
|
Sequence,
|
||||||
|
TYPE_CHECKING,
|
||||||
|
Iterable,
|
||||||
|
)
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Field, Model, QuerySet
|
from django.db.models import Field, Model, QuerySet
|
||||||
from django.db.models.fields.mixins import FieldCacheMixin
|
from django.db.models.fields.mixins import FieldCacheMixin
|
||||||
|
from django.db.models.fields.related_descriptors import (
|
||||||
|
ReverseManyToOneDescriptor as ReverseManyToOneDescriptor,
|
||||||
|
ReverseOneToOneDescriptor as ReverseOneToOneDescriptor,
|
||||||
|
ForwardManyToOneDescriptor as ForwardManyToOneDescriptor,
|
||||||
|
ForwardOneToOneDescriptor as ForwardOneToOneDescriptor,
|
||||||
|
)
|
||||||
|
from django.db.models.fields.reverse_related import ForeignObjectRel as ForeignObjectRel
|
||||||
from django.db.models.query_utils import PathInfo, Q
|
from django.db.models.query_utils import PathInfo, Q
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -11,6 +32,13 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
_T = TypeVar("_T", bound=models.Model)
|
_T = TypeVar("_T", bound=models.Model)
|
||||||
|
|
||||||
|
_Choice = Tuple[Any, str]
|
||||||
|
_ChoiceNamedGroup = Tuple[str, Iterable[_Choice]]
|
||||||
|
_FieldChoices = Iterable[Union[_Choice, _ChoiceNamedGroup]]
|
||||||
|
|
||||||
|
_ValidatorCallable = Callable[..., None]
|
||||||
|
_ErrorMessagesToOverride = Dict[str, Any]
|
||||||
|
|
||||||
class RelatedField(FieldCacheMixin, Field):
|
class RelatedField(FieldCacheMixin, Field):
|
||||||
one_to_many: bool = ...
|
one_to_many: bool = ...
|
||||||
one_to_one: bool = ...
|
one_to_one: bool = ...
|
||||||
@@ -29,12 +57,41 @@ class RelatedField(FieldCacheMixin, Field):
|
|||||||
def set_attributes_from_rel(self) -> None: ...
|
def set_attributes_from_rel(self) -> None: ...
|
||||||
def do_related_class(self, other: Type[Model], cls: Type[Model]) -> None: ...
|
def do_related_class(self, other: Type[Model], cls: Type[Model]) -> None: ...
|
||||||
def get_limit_choices_to(self) -> Dict[str, int]: ...
|
def get_limit_choices_to(self) -> Dict[str, int]: ...
|
||||||
def formfield(self, **kwargs: Any) -> Field: ...
|
|
||||||
def related_query_name(self) -> str: ...
|
def related_query_name(self) -> str: ...
|
||||||
@property
|
@property
|
||||||
def target_field(self) -> Field: ...
|
def target_field(self) -> Field: ...
|
||||||
|
|
||||||
class ForeignObject(RelatedField): ...
|
class ForeignObject(RelatedField):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
to: Union[Type[Model], str],
|
||||||
|
on_delete: Callable[..., None],
|
||||||
|
from_fields: Sequence[str],
|
||||||
|
to_fields: Sequence[str],
|
||||||
|
rel: None = ...,
|
||||||
|
related_name: Optional[str] = ...,
|
||||||
|
related_query_name: None = ...,
|
||||||
|
limit_choices_to: None = ...,
|
||||||
|
parent_link: bool = ...,
|
||||||
|
swappable: bool = ...,
|
||||||
|
verbose_name: Optional[str] = ...,
|
||||||
|
name: Optional[str] = ...,
|
||||||
|
primary_key: bool = ...,
|
||||||
|
unique: bool = ...,
|
||||||
|
blank: bool = ...,
|
||||||
|
null: bool = ...,
|
||||||
|
db_index: bool = ...,
|
||||||
|
default: Any = ...,
|
||||||
|
editable: bool = ...,
|
||||||
|
auto_created: bool = ...,
|
||||||
|
serialize: bool = ...,
|
||||||
|
choices: Optional[_FieldChoices] = ...,
|
||||||
|
help_text: str = ...,
|
||||||
|
db_column: Optional[str] = ...,
|
||||||
|
db_tablespace: Optional[str] = ...,
|
||||||
|
validators: Iterable[_ValidatorCallable] = ...,
|
||||||
|
error_messages: Optional[_ErrorMessagesToOverride] = ...,
|
||||||
|
): ...
|
||||||
|
|
||||||
class ForeignKey(RelatedField, Generic[_T]):
|
class ForeignKey(RelatedField, Generic[_T]):
|
||||||
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
|
def __init__(self, to: Union[Type[_T], str], on_delete: Any, related_name: str = ..., **kwargs): ...
|
||||||
@@ -80,7 +137,6 @@ class ManyToManyField(RelatedField, Generic[_T]):
|
|||||||
m2m_reverse_field_name: Any = ...
|
m2m_reverse_field_name: Any = ...
|
||||||
m2m_target_field_name: Any = ...
|
m2m_target_field_name: Any = ...
|
||||||
m2m_reverse_target_field_name: Any = ...
|
m2m_reverse_target_field_name: Any = ...
|
||||||
def contribute_to_class(self, cls: Type[Model], name: str, **kwargs) -> None: ...
|
|
||||||
def contribute_to_related_class(self, cls: Type[Model], related: RelatedField) -> None: ...
|
def contribute_to_related_class(self, cls: Type[Model], related: RelatedField) -> None: ...
|
||||||
def set_attributes_from_rel(self) -> None: ...
|
def set_attributes_from_rel(self) -> None: ...
|
||||||
def value_from_object(self, obj: Model) -> List[Model]: ...
|
def value_from_object(self, obj: Model) -> List[Model]: ...
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
from typing import TypeVar, Optional, Any, Type, Dict, Union, overload, List, Iterator, Tuple, Iterable, Sized, Sequence
|
from typing import (
|
||||||
|
Any,
|
||||||
|
Dict,
|
||||||
|
Iterable,
|
||||||
|
Iterator,
|
||||||
|
List,
|
||||||
|
MutableMapping,
|
||||||
|
Optional,
|
||||||
|
Sequence,
|
||||||
|
Sized,
|
||||||
|
Tuple,
|
||||||
|
Type,
|
||||||
|
TypeVar,
|
||||||
|
Union,
|
||||||
|
overload,
|
||||||
|
)
|
||||||
|
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
|
from django.db.models.expressions import Combinable
|
||||||
|
from django.db.models.sql.query import Query, RawQuery
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Manager
|
from django.db.models import Manager
|
||||||
from django.db.models.sql.query import Query, RawQuery
|
|
||||||
|
|
||||||
from django.db.models.expressions import F, Combinable
|
|
||||||
|
|
||||||
_T = TypeVar("_T", bound=models.Model, covariant=True)
|
_T = TypeVar("_T", bound=models.Model, covariant=True)
|
||||||
|
|
||||||
@@ -38,8 +52,10 @@ class QuerySet(Iterable[_T], Sized):
|
|||||||
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||||
def create(self, **kwargs: Any) -> _T: ...
|
def create(self, **kwargs: Any) -> _T: ...
|
||||||
def bulk_create(self, objs: Iterable[Model], batch_size: Optional[int] = ...) -> List[_T]: ...
|
def bulk_create(self, objs: Iterable[Model], batch_size: Optional[int] = ...) -> List[_T]: ...
|
||||||
def get_or_create(self, defaults: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
def get_or_create(self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
||||||
def update_or_create(self, defaults: Optional[Dict[str, Any]] = ..., **kwargs: Any) -> Tuple[_T, bool]: ...
|
def update_or_create(
|
||||||
|
self, defaults: Optional[MutableMapping[str, Any]] = ..., **kwargs: Any
|
||||||
|
) -> Tuple[_T, bool]: ...
|
||||||
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
def earliest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
def latest(self, *fields: Any, field_name: Optional[Any] = ...) -> _T: ...
|
||||||
def first(self) -> Optional[_T]: ...
|
def first(self) -> Optional[_T]: ...
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
from .query import Query as Query, RawQuery as RawQuery
|
from .query import Query as Query, RawQuery as RawQuery
|
||||||
|
|
||||||
|
from .subqueries import (
|
||||||
|
InsertQuery as InsertQuery,
|
||||||
|
AggregateQuery as AggregateQuery,
|
||||||
|
DeleteQuery as DeleteQuery,
|
||||||
|
UpdateQuery as UpdateQuery,
|
||||||
|
)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ from decimal import Decimal
|
|||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
from django.db.models.sql.datastructures import BaseTable
|
||||||
|
|
||||||
from django.db.models import Model, Field, Q, FilteredRelation, Expression, QuerySet
|
from django.db.models import Model, Field, Q, FilteredRelation, Expression, QuerySet
|
||||||
from django.db.models.query_utils import PathInfo
|
from django.db.models.query_utils import PathInfo
|
||||||
from django.db.models.sql.compiler import SQLCompiler
|
from django.db.models.sql.compiler import SQLCompiler
|
||||||
@@ -28,7 +30,7 @@ class RawQuery:
|
|||||||
|
|
||||||
class Query:
|
class Query:
|
||||||
base_table: str
|
base_table: str
|
||||||
related_ids: None
|
related_ids: Optional[List[int]]
|
||||||
related_updates: Dict[Type[Model], List[Tuple[Field, None, Union[int, str]]]]
|
related_updates: Dict[Type[Model], List[Tuple[Field, None, Union[int, str]]]]
|
||||||
values: List[Any]
|
values: List[Any]
|
||||||
alias_prefix: str = ...
|
alias_prefix: str = ...
|
||||||
@@ -36,7 +38,7 @@ class Query:
|
|||||||
compiler: str = ...
|
compiler: str = ...
|
||||||
model: Optional[Type[Model]] = ...
|
model: Optional[Type[Model]] = ...
|
||||||
alias_refcount: Dict[str, int] = ...
|
alias_refcount: Dict[str, int] = ...
|
||||||
alias_map: OrderedDict = ...
|
alias_map: Dict[str, BaseTable] = ...
|
||||||
external_aliases: Set[str] = ...
|
external_aliases: Set[str] = ...
|
||||||
table_map: Dict[str, List[str]] = ...
|
table_map: Dict[str, List[str]] = ...
|
||||||
default_cols: bool = ...
|
default_cols: bool = ...
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
import collections
|
||||||
|
import uuid
|
||||||
|
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
|
||||||
|
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.expressions import Case
|
from django.db.models.expressions import Case
|
||||||
from django.db.models.fields import DateTimeCheckMixin, Field
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
|
from django.db.models.sql.datastructures import BaseTable
|
||||||
from django.db.models.sql.query import Query
|
from django.db.models.sql.query import Query
|
||||||
from django.db.models.sql.where import WhereNode
|
from django.db.models.sql.where import WhereNode
|
||||||
from django.utils.datastructures import ImmutableList
|
|
||||||
|
from django.db.models.fields import Field
|
||||||
|
|
||||||
class DeleteQuery(Query):
|
class DeleteQuery(Query):
|
||||||
alias_refcount: Dict[str, int]
|
alias_refcount: Dict[str, int]
|
||||||
@@ -46,16 +49,14 @@ class DeleteQuery(Query):
|
|||||||
table_map: Dict[str, List[str]]
|
table_map: Dict[str, List[str]]
|
||||||
used_aliases: Set[str]
|
used_aliases: Set[str]
|
||||||
values_select: Tuple
|
values_select: Tuple
|
||||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
where_class: Type[WhereNode]
|
||||||
compiler: str = ...
|
compiler: str = ...
|
||||||
alias_map: Union[Dict[str, django.db.models.sql.datastructures.BaseTable], collections.OrderedDict] = ...
|
where: WhereNode = ...
|
||||||
where: django.db.models.sql.where.WhereNode = ...
|
|
||||||
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
|
def do_query(self, table: str, where: WhereNode, using: str) -> int: ...
|
||||||
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
|
def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ...
|
||||||
def delete_qs(self, query: QuerySet, using: str) -> int: ...
|
def delete_qs(self, query: QuerySet, using: str) -> int: ...
|
||||||
|
|
||||||
class UpdateQuery(Query):
|
class UpdateQuery(Query):
|
||||||
alias_map: collections.OrderedDict
|
|
||||||
alias_refcount: Dict[str, int]
|
alias_refcount: Dict[str, int]
|
||||||
annotation_select_mask: Optional[Set[Any]]
|
annotation_select_mask: Optional[Set[Any]]
|
||||||
base_table: str
|
base_table: str
|
||||||
@@ -81,8 +82,6 @@ class UpdateQuery(Query):
|
|||||||
max_depth: int
|
max_depth: int
|
||||||
model: Type[Model]
|
model: Type[Model]
|
||||||
order_by: Tuple
|
order_by: Tuple
|
||||||
related_ids: Optional[List[int]]
|
|
||||||
related_updates: Dict[Type[Model], List[Tuple[Field, None, Union[int, str]]]]
|
|
||||||
select: Tuple
|
select: Tuple
|
||||||
select_for_update: bool
|
select_for_update: bool
|
||||||
select_for_update_nowait: bool
|
select_for_update_nowait: bool
|
||||||
@@ -94,13 +93,13 @@ class UpdateQuery(Query):
|
|||||||
subquery: bool
|
subquery: bool
|
||||||
table_map: Dict[str, List[str]]
|
table_map: Dict[str, List[str]]
|
||||||
used_aliases: Set[str]
|
used_aliases: Set[str]
|
||||||
values: List[Tuple[Field, Optional[Type[Model]], Union[django.db.models.expressions.Case, uuid.UUID]]]
|
values: List[Tuple[Field, Optional[Type[Model]], Union[Case, uuid.UUID]]]
|
||||||
values_select: Tuple
|
values_select: Tuple
|
||||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
where_class: Type[WhereNode]
|
||||||
compiler: str = ...
|
compiler: str = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
def clone(self) -> UpdateQuery: ...
|
def clone(self) -> UpdateQuery: ...
|
||||||
where: django.db.models.sql.where.WhereNode = ...
|
where: WhereNode = ...
|
||||||
def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ...
|
def update_batch(self, pk_list: List[int], values: Dict[str, Optional[int]], using: str) -> None: ...
|
||||||
def add_update_values(self, values: Dict[str, Any]) -> None: ...
|
def add_update_values(self, values: Dict[str, Any]) -> None: ...
|
||||||
def add_update_fields(self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]]) -> None: ...
|
def add_update_fields(self, values_seq: List[Tuple[Field, Optional[Type[Model]], Case]]) -> None: ...
|
||||||
@@ -108,7 +107,6 @@ class UpdateQuery(Query):
|
|||||||
def get_related_updates(self) -> List[UpdateQuery]: ...
|
def get_related_updates(self) -> List[UpdateQuery]: ...
|
||||||
|
|
||||||
class InsertQuery(Query):
|
class InsertQuery(Query):
|
||||||
alias_map: collections.OrderedDict
|
|
||||||
alias_refcount: Dict[str, int]
|
alias_refcount: Dict[str, int]
|
||||||
annotation_select_mask: None
|
annotation_select_mask: None
|
||||||
combinator: None
|
combinator: None
|
||||||
@@ -144,21 +142,16 @@ class InsertQuery(Query):
|
|||||||
table_map: Dict[str, List[str]]
|
table_map: Dict[str, List[str]]
|
||||||
used_aliases: Set[Any]
|
used_aliases: Set[Any]
|
||||||
values_select: Tuple
|
values_select: Tuple
|
||||||
where: django.db.models.sql.where.WhereNode
|
where: WhereNode
|
||||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
where_class: Type[WhereNode]
|
||||||
compiler: str = ...
|
compiler: str = ...
|
||||||
fields: Union[
|
fields: Iterable[Field] = ...
|
||||||
List[django.db.models.fields.DateTimeCheckMixin], List[Field], django.utils.datastructures.ImmutableList
|
|
||||||
] = ...
|
|
||||||
objs: List[Model] = ...
|
objs: List[Model] = ...
|
||||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||||
raw: bool = ...
|
raw: bool = ...
|
||||||
def insert_values(
|
def insert_values(self, fields: Iterable[Field], objs: List[Model], raw: bool = ...) -> None: ...
|
||||||
self, fields: Union[List[DateTimeCheckMixin], List[Field], ImmutableList], objs: List[Model], raw: bool = ...
|
|
||||||
) -> None: ...
|
|
||||||
|
|
||||||
class AggregateQuery(Query):
|
class AggregateQuery(Query):
|
||||||
alias_map: collections.OrderedDict
|
|
||||||
alias_refcount: Dict[Any, Any]
|
alias_refcount: Dict[Any, Any]
|
||||||
annotation_select_mask: None
|
annotation_select_mask: None
|
||||||
combinator: None
|
combinator: None
|
||||||
@@ -191,11 +184,10 @@ class AggregateQuery(Query):
|
|||||||
select_related: bool
|
select_related: bool
|
||||||
standard_ordering: bool
|
standard_ordering: bool
|
||||||
sub_params: Tuple
|
sub_params: Tuple
|
||||||
subquery: Union[bool, str]
|
|
||||||
table_map: Dict[Any, Any]
|
table_map: Dict[Any, Any]
|
||||||
used_aliases: Set[Any]
|
used_aliases: Set[Any]
|
||||||
values_select: Tuple
|
values_select: Tuple
|
||||||
where: django.db.models.sql.where.WhereNode
|
where: WhereNode
|
||||||
where_class: Type[django.db.models.sql.where.WhereNode]
|
where_class: Type[WhereNode]
|
||||||
compiler: str = ...
|
compiler: str = ...
|
||||||
def add_subquery(self, query: Query, using: str) -> None: ...
|
def add_subquery(self, query: Query, using: str) -> None: ...
|
||||||
|
|||||||
@@ -15,6 +15,25 @@ from .widgets import (
|
|||||||
Select as Select,
|
Select as Select,
|
||||||
CheckboxInput as CheckboxInput,
|
CheckboxInput as CheckboxInput,
|
||||||
CheckboxSelectMultiple as CheckboxSelectMultiple,
|
CheckboxSelectMultiple as CheckboxSelectMultiple,
|
||||||
|
Media as Media,
|
||||||
|
MultiWidget as MultiWidget,
|
||||||
|
TextInput as TextInput,
|
||||||
|
Textarea as Textarea,
|
||||||
|
Input as Input,
|
||||||
|
ClearableFileInput as ClearableFileInput,
|
||||||
|
DateInput as DateInput,
|
||||||
|
DateTimeBaseInput as DateTimeBaseInput,
|
||||||
|
DateTimeInput as DateTimeInput,
|
||||||
|
EmailInput as EmailInput,
|
||||||
|
FileInput as FileInput,
|
||||||
|
HiddenInput as HiddenInput,
|
||||||
|
MultipleHiddenInput as MultipleHiddenInput,
|
||||||
|
NullBooleanSelect as NullBooleanSelect,
|
||||||
|
PasswordInput as PasswordInput,
|
||||||
|
RadioSelect as RadioSelect,
|
||||||
|
SelectMultiple as SelectMultiple,
|
||||||
|
TimeInput as TimeInput,
|
||||||
|
URLInput as URLInput,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .fields import (
|
from .fields import (
|
||||||
@@ -26,4 +45,23 @@ from .fields import (
|
|||||||
ImageField as ImageField,
|
ImageField as ImageField,
|
||||||
DateTimeField as DateTimeField,
|
DateTimeField as DateTimeField,
|
||||||
DateField as DateField,
|
DateField as DateField,
|
||||||
|
BooleanField as BooleanField,
|
||||||
|
EmailField as EmailField,
|
||||||
|
FloatField as FloatField,
|
||||||
|
MultiValueField as MultiValueField,
|
||||||
|
MultipleChoiceField as MultipleChoiceField,
|
||||||
|
NullBooleanField as NullBooleanField,
|
||||||
|
SplitDateTimeField as SplitDateTimeField,
|
||||||
|
TimeField as TimeField,
|
||||||
|
IntegerField as IntegerField,
|
||||||
|
FilePathField as FilePathField,
|
||||||
|
DecimalField as DecimalField,
|
||||||
|
UUIDField as UUIDField,
|
||||||
|
URLField as URLField,
|
||||||
|
ComboField as ComboField,
|
||||||
|
GenericIPAddressField as GenericIPAddressField,
|
||||||
|
RegexField as RegexField,
|
||||||
|
SlugField as SlugField,
|
||||||
|
TypedChoiceField as TypedChoiceField,
|
||||||
|
TypedMultipleChoiceField as TypedMultipleChoiceField,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,6 +6,16 @@ from django.forms.utils import ErrorList
|
|||||||
|
|
||||||
from django.forms import Form
|
from django.forms import Form
|
||||||
|
|
||||||
|
TOTAL_FORM_COUNT: str = ...
|
||||||
|
INITIAL_FORM_COUNT: str = ...
|
||||||
|
MIN_NUM_FORM_COUNT: str = ...
|
||||||
|
MAX_NUM_FORM_COUNT: str = ...
|
||||||
|
ORDERING_FIELD_NAME: str = ...
|
||||||
|
DELETION_FIELD_NAME: str = ...
|
||||||
|
|
||||||
|
DEFAULT_MIN_NUM: int = ...
|
||||||
|
DEFAULT_MAX_NUM: int = ...
|
||||||
|
|
||||||
class ManagementForm(Form):
|
class ManagementForm(Form):
|
||||||
auto_id: Union[bool, str]
|
auto_id: Union[bool, str]
|
||||||
cleaned_data: Dict[str, Optional[int]]
|
cleaned_data: Dict[str, Optional[int]]
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union
|
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, Sequence
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
from django.db.models import ForeignKey
|
||||||
from django.db.models.base import Model
|
from django.db.models.base import Model
|
||||||
from django.db.models.manager import Manager
|
from django.db.models.manager import Manager
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
@@ -136,23 +137,23 @@ class BaseModelFormSet(BaseFormSet):
|
|||||||
def modelformset_factory(
|
def modelformset_factory(
|
||||||
model: Type[Model],
|
model: Type[Model],
|
||||||
form: Type[ModelForm] = ...,
|
form: Type[ModelForm] = ...,
|
||||||
formfield_callback: None = ...,
|
formfield_callback: Optional[Callable] = ...,
|
||||||
formset: Type[BaseModelFormSet] = ...,
|
formset: Type[BaseModelFormSet] = ...,
|
||||||
extra: int = ...,
|
extra: int = ...,
|
||||||
can_delete: bool = ...,
|
can_delete: bool = ...,
|
||||||
can_order: bool = ...,
|
can_order: bool = ...,
|
||||||
max_num: None = ...,
|
min_num: Optional[int] = ...,
|
||||||
fields: None = ...,
|
max_num: Optional[int] = ...,
|
||||||
exclude: None = ...,
|
fields: Optional[Union[str, Sequence[str]]] = ...,
|
||||||
widgets: None = ...,
|
exclude: Optional[Sequence[str]] = ...,
|
||||||
|
widgets: Optional[Dict[str, Any]] = ...,
|
||||||
validate_max: bool = ...,
|
validate_max: bool = ...,
|
||||||
localized_fields: None = ...,
|
localized_fields: None = ...,
|
||||||
labels: None = ...,
|
labels: Optional[Dict[str, str]] = ...,
|
||||||
help_texts: None = ...,
|
help_texts: Optional[Dict[str, str]] = ...,
|
||||||
error_messages: None = ...,
|
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
||||||
min_num: None = ...,
|
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: None = ...,
|
field_classes: Optional[Dict[str, Any]] = ...,
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
|
||||||
class BaseInlineFormSet(BaseModelFormSet):
|
class BaseInlineFormSet(BaseModelFormSet):
|
||||||
@@ -182,22 +183,22 @@ def inlineformset_factory(
|
|||||||
form: Type[ModelForm] = ...,
|
form: Type[ModelForm] = ...,
|
||||||
formset: Type[BaseInlineFormSet] = ...,
|
formset: Type[BaseInlineFormSet] = ...,
|
||||||
fk_name: Optional[str] = ...,
|
fk_name: Optional[str] = ...,
|
||||||
fields: Optional[str] = ...,
|
fields: Optional[Union[str, Sequence[str]]] = ...,
|
||||||
exclude: None = ...,
|
exclude: Optional[Sequence[str]] = ...,
|
||||||
extra: int = ...,
|
extra: int = ...,
|
||||||
can_order: bool = ...,
|
can_order: bool = ...,
|
||||||
can_delete: bool = ...,
|
can_delete: bool = ...,
|
||||||
max_num: None = ...,
|
max_num: Optional[int] = ...,
|
||||||
formfield_callback: None = ...,
|
formfield_callback: Optional[Callable] = ...,
|
||||||
widgets: None = ...,
|
widgets: Optional[Dict[str, Any]] = ...,
|
||||||
validate_max: bool = ...,
|
validate_max: bool = ...,
|
||||||
localized_fields: None = ...,
|
localized_fields: None = ...,
|
||||||
labels: None = ...,
|
labels: Optional[Dict[str, str]] = ...,
|
||||||
help_texts: None = ...,
|
help_texts: Optional[Dict[str, str]] = ...,
|
||||||
error_messages: None = ...,
|
error_messages: Optional[Dict[str, Dict[str, str]]] = ...,
|
||||||
min_num: None = ...,
|
min_num: Optional[int] = ...,
|
||||||
validate_min: bool = ...,
|
validate_min: bool = ...,
|
||||||
field_classes: None = ...,
|
field_classes: Optional[Dict[str, Any]] = ...,
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
|
||||||
class InlineForeignKeyField(Field):
|
class InlineForeignKeyField(Field):
|
||||||
@@ -266,3 +267,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
|
|||||||
hidden_widget: Any = ...
|
hidden_widget: Any = ...
|
||||||
default_error_messages: Any = ...
|
default_error_messages: Any = ...
|
||||||
def __init__(self, queryset: QuerySet, **kwargs: Any) -> None: ...
|
def __init__(self, queryset: QuerySet, **kwargs: Any) -> None: ...
|
||||||
|
|
||||||
|
def _get_foreign_key(
|
||||||
|
parent_model: Type[Model], model: Type[Model], fk_name: Optional[str] = ..., can_fail: bool = ...
|
||||||
|
) -> ForeignKey: ...
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class HttpRequest(BytesIO):
|
|||||||
|
|
||||||
class QueryDict(MultiValueDict[str, str]):
|
class QueryDict(MultiValueDict[str, str]):
|
||||||
encoding = str # type: Any
|
encoding = str # type: Any
|
||||||
|
_mutable: bool = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
|
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class HttpResponseBase(six.Iterator):
|
|||||||
def has_header(self, header: str) -> bool: ...
|
def has_header(self, header: str) -> bool: ...
|
||||||
def items(self) -> Iterable[Tuple[str, str]]: ...
|
def items(self) -> Iterable[Tuple[str, str]]: ...
|
||||||
@overload
|
@overload
|
||||||
def get(self, header: str, alternate: str = ...) -> str: ...
|
def get(self, header: str, alternate: str) -> str: ...
|
||||||
@overload
|
@overload
|
||||||
def get(self, header: str) -> Optional[str]: ...
|
def get(self, header: str) -> Optional[str]: ...
|
||||||
def set_cookie(
|
def set_cookie(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
from typing import Any, Callable, Dict, List, Optional, Type, Union
|
||||||
|
|
||||||
from django.db.models.base import Model, Manager, QuerySet
|
from django.db.models import Manager, QuerySet
|
||||||
|
from django.db.models.base import Model
|
||||||
from django.http.response import HttpResponse, HttpResponseRedirect
|
from django.http.response import HttpResponse, HttpResponseRedirect
|
||||||
|
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
@@ -21,6 +22,6 @@ def render(
|
|||||||
using: Optional[str] = ...,
|
using: Optional[str] = ...,
|
||||||
) -> HttpResponse: ...
|
) -> HttpResponse: ...
|
||||||
def redirect(to: Union[Callable, str], *args: Any, permanent: bool = ..., **kwargs: Any) -> HttpResponseRedirect: ...
|
def redirect(to: Union[Callable, str], *args: Any, permanent: bool = ..., **kwargs: Any) -> HttpResponseRedirect: ...
|
||||||
def get_object_or_404(klass: Union[Type[Model], Type[Manager], QuerySet], *args: Any, **kwargs: Any) -> Model: ...
|
def get_object_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> Model: ...
|
||||||
def get_list_or_404(klass: List[Type[Model]], *args: Any, **kwargs: Any) -> List[Model]: ...
|
def get_list_or_404(klass: Union[Type[Model], Manager, QuerySet], *args: Any, **kwargs: Any) -> List[Model]: ...
|
||||||
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
def resolve_url(to: Union[Callable, Model, str], *args: Any, **kwargs: Any) -> str: ...
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ IGNORED_ERROR_PATTERNS = [
|
|||||||
'expression has type "property"',
|
'expression has type "property"',
|
||||||
'"object" has no attribute "__iter__"',
|
'"object" has no attribute "__iter__"',
|
||||||
'Too few arguments for "dates" of "QuerySet"',
|
'Too few arguments for "dates" of "QuerySet"',
|
||||||
|
'has no attribute "vendor"',
|
||||||
|
'Argument 1 to "get_list_or_404" has incompatible type "List',
|
||||||
|
'error: "AdminRadioSelect" has no attribute "can_add_related"',
|
||||||
|
re.compile('Cannot determine type of \'(objects|stuff|specimens)\''),
|
||||||
re.compile(r'"Callable\[\[(Any(, )?)+\], Any\]" has no attribute'),
|
re.compile(r'"Callable\[\[(Any(, )?)+\], Any\]" has no attribute'),
|
||||||
re.compile(r'"HttpResponseBase" has no attribute "[A-Za-z_]+"'),
|
re.compile(r'"HttpResponseBase" has no attribute "[A-Za-z_]+"'),
|
||||||
re.compile(r'Incompatible types in assignment \(expression has type "Tuple\[\]", '
|
re.compile(r'Incompatible types in assignment \(expression has type "Tuple\[\]", '
|
||||||
@@ -52,9 +56,12 @@ IGNORED_ERROR_PATTERNS = [
|
|||||||
re.compile(r'Module has no attribute "[A-Za-z_]+"'),
|
re.compile(r'Module has no attribute "[A-Za-z_]+"'),
|
||||||
re.compile(r'"[A-Za-z\[\]]+" has no attribute "getvalue"'),
|
re.compile(r'"[A-Za-z\[\]]+" has no attribute "getvalue"'),
|
||||||
# TODO: remove when reassignment will be possible (in 0.670? )
|
# TODO: remove when reassignment will be possible (in 0.670? )
|
||||||
re.compile(r'Incompatible types in assignment \(expression has type "(QuerySet|List){1}\[[A-Za-z, ]+\]", '
|
re.compile(r'Incompatible types in assignment \(expression has type "(QuerySet|List)\[[A-Za-z, ]+\]", '
|
||||||
r'variable has type "(QuerySet|List){1}\[[A-Za-z, ]+\]"\)'),
|
r'variable has type "(QuerySet|List)\[[A-Za-z, ]+\]"\)'),
|
||||||
re.compile(r'"(MockRequest|DummyRequest|DummyUser)" has no attribute "[a-zA-Z_]+"'),
|
re.compile(r'"(MockRequest|DummyRequest|DummyUser)" has no attribute "[a-zA-Z_]+"'),
|
||||||
|
# TODO: remove when form <-> model plugin support is added
|
||||||
|
re.compile(r'"Model" has no attribute "[A-Za-z_]+"'),
|
||||||
|
re.compile(r'Argument 1 to "get_object_or_404" has incompatible type "(str|Type\[CustomClass\])"'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Test folders to typecheck
|
# Test folders to typecheck
|
||||||
@@ -116,7 +123,81 @@ TESTS_DIRS = [
|
|||||||
'empty',
|
'empty',
|
||||||
# TODO: 'expressions',
|
# TODO: 'expressions',
|
||||||
'expressions_case',
|
'expressions_case',
|
||||||
# TODO: 'expressions_window'
|
# TODO: 'expressions_window',
|
||||||
|
# TODO: 'extra_regress',
|
||||||
|
# TODO: 'field_deconstruction',
|
||||||
|
'field_defaults',
|
||||||
|
'field_subclassing',
|
||||||
|
# TODO: 'file_storage',
|
||||||
|
# TODO: 'file_uploads',
|
||||||
|
# TODO: 'files',
|
||||||
|
'filtered_relation',
|
||||||
|
# TODO: 'fixtures',
|
||||||
|
'fixtures_model_package',
|
||||||
|
# TODO: 'fixtures_regress',
|
||||||
|
'flatpages_tests',
|
||||||
|
'force_insert_update',
|
||||||
|
'foreign_object',
|
||||||
|
# TODO: 'forms_tests',
|
||||||
|
'from_db_value',
|
||||||
|
# TODO: 'generic_inline_admin',
|
||||||
|
# TODO: 'generic_relations',
|
||||||
|
'generic_relations_regress',
|
||||||
|
# TODO: 'generic_views',
|
||||||
|
'get_earliest_or_latest',
|
||||||
|
'get_object_or_404',
|
||||||
|
# TODO: 'get_or_create',
|
||||||
|
# TODO: 'gis_tests',
|
||||||
|
'handlers',
|
||||||
|
# TODO: 'httpwrappers',
|
||||||
|
'humanize_tests',
|
||||||
|
# TODO: 'i18n',
|
||||||
|
'import_error_package',
|
||||||
|
'indexes',
|
||||||
|
'inline_formsets',
|
||||||
|
'inspectdb',
|
||||||
|
'introspection',
|
||||||
|
# TODO: 'invalid_models_tests',
|
||||||
|
'known_related_objects',
|
||||||
|
# TODO: 'logging_tests',
|
||||||
|
# TODO: 'lookup',
|
||||||
|
'm2m_and_m2o',
|
||||||
|
'm2m_intermediary',
|
||||||
|
'm2m_multiple',
|
||||||
|
'm2m_recursive',
|
||||||
|
'm2m_regress',
|
||||||
|
'm2m_signals',
|
||||||
|
'm2m_through',
|
||||||
|
'm2m_through_regress',
|
||||||
|
'm2o_recursive',
|
||||||
|
# TODO: 'mail',
|
||||||
|
'managers_regress',
|
||||||
|
'many_to_many',
|
||||||
|
'many_to_one',
|
||||||
|
'many_to_one_null',
|
||||||
|
'max_lengths',
|
||||||
|
# TODO: 'messages_tests',
|
||||||
|
# TODO: 'middleware',
|
||||||
|
# TODO: 'middleware_exceptions',
|
||||||
|
# SKIPPED (all errors are false positives) 'migrate_signals',
|
||||||
|
'migration_test_data_persistence',
|
||||||
|
# TODO: 'migrations',
|
||||||
|
'migrations2',
|
||||||
|
# TODO: 'model_fields',
|
||||||
|
# TODO: 'model_forms',
|
||||||
|
'model_formsets',
|
||||||
|
'model_formsets_regress',
|
||||||
|
'model_indexes',
|
||||||
|
# TODO: 'model_inheritance',
|
||||||
|
'model_inheritance_regress',
|
||||||
|
# SKIPPED (all errors are false positives) 'model_meta',
|
||||||
|
'model_options',
|
||||||
|
'model_package',
|
||||||
|
'model_regress',
|
||||||
|
# TODO: 'modeladmin',
|
||||||
|
# TODO: 'multiple_database',
|
||||||
|
'mutually_referential',
|
||||||
|
'nested_foreign_keys',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user