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,5 +2,4 @@ from typing import Any
|
||||
|
||||
VERSION: Any
|
||||
|
||||
|
||||
def setup(set_prefix: bool = ...) -> None: ...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
from .config import (
|
||||
AppConfig as AppConfig
|
||||
)
|
||||
from .config import AppConfig as AppConfig
|
||||
|
||||
from .registry import (
|
||||
apps as apps
|
||||
)
|
||||
from .registry import apps as apps
|
||||
|
||||
@@ -16,11 +16,7 @@ class AppConfig:
|
||||
def __init__(self, app_name: str, app_module: None) -> None: ...
|
||||
@classmethod
|
||||
def create(cls, entry: str) -> AppConfig: ...
|
||||
def get_model(
|
||||
self, model_name: str, require_ready: bool = ...
|
||||
) -> Type[Model]: ...
|
||||
def get_models(
|
||||
self, include_auto_created: bool = ..., include_swapped: bool = ...
|
||||
) -> Iterator[Type[Model]]: ...
|
||||
def get_model(self, model_name: str, require_ready: bool = ...) -> Type[Model]: ...
|
||||
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Type[Model]]: ...
|
||||
def import_models(self) -> None: ...
|
||||
def ready(self) -> None: ...
|
||||
|
||||
@@ -7,56 +7,33 @@ from django.db.models.base import Model
|
||||
|
||||
from .config import AppConfig
|
||||
|
||||
|
||||
class Apps:
|
||||
all_models: collections.defaultdict = ...
|
||||
app_configs: collections.OrderedDict = ...
|
||||
stored_app_configs: List[Any] = ...
|
||||
apps_ready: bool = ...
|
||||
loading: bool = ...
|
||||
def __init__(
|
||||
self,
|
||||
installed_apps: Optional[
|
||||
Union[List[AppConfigStub], List[str], Tuple]
|
||||
] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
||||
models_ready: bool = ...
|
||||
ready: bool = ...
|
||||
def populate(
|
||||
self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...
|
||||
) -> None: ...
|
||||
def populate(self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...) -> None: ...
|
||||
def check_apps_ready(self) -> None: ...
|
||||
def check_models_ready(self) -> None: ...
|
||||
def get_app_configs(self) -> Iterable[AppConfig]: ...
|
||||
def get_app_config(self, app_label: str) -> AppConfig: ...
|
||||
def get_models(
|
||||
self, include_auto_created: bool = ..., include_swapped: bool = ...
|
||||
) -> List[Type[Model]]: ...
|
||||
def get_model(
|
||||
self,
|
||||
app_label: str,
|
||||
model_name: Optional[str] = ...,
|
||||
require_ready: bool = ...,
|
||||
) -> Type[Model]: ...
|
||||
def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> List[Type[Model]]: ...
|
||||
def get_model(self, app_label: str, model_name: Optional[str] = ..., require_ready: bool = ...) -> Type[Model]: ...
|
||||
def register_model(self, app_label: str, model: Type[Model]) -> None: ...
|
||||
def is_installed(self, app_name: str) -> bool: ...
|
||||
def get_containing_app_config(
|
||||
self, object_name: str
|
||||
) -> Optional[AppConfig]: ...
|
||||
def get_registered_model(
|
||||
self, app_label: str, model_name: str
|
||||
) -> Type[Model]: ...
|
||||
def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ...
|
||||
def get_registered_model(self, app_label: str, model_name: str) -> Type[Model]: ...
|
||||
def get_swappable_settings_name(self, to_string: str) -> Optional[str]: ...
|
||||
def set_available_apps(self, available: List[str]) -> None: ...
|
||||
def unset_available_apps(self) -> None: ...
|
||||
def set_installed_apps(
|
||||
self, installed: Union[List[str], Tuple[str]]
|
||||
) -> None: ...
|
||||
def set_installed_apps(self, installed: Union[List[str], Tuple[str]]) -> None: ...
|
||||
def unset_installed_apps(self) -> None: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def lazy_model_operation(
|
||||
self, function: Callable, *model_keys: Any
|
||||
) -> None: ...
|
||||
def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ...
|
||||
def do_pending_operations(self, model: Type[Model]) -> None: ...
|
||||
|
||||
apps: Apps
|
||||
|
||||
@@ -2,13 +2,11 @@ from typing import Any
|
||||
|
||||
from django.utils.functional import LazyObject
|
||||
|
||||
|
||||
# required for plugin to be able to distinguish this specific instance of LazySettings from others
|
||||
class _DjangoConfLazyObject(LazyObject): ...
|
||||
|
||||
|
||||
class LazySettings(_DjangoConfLazyObject):
|
||||
configured: bool
|
||||
def configure(self, default_settings: Any = ..., **options: Any) -> Any: ...
|
||||
|
||||
settings: LazySettings = ...
|
||||
settings: LazySettings = ...
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
from typing import Any, Callable, Dict, List, Optional, overload, Tuple, Union
|
||||
|
||||
from django.http.response import HttpResponse
|
||||
from django.urls import (
|
||||
RegexURLPattern, RegexURLResolver
|
||||
)
|
||||
from django.urls import RegexURLPattern, RegexURLResolver
|
||||
from django.urls.resolvers import URLConf
|
||||
|
||||
handler400 = ... # type: str
|
||||
@@ -13,11 +11,14 @@ handler403 = ... # type: str
|
||||
handler404 = ... # type: str
|
||||
handler500 = ... # type: str
|
||||
|
||||
def include(arg: Any, namespace: str=None, app_name: str=None) -> Tuple[URLConf, Optional[str], Optional[str]]: ...
|
||||
|
||||
def include(arg: Any, namespace: str = None, app_name: str = None) -> Tuple[URLConf, Optional[str], Optional[str]]: ...
|
||||
@overload
|
||||
def url(regex: str, view: Callable[..., HttpResponse], kwargs: Dict[str, Any]=None, name: str=None) -> RegexURLPattern: ... # type: ignore # issue 253 of typing
|
||||
def url(
|
||||
regex: str, view: Callable[..., HttpResponse], kwargs: Dict[str, Any] = None, name: str = None
|
||||
) -> RegexURLPattern: ... # type: ignore # issue 253 of typing
|
||||
@overload
|
||||
def url(regex: str, view: Tuple[URLConf, Optional[str], Optional[str]], kwargs: Dict[str, Any]=None, name: str=None) -> RegexURLResolver: ...
|
||||
def url(
|
||||
regex: str, view: Tuple[URLConf, Optional[str], Optional[str]], kwargs: Dict[str, Any] = None, name: str = None
|
||||
) -> RegexURLResolver: ...
|
||||
@overload
|
||||
def url(regex: str, view: List[Union[URLConf, str]], kwargs: Dict[str, Any]=None, name: str=None) -> RegexURLResolver: ...
|
||||
def url(regex: str, view: List[Union[URLConf, str]], kwargs: Dict[str, Any] = None, name: str = None) -> RegexURLResolver: ...
|
||||
|
||||
@@ -4,8 +4,7 @@ from django.db.models.fields import Field
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
_T = TypeVar('_T', bound=Field)
|
||||
|
||||
_T = TypeVar("_T", bound=Field)
|
||||
|
||||
class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
empty_strings_allowed: bool = ...
|
||||
@@ -14,10 +13,7 @@ class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
size: Any = ...
|
||||
default_validators: Any = ...
|
||||
from_db_value: Any = ...
|
||||
|
||||
def __init__(
|
||||
self, base_field: _T, size: None = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, base_field: _T, size: None = ..., **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def model(self): ...
|
||||
@model.setter
|
||||
@@ -27,18 +23,12 @@ class ArrayField(CheckFieldDefaultMixin, Field, Generic[_T]):
|
||||
@property
|
||||
def description(self): ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def get_db_prep_value(
|
||||
self, value: Any, connection: Any, prepared: bool = ...
|
||||
): ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]
|
||||
]: ...
|
||||
def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...): ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Optional[Union[bool, Field]]]]: ...
|
||||
def to_python(self, value: Any): ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
def run_validators(self, value: Any) -> None: ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
def __get__(self, instance, owner) -> List[_T]: ...
|
||||
def __get__(self, instance, owner) -> List[_T]: ...
|
||||
|
||||
@@ -5,15 +5,9 @@ from django.db.models import Field
|
||||
|
||||
from .mixins import CheckFieldDefaultMixin
|
||||
|
||||
|
||||
class JsonAdapter(object):
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
adapted: Any,
|
||||
dumps: Optional[Any] = ...,
|
||||
encoder: Optional[Any] = ...,
|
||||
) -> None: ...
|
||||
def __init__(self, adapted: Any, dumps: Optional[Any] = ..., encoder: Optional[Any] = ...) -> None: ...
|
||||
def dumps(self, obj: Any): ...
|
||||
|
||||
class JSONField(CheckFieldDefaultMixin, Field):
|
||||
@@ -22,20 +16,12 @@ class JSONField(CheckFieldDefaultMixin, Field):
|
||||
default_error_messages: Any = ...
|
||||
encoder: Any = ...
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: None = ...,
|
||||
name: None = ...,
|
||||
encoder: Optional[Type[JSONEncoder]] = ...,
|
||||
**kwargs: Any
|
||||
self, verbose_name: None = ..., name: None = ..., encoder: Optional[Type[JSONEncoder]] = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Tuple[
|
||||
None, str, List[Any], Dict[str, Union[Type[JSONEncoder], bool]]
|
||||
]: ...
|
||||
def deconstruct(self) -> Tuple[None, str, List[Any], Dict[str, Union[Type[JSONEncoder], bool]]]: ...
|
||||
def get_transform(self, name: Any): ...
|
||||
def get_prep_value(self, value: Any): ...
|
||||
def validate(self, value: Any, model_instance: Any) -> None: ...
|
||||
def value_to_string(self, obj: Any): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
def formfield(self, **kwargs: Any): ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Any, List, Optional
|
||||
|
||||
|
||||
class CheckFieldDefaultMixin:
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Any
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class RangeField(models.Field):
|
||||
empty_strings_allowed: bool = ...
|
||||
base_field: Any = ...
|
||||
@@ -45,4 +44,4 @@ class DateRangeField(RangeField):
|
||||
base_field: Any = ...
|
||||
range_type: Any = ...
|
||||
form_field: Any = ...
|
||||
def db_type(self, connection: Any): ...
|
||||
def db_type(self, connection: Any): ...
|
||||
|
||||
@@ -4,22 +4,15 @@ from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.state import ProjectState
|
||||
|
||||
|
||||
class CreateExtension(Operation):
|
||||
reversible: bool = ...
|
||||
name: Any = ...
|
||||
def __init__(self, name: str) -> None: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState,
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any
|
||||
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
|
||||
def describe(self): ...
|
||||
|
||||
class BtreeGinExtension(CreateExtension):
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from django.core.files.base import File
|
||||
|
||||
__all__ = ['File']
|
||||
__all__ = ["File"]
|
||||
|
||||
@@ -8,20 +8,19 @@ class File(FileProxyMixin, Sized, Iterable[bytes]):
|
||||
file = ... # type: Any
|
||||
name: Optional[str] = ... # type: ignore
|
||||
mode = ... # type: str
|
||||
size = ... # type: int
|
||||
|
||||
def __init__(self, file: Any, name: str=None) -> None: ...
|
||||
size = ... # type: int
|
||||
def __init__(self, file: Any, name: str = None) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def chunks(self, chunk_size: int=None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int=None) -> bool: ...
|
||||
def __enter__(self) -> 'File': ...
|
||||
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
|
||||
def __enter__(self) -> "File": ...
|
||||
def __exit__(self, t: type = None, value: BaseException = None, traceback: Any = None) -> bool: ...
|
||||
def open(self, mode: str=None) -> None: ...
|
||||
def open(self, mode: str = None) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class ContentFile(File):
|
||||
def __init__(self, content: Union[str, bytes], name: Optional[str]=None) -> None: ...
|
||||
def __init__(self, content: Union[str, bytes], name: Optional[str] = None) -> None: ...
|
||||
|
||||
def endswith_cr(line: Union[str, bytes]) -> bool: ...
|
||||
def endswith_lf(line: Union[str, bytes]) -> bool: ...
|
||||
|
||||
@@ -8,19 +8,38 @@ class UploadedFile(File):
|
||||
content_type = ... # type: Optional[str]
|
||||
charset = ... # type: Optional[str]
|
||||
content_type_extra = ... # type: Optional[Dict[str, str]]
|
||||
def __init__(self, file: IO, name: str=None, content_type: str=None, size: int=None, charset: str=None, content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
file: IO,
|
||||
name: str = None,
|
||||
content_type: str = None,
|
||||
size: int = None,
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
) -> None: ...
|
||||
|
||||
class TemporaryUploadedFile(UploadedFile):
|
||||
def __init__(self, name: str, content_type: str, size: int, charset: str, content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def __init__(
|
||||
self, name: str, content_type: str, size: int, charset: str, content_type_extra: Dict[str, str] = None
|
||||
) -> None: ...
|
||||
def temporary_file_path(self) -> str: ...
|
||||
|
||||
class InMemoryUploadedFile(UploadedFile):
|
||||
field_name = ... # type: Optional[str]
|
||||
def __init__(self, file: IO, field_name: Optional[str], name: str, content_type: Optional[str], size: int, charset: Optional[str], content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def chunks(self, chunk_size: int=None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int=None) -> bool: ...
|
||||
def __init__(
|
||||
self,
|
||||
file: IO,
|
||||
field_name: Optional[str],
|
||||
name: str,
|
||||
content_type: Optional[str],
|
||||
size: int,
|
||||
charset: Optional[str],
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
) -> None: ...
|
||||
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(self, name: str, content: bytes, content_type: str='') -> None: ...
|
||||
def __init__(self, name: str, content: bytes, content_type: str = "") -> None: ...
|
||||
@classmethod
|
||||
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class UploadFileException(Exception): ...
|
||||
|
||||
class StopUpload(UploadFileException):
|
||||
connection_reset = ... # type: bool
|
||||
def __init__(self, connection_reset: bool=False) -> None: ...
|
||||
def __init__(self, connection_reset: bool = False) -> None: ...
|
||||
|
||||
class SkipFile(UploadFileException): ...
|
||||
class StopFutureHandlers(UploadFileException): ...
|
||||
@@ -23,25 +23,53 @@ class FileUploadHandler:
|
||||
content_type_extra = ... # type: Optional[Dict[str, str]]
|
||||
request = ... # type: Optional[HttpRequest]
|
||||
field_name = ... # type: str
|
||||
def __init__(self, request: HttpRequest=None) -> None: ...
|
||||
def handle_raw_input(self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str=None) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(self, field_name: str, file_name: str, content_type: str, content_length: Optional[int], charset: str=None, content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def __init__(self, request: HttpRequest = None) -> None: ...
|
||||
def handle_raw_input(
|
||||
self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str = None
|
||||
) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(
|
||||
self,
|
||||
field_name: str,
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
def upload_complete(self) -> None: ...
|
||||
|
||||
class TemporaryFileUploadHandler(FileUploadHandler):
|
||||
def __init__(self, request: HttpRequest=None) -> None: ...
|
||||
def __init__(self, request: HttpRequest = None) -> None: ...
|
||||
file = ... # type: TemporaryUploadedFile
|
||||
def new_file(self, field_name: str, file_name: str, content_type: str, content_length: Optional[int], charset: str=None, content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def new_file(
|
||||
self,
|
||||
field_name: str,
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
|
||||
class MemoryFileUploadHandler(FileUploadHandler):
|
||||
activated = ... # type: bool
|
||||
file = ... # type: IO[bytes]
|
||||
def handle_raw_input(self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str=None) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(self, field_name: str, file_name: str, content_type: str, content_length: Optional[int], charset: str=None, content_type_extra: Dict[str, str]=None) -> None: ...
|
||||
def handle_raw_input(
|
||||
self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str = None
|
||||
) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(
|
||||
self,
|
||||
field_name: str,
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import BinaryIO, Any, Optional, Tuple, Union
|
||||
|
||||
class FileProxyMixin(BinaryIO):
|
||||
|
||||
newlines = ... # type: Union[str, Tuple[str, ...], None]
|
||||
softspace = ... # type: bool
|
||||
|
||||
newlines = ... # type: Union[str, Tuple[str, ...], None]
|
||||
softspace = ... # type: bool
|
||||
def readinto(self, b: Any) -> Optional[int]: ...
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
from .utils import (ProgrammingError as ProgrammingError,
|
||||
IntegrityError as IntegrityError,
|
||||
OperationalError as OperationalError,
|
||||
DatabaseError as DatabaseError,
|
||||
DataError as DataError,
|
||||
NotSupportedError as NotSupportedError)
|
||||
from .utils import (
|
||||
ProgrammingError as ProgrammingError,
|
||||
IntegrityError as IntegrityError,
|
||||
OperationalError as OperationalError,
|
||||
DatabaseError as DatabaseError,
|
||||
DataError as DataError,
|
||||
NotSupportedError as NotSupportedError,
|
||||
)
|
||||
|
||||
connections: Any
|
||||
router: Any
|
||||
|
||||
@@ -1,41 +1,32 @@
|
||||
from .base import Model as Model
|
||||
|
||||
from .fields import (AutoField as AutoField,
|
||||
IntegerField as IntegerField,
|
||||
SmallIntegerField as SmallIntegerField,
|
||||
BigIntegerField as BigIntegerField,
|
||||
CharField as CharField,
|
||||
Field as Field,
|
||||
SlugField as SlugField,
|
||||
TextField as TextField,
|
||||
BooleanField as BooleanField,
|
||||
FileField as FileField,
|
||||
DateField as DateField,
|
||||
DateTimeField as DateTimeField,
|
||||
IPAddressField as IPAddressField,
|
||||
GenericIPAddressField as GenericIPAddressField)
|
||||
from .fields import (
|
||||
AutoField as AutoField,
|
||||
IntegerField as IntegerField,
|
||||
SmallIntegerField as SmallIntegerField,
|
||||
BigIntegerField as BigIntegerField,
|
||||
CharField as CharField,
|
||||
Field as Field,
|
||||
SlugField as SlugField,
|
||||
TextField as TextField,
|
||||
BooleanField as BooleanField,
|
||||
FileField as FileField,
|
||||
DateField as DateField,
|
||||
DateTimeField as DateTimeField,
|
||||
IPAddressField as IPAddressField,
|
||||
GenericIPAddressField as GenericIPAddressField,
|
||||
)
|
||||
|
||||
from .fields.related import (ForeignKey as ForeignKey,
|
||||
OneToOneField as OneToOneField,
|
||||
ManyToManyField as ManyToManyField)
|
||||
from .fields.related import ForeignKey as ForeignKey, OneToOneField as OneToOneField, ManyToManyField as ManyToManyField
|
||||
|
||||
from .deletion import (CASCADE as CASCADE,
|
||||
SET_DEFAULT as SET_DEFAULT,
|
||||
SET_NULL as SET_NULL,
|
||||
DO_NOTHING as DO_NOTHING)
|
||||
from .deletion import CASCADE as CASCADE, SET_DEFAULT as SET_DEFAULT, SET_NULL as SET_NULL, DO_NOTHING as DO_NOTHING
|
||||
|
||||
from .query import (QuerySet as QuerySet,
|
||||
RawQuerySet as RawQuerySet)
|
||||
from .query import QuerySet as QuerySet, RawQuerySet as RawQuerySet
|
||||
|
||||
from .query_utils import Q as Q
|
||||
|
||||
from .lookups import Lookup as Lookup
|
||||
|
||||
from .expressions import (F as F,
|
||||
Subquery as Subquery,
|
||||
Exists as Exists,
|
||||
OrderBy as OrderBy,
|
||||
OuterRef as OuterRef)
|
||||
from .expressions import F as F, Subquery as Subquery, Exists as Exists, OrderBy as OrderBy, OuterRef as OuterRef
|
||||
|
||||
from .manager import (BaseManager as BaseManager,
|
||||
Manager as Manager)
|
||||
from .manager import BaseManager as BaseManager, Manager as Manager
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
from typing import Any, List, Optional, Set, Tuple, Dict
|
||||
|
||||
|
||||
class ModelBase(type):
|
||||
pass
|
||||
|
||||
|
||||
class Model(metaclass=ModelBase):
|
||||
class DoesNotExist(Exception):
|
||||
pass
|
||||
|
||||
pk: Any = ...
|
||||
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
def delete(self,
|
||||
using: Any = ...,
|
||||
keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
|
||||
|
||||
def full_clean(
|
||||
self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
def delete(self, using: Any = ..., keep_parents: bool = ...) -> Tuple[int, Dict[str, int]]: ...
|
||||
def full_clean(self, exclude: Optional[List[str]] = ..., validate_unique: bool = ...) -> None: ...
|
||||
def clean_fields(self, exclude: List[str] = ...) -> None: ...
|
||||
|
||||
def validate_unique(self, exclude: List[str] = ...) -> None: ...
|
||||
|
||||
def save(
|
||||
self,
|
||||
force_insert: bool = ...,
|
||||
@@ -32,9 +19,5 @@ class Model(metaclass=ModelBase):
|
||||
using: Optional[str] = ...,
|
||||
update_fields: Optional[List[str]] = ...,
|
||||
) -> 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]: ...
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
def CASCADE(collector, field, sub_objs, using): ...
|
||||
|
||||
def SET_NULL(collector, field, sub_objs, using): ...
|
||||
|
||||
def SET_DEFAULT(collector, field, sub_objs, using): ...
|
||||
|
||||
def DO_NOTHING(collector, field, sub_objs, using): ...
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
from collections import OrderedDict
|
||||
from datetime import datetime, timedelta
|
||||
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 django.db.models import QuerySet
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.lookups import Lookup
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
|
||||
|
||||
class SQLiteNumericMixin:
|
||||
def as_sqlite(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: Any,
|
||||
**extra_context: Any
|
||||
) -> Tuple[str, List[float]]: ...
|
||||
|
||||
def as_sqlite(self, compiler: SQLCompiler, connection: Any, **extra_context: Any) -> Tuple[str, List[float]]: ...
|
||||
|
||||
class Combinable:
|
||||
ADD: str = ...
|
||||
@@ -29,157 +21,85 @@ class Combinable:
|
||||
BITOR: str = ...
|
||||
BITLEFTSHIFT: str = ...
|
||||
BITRIGHTSHIFT: str = ...
|
||||
|
||||
def __neg__(self) -> CombinedExpression: ...
|
||||
|
||||
def __add__(
|
||||
self, other: Optional[Union[timedelta, Combinable, float, str]]
|
||||
) -> CombinedExpression: ...
|
||||
|
||||
def __sub__(
|
||||
self, other: Union[timedelta, Combinable, float]
|
||||
) -> CombinedExpression: ...
|
||||
|
||||
def __mul__(
|
||||
self, other: Union[timedelta, Combinable, float]
|
||||
) -> CombinedExpression: ...
|
||||
|
||||
def __add__(self, other: Optional[Union[timedelta, Combinable, float, str]]) -> CombinedExpression: ...
|
||||
def __sub__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
|
||||
def __mul__(self, other: Union[timedelta, Combinable, float]) -> CombinedExpression: ...
|
||||
def __truediv__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __mod__(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def __pow__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __and__(self, other: Combinable) -> Any: ...
|
||||
|
||||
def bitand(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def bitleftshift(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def bitrightshift(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def __or__(self, other: Combinable) -> Any: ...
|
||||
|
||||
def bitor(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def __radd__(
|
||||
self, other: Optional[Union[datetime, float]]
|
||||
) -> CombinedExpression: ...
|
||||
|
||||
def __radd__(self, other: Optional[Union[datetime, float]]) -> CombinedExpression: ...
|
||||
def __rsub__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __rmul__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __rtruediv__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __rmod__(self, other: int) -> CombinedExpression: ...
|
||||
|
||||
def __rpow__(self, other: float) -> CombinedExpression: ...
|
||||
|
||||
def __rand__(self, other: Any) -> Any: ...
|
||||
|
||||
def __ror__(self, other: Any) -> Any: ...
|
||||
|
||||
|
||||
class BaseExpression:
|
||||
is_summary: bool = ...
|
||||
filterable: bool = ...
|
||||
window_compatible: bool = ...
|
||||
|
||||
def __init__(self, output_field: Optional[Union[Field, str]] = ...) -> None: ...
|
||||
|
||||
def get_db_converters(self, connection: Any) -> List[Callable]: ...
|
||||
|
||||
def get_source_expressions(self) -> List[Any]: ...
|
||||
|
||||
def set_source_expressions(self, exprs: List[Any]) -> None: ...
|
||||
|
||||
def as_sql(self, compiler: Any, connection: Any) -> None: ...
|
||||
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
|
||||
def contains_column_references(self) -> bool: ...
|
||||
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Any = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...,
|
||||
self,
|
||||
query: Any = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...,
|
||||
) -> BaseExpression: ...
|
||||
|
||||
@property
|
||||
def field(self) -> Field: ...
|
||||
|
||||
@property
|
||||
def output_field(self) -> Field: ...
|
||||
|
||||
def convert_value(self) -> Callable: ...
|
||||
|
||||
def get_lookup(self, lookup: str) -> Optional[Type[Lookup]]: ...
|
||||
|
||||
def get_transform(self, name: str) -> Optional[Type[Expression]]: ...
|
||||
|
||||
def relabeled_clone(
|
||||
self, change_map: Union[Dict[Optional[str], str], OrderedDict]
|
||||
) -> Expression: ...
|
||||
|
||||
def relabeled_clone(self, change_map: Union[Dict[Optional[str], str], OrderedDict]) -> Expression: ...
|
||||
def copy(self) -> BaseExpression: ...
|
||||
|
||||
def get_group_by_cols(self) -> List[Expression]: ...
|
||||
|
||||
def get_source_fields(self) -> List[Optional[Field]]: ...
|
||||
|
||||
def asc(self, **kwargs: Any) -> Expression: ...
|
||||
|
||||
def desc(self, **kwargs: Any) -> Expression: ...
|
||||
|
||||
def reverse_ordering(self): ...
|
||||
|
||||
def flatten(self) -> Iterator[Expression]: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
|
||||
class Expression(BaseExpression, Combinable): ...
|
||||
|
||||
|
||||
class CombinedExpression(SQLiteNumericMixin, Expression):
|
||||
connector: Any = ...
|
||||
lhs: Any = ...
|
||||
rhs: Any = ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
lhs: Combinable,
|
||||
connector: str,
|
||||
rhs: Combinable,
|
||||
output_field: None = ...,
|
||||
) -> None: ...
|
||||
|
||||
def get_source_expressions(
|
||||
self
|
||||
) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
|
||||
|
||||
def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: None = ...) -> None: ...
|
||||
def get_source_expressions(self) -> Union[List[Combinable], List[SQLiteNumericMixin]]: ...
|
||||
def set_source_expressions(self, exprs: List[Combinable]) -> None: ...
|
||||
|
||||
def as_sql(self, compiler: SQLCompiler, connection: Any) -> Any: ...
|
||||
|
||||
def resolve_expression(
|
||||
self,
|
||||
query: Any = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...,
|
||||
self,
|
||||
query: Any = ...,
|
||||
allow_joins: bool = ...,
|
||||
reuse: Optional[Set[str]] = ...,
|
||||
summarize: bool = ...,
|
||||
for_save: bool = ...,
|
||||
) -> CombinedExpression: ...
|
||||
|
||||
|
||||
class F(Combinable):
|
||||
name: str
|
||||
def __init__(self, name: str): ...
|
||||
@@ -192,27 +112,19 @@ class F(Combinable):
|
||||
for_save: bool = ...,
|
||||
) -> Expression: ...
|
||||
|
||||
|
||||
class OuterRef(F): ...
|
||||
|
||||
class Subquery(Expression):
|
||||
template: str = ...
|
||||
queryset: QuerySet = ...
|
||||
extra: Dict[Any, Any] = ...
|
||||
def __init__(
|
||||
self,
|
||||
queryset: QuerySet,
|
||||
output_field: Optional[Field] = ...,
|
||||
**extra: Any
|
||||
) -> None: ...
|
||||
def __init__(self, queryset: QuerySet, output_field: Optional[Field] = ..., **extra: Any) -> None: ...
|
||||
|
||||
class Exists(Subquery):
|
||||
extra: Dict[Any, Any]
|
||||
template: str = ...
|
||||
negated: bool = ...
|
||||
def __init__(
|
||||
self, *args: Any, negated: bool = ..., **kwargs: Any
|
||||
) -> None: ...
|
||||
def __init__(self, *args: Any, negated: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __invert__(self) -> Exists: ...
|
||||
|
||||
class OrderBy(BaseExpression):
|
||||
@@ -222,9 +134,5 @@ class OrderBy(BaseExpression):
|
||||
descending: bool = ...
|
||||
expression: Expression = ...
|
||||
def __init__(
|
||||
self,
|
||||
expression: Combinable,
|
||||
descending: bool = ...,
|
||||
nulls_first: bool = ...,
|
||||
nulls_last: bool = ...,
|
||||
self, expression: Combinable, descending: bool = ..., nulls_first: bool = ..., nulls_last: bool = ...
|
||||
) -> None: ...
|
||||
|
||||
@@ -2,69 +2,47 @@ from typing import Any, Optional
|
||||
|
||||
from django.db.models.query_utils import RegisterLookupMixin
|
||||
|
||||
|
||||
class Field(RegisterLookupMixin):
|
||||
def __init__(self,
|
||||
primary_key: bool = False,
|
||||
**kwargs): ...
|
||||
|
||||
def __init__(self, primary_key: bool = False, **kwargs): ...
|
||||
def __get__(self, instance, owner) -> Any: ...
|
||||
|
||||
|
||||
class IntegerField(Field):
|
||||
def __get__(self, instance, owner) -> int: ...
|
||||
|
||||
|
||||
class SmallIntegerField(IntegerField): ...
|
||||
|
||||
|
||||
class BigIntegerField(IntegerField): ...
|
||||
|
||||
|
||||
class AutoField(Field):
|
||||
def __get__(self, instance, owner) -> int: ...
|
||||
|
||||
|
||||
class CharField(Field):
|
||||
def __init__(self,
|
||||
max_length: int,
|
||||
**kwargs): ...
|
||||
|
||||
def __init__(self, max_length: int, **kwargs): ...
|
||||
def __get__(self, instance, owner) -> str: ...
|
||||
|
||||
|
||||
class SlugField(CharField): ...
|
||||
|
||||
|
||||
class TextField(Field):
|
||||
def __get__(self, instance, owner) -> str: ...
|
||||
|
||||
|
||||
class BooleanField(Field):
|
||||
def __get__(self, instance, owner) -> bool: ...
|
||||
|
||||
|
||||
class FileField(Field): ...
|
||||
|
||||
|
||||
class IPAddressField(Field): ...
|
||||
|
||||
|
||||
class GenericIPAddressField(Field):
|
||||
default_error_messages: Any = ...
|
||||
unpack_ipv4: Any = ...
|
||||
protocol: Any = ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
protocol: str = ...,
|
||||
unpack_ipv4: bool = ...,
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
self,
|
||||
verbose_name: Optional[Any] = ...,
|
||||
name: Optional[Any] = ...,
|
||||
protocol: str = ...,
|
||||
unpack_ipv4: bool = ...,
|
||||
*args: Any,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
class DateField(Field): ...
|
||||
|
||||
class DateTimeField(DateField): ...
|
||||
class DateTimeField(DateField): ...
|
||||
|
||||
@@ -3,31 +3,16 @@ from typing import Type, Union, TypeVar, Any, Generic
|
||||
from django.db import models
|
||||
from django.db.models import Field
|
||||
|
||||
_T = TypeVar('_T', bound=models.Model)
|
||||
|
||||
_T = TypeVar("_T", bound=models.Model)
|
||||
|
||||
class ForeignKey(Field, 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): ...
|
||||
def __get__(self, instance, owner) -> _T: ...
|
||||
|
||||
|
||||
class OneToOneField(Field, 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): ...
|
||||
def __get__(self, instance, owner) -> _T: ...
|
||||
|
||||
|
||||
class ManyToManyField(Field, 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): ...
|
||||
def __get__(self, instance, owner) -> _T: ...
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.utils.datastructures import OrderedSet
|
||||
from django.utils.safestring import SafeText
|
||||
|
||||
|
||||
class Lookup:
|
||||
lookup_name: Any = ...
|
||||
prepare_rhs: bool = ...
|
||||
@@ -15,56 +14,26 @@ class Lookup:
|
||||
lhs: Any = ...
|
||||
rhs: Any = ...
|
||||
bilateral_transforms: Any = ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
lhs: Union[Expression, TextField],
|
||||
rhs: Any,
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, lhs: Union[Expression, TextField], rhs: Any) -> None: ...
|
||||
def apply_bilateral_transforms(self, value: Expression) -> Expression: ...
|
||||
|
||||
def batch_process_rhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: Any,
|
||||
rhs: Optional[OrderedSet] = ...,
|
||||
self, compiler: SQLCompiler, connection: Any, rhs: Optional[OrderedSet] = ...
|
||||
) -> Tuple[List[str], List[str]]: ...
|
||||
|
||||
def get_source_expressions(self) -> List[Expression]: ...
|
||||
|
||||
def set_source_expressions(self, new_exprs: List[Expression]) -> None: ...
|
||||
|
||||
def get_prep_lookup(self) -> Any: ...
|
||||
|
||||
def get_db_prep_lookup(
|
||||
self, value: Union[int, str], connection: Any
|
||||
) -> Tuple[str, List[SafeText]]: ...
|
||||
|
||||
def get_db_prep_lookup(self, value: Union[int, str], connection: Any) -> Tuple[str, List[SafeText]]: ...
|
||||
def process_lhs(
|
||||
self,
|
||||
compiler: SQLCompiler,
|
||||
connection: Any,
|
||||
lhs: Optional[Expression] = ...,
|
||||
self, compiler: SQLCompiler, connection: Any, lhs: Optional[Expression] = ...
|
||||
) -> Tuple[str, List[Union[int, str]]]: ...
|
||||
|
||||
def process_rhs(
|
||||
self, compiler: SQLCompiler, connection: Any
|
||||
self, compiler: SQLCompiler, connection: Any
|
||||
) -> Tuple[str, Union[List[Union[int, str]], Tuple[int, int]]]: ...
|
||||
|
||||
def rhs_is_direct_value(self) -> bool: ...
|
||||
|
||||
def relabeled_clone(
|
||||
self, relabels: Union[Dict[Optional[str], str], OrderedDict]
|
||||
) -> Lookup: ...
|
||||
|
||||
def relabeled_clone(self, relabels: Union[Dict[Optional[str], str], OrderedDict]) -> Lookup: ...
|
||||
def get_group_by_cols(self) -> List[Expression]: ...
|
||||
|
||||
def as_sql(self, compiler: Any, connection: Any) -> None: ...
|
||||
|
||||
def contains_aggregate(self) -> bool: ...
|
||||
|
||||
def contains_over_clause(self) -> bool: ...
|
||||
|
||||
@property
|
||||
def is_summary(self): ...
|
||||
|
||||
@@ -8,8 +8,7 @@ from django.db.models import Q
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet, RawQuerySet
|
||||
|
||||
_T = TypeVar('_T', bound=Model)
|
||||
|
||||
_T = TypeVar("_T", bound=Model)
|
||||
|
||||
class BaseManager:
|
||||
creation_counter: int = ...
|
||||
@@ -22,15 +21,9 @@ class BaseManager:
|
||||
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
@classmethod
|
||||
def from_queryset(
|
||||
cls, queryset_class: Any, class_name: Optional[Any] = ...
|
||||
): ...
|
||||
def from_queryset(cls, queryset_class: Any, class_name: Optional[Any] = ...): ...
|
||||
def contribute_to_class(self, model: Type[Model], name: str) -> None: ...
|
||||
def db_manager(
|
||||
self,
|
||||
using: Optional[str] = ...,
|
||||
hints: Optional[Dict[str, Model]] = ...,
|
||||
) -> Manager: ...
|
||||
def db_manager(self, using: Optional[str] = ..., hints: Optional[Dict[str, Model]] = ...) -> Manager: ...
|
||||
@property
|
||||
def db(self) -> str: ...
|
||||
def get_queryset(self) -> QuerySet: ...
|
||||
@@ -40,97 +33,51 @@ class BaseManager:
|
||||
|
||||
class Manager(Generic[_T]):
|
||||
def exists(self) -> bool: ...
|
||||
def explain(
|
||||
self, *, format: Optional[Any] = ..., **options: Any
|
||||
) -> str: ...
|
||||
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||
def raw(
|
||||
self,
|
||||
raw_query: str,
|
||||
params: Optional[
|
||||
Union[
|
||||
Dict[str, str],
|
||||
List[datetime],
|
||||
List[Decimal],
|
||||
List[str],
|
||||
Set[str],
|
||||
Tuple[int],
|
||||
]
|
||||
] = ...,
|
||||
translations: Optional[Dict[str, str]] = ...,
|
||||
using: None = ...,
|
||||
self,
|
||||
raw_query: str,
|
||||
params: Optional[Union[Dict[str, str], List[datetime], List[Decimal], List[str], Set[str], Tuple[int]]] = ...,
|
||||
translations: Optional[Dict[str, str]] = ...,
|
||||
using: None = ...,
|
||||
) -> RawQuerySet: ...
|
||||
def values(self, *fields: Any, **expressions: Any) -> QuerySet: ...
|
||||
def values_list(
|
||||
self, *fields: Any, flat: bool = ..., named: bool = ...
|
||||
) -> QuerySet: ...
|
||||
def dates(
|
||||
self, field_name: str, kind: str, order: str = ...
|
||||
) -> QuerySet: ...
|
||||
def datetimes(
|
||||
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
|
||||
) -> QuerySet: ...
|
||||
def values_list(self, *fields: Any, flat: bool = ..., named: bool = ...) -> QuerySet: ...
|
||||
def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet: ...
|
||||
def datetimes(self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...) -> QuerySet: ...
|
||||
def none(self) -> QuerySet[_T]: ...
|
||||
def all(self) -> QuerySet[_T]: ...
|
||||
def filter(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
def complex_filter(
|
||||
self,
|
||||
filter_obj: Union[
|
||||
Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock
|
||||
],
|
||||
) -> QuerySet[_T]: ...
|
||||
def complex_filter(self, filter_obj: Union[Dict[str, datetime], Dict[str, QuerySet], Q, MagicMock]) -> QuerySet[_T]: ...
|
||||
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
|
||||
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def select_for_update(
|
||||
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
def select_for_update(self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...) -> QuerySet: ...
|
||||
def select_related(self, *fields: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def prefetch_related(self, *lookups: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def annotate(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def order_by(self, *field_names: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def distinct(self, *field_names: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def extra(
|
||||
self,
|
||||
select: Optional[
|
||||
Union[Dict[str, int], Dict[str, str], OrderedDict]
|
||||
] = ...,
|
||||
where: Optional[List[str]] = ...,
|
||||
params: Optional[Union[List[int], List[str]]] = ...,
|
||||
tables: Optional[List[str]] = ...,
|
||||
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
|
||||
self,
|
||||
select: Optional[Union[Dict[str, int], Dict[str, str], OrderedDict]] = ...,
|
||||
where: Optional[List[str]] = ...,
|
||||
params: Optional[Union[List[int], List[str]]] = ...,
|
||||
tables: Optional[List[str]] = ...,
|
||||
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
|
||||
) -> QuerySet[_T]: ...
|
||||
|
||||
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
||||
|
||||
def aggregate(
|
||||
self, *args: Any, **kwargs: Any
|
||||
) -> Dict[str, Optional[Union[datetime, float]]]: ...
|
||||
|
||||
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Optional[Union[datetime, float]]]: ...
|
||||
def count(self) -> int: ...
|
||||
|
||||
def get(
|
||||
self, *args: Any, **kwargs: Any
|
||||
) -> _T: ...
|
||||
|
||||
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
def create(self, **kwargs: Any) -> _T: ...
|
||||
|
||||
|
||||
class ManagerDescriptor:
|
||||
manager: Manager = ...
|
||||
def __init__(self, manager: Manager) -> None: ...
|
||||
def __get__(
|
||||
self, instance: Optional[Model], cls: Type[Model] = ...
|
||||
) -> Manager: ...
|
||||
def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Manager: ...
|
||||
|
||||
class EmptyManager(Manager):
|
||||
creation_counter: int
|
||||
|
||||
@@ -4,16 +4,15 @@ from typing import Generic, TypeVar, Optional, Any, Type, Dict, Union, overload,
|
||||
|
||||
from django.db import models
|
||||
|
||||
_T = TypeVar('_T', bound=models.Model)
|
||||
|
||||
_T = TypeVar("_T", bound=models.Model)
|
||||
|
||||
class QuerySet(Generic[_T]):
|
||||
def __init__(
|
||||
self,
|
||||
model: Optional[Type[models.Model]] = ...,
|
||||
query: Optional[Any] = ...,
|
||||
using: Optional[str] = ...,
|
||||
hints: Optional[Dict[str, models.Model]] = ...,
|
||||
self,
|
||||
model: Optional[Type[models.Model]] = ...,
|
||||
query: Optional[Any] = ...,
|
||||
using: Optional[str] = ...,
|
||||
hints: Optional[Dict[str, models.Model]] = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def as_manager(cls): ...
|
||||
@@ -28,158 +27,76 @@ class QuerySet(Generic[_T]):
|
||||
def __getitem__(self, k: str) -> Any: ...
|
||||
def __and__(self, other: QuerySet) -> QuerySet: ...
|
||||
def __or__(self, other: QuerySet) -> QuerySet: ...
|
||||
|
||||
def iterator(self, chunk_size: int = ...) -> Iterator[_T]: ...
|
||||
def aggregate(
|
||||
self, *args: Any, **kwargs: Any
|
||||
) -> Dict[str, Optional[Union[datetime, float]]]: ...
|
||||
def aggregate(self, *args: Any, **kwargs: Any) -> Dict[str, Optional[Union[datetime, float]]]: ...
|
||||
def count(self) -> int: ...
|
||||
def get(
|
||||
self, *args: Any, **kwargs: Any
|
||||
) -> _T: ...
|
||||
def get(self, *args: Any, **kwargs: Any) -> _T: ...
|
||||
def create(self, **kwargs: Any) -> _T: ...
|
||||
def bulk_create(
|
||||
self,
|
||||
objs: Union[Iterator[Any], List[models.Model]],
|
||||
batch_size: Optional[int] = ...,
|
||||
) -> List[_T]: ...
|
||||
|
||||
def bulk_create(self, objs: Union[Iterator[Any], List[models.Model]], batch_size: Optional[int] = ...) -> List[_T]: ...
|
||||
def get_or_create(
|
||||
self,
|
||||
defaults: Optional[Union[Dict[str, date], Dict[str, models.Model]]] = ...,
|
||||
**kwargs: Any
|
||||
self, defaults: Optional[Union[Dict[str, date], Dict[str, models.Model]]] = ..., **kwargs: Any
|
||||
) -> Tuple[_T, bool]: ...
|
||||
|
||||
def update_or_create(
|
||||
self,
|
||||
defaults: Optional[
|
||||
Union[
|
||||
Dict[str, Callable],
|
||||
Dict[str, date],
|
||||
Dict[str, models.Model],
|
||||
Dict[str, str],
|
||||
]
|
||||
] = ...,
|
||||
**kwargs: Any
|
||||
self,
|
||||
defaults: Optional[Union[Dict[str, Callable], Dict[str, date], Dict[str, models.Model], Dict[str, str]]] = ...,
|
||||
**kwargs: Any
|
||||
) -> Tuple[_T, bool]: ...
|
||||
|
||||
def earliest(
|
||||
self, *fields: Any, field_name: Optional[Any] = ...
|
||||
) -> _T: ...
|
||||
|
||||
def latest(
|
||||
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 first(self) -> Optional[Union[Dict[str, int], _T]]: ...
|
||||
|
||||
def last(self) -> Optional[_T]: ...
|
||||
|
||||
def in_bulk(
|
||||
self, id_list: Any = ..., *, field_name: str = ...
|
||||
self, id_list: Any = ..., *, field_name: str = ...
|
||||
) -> Union[Dict[int, models.Model], Dict[str, models.Model]]: ...
|
||||
|
||||
def delete(self) -> Tuple[int, Dict[str, int]]: ...
|
||||
|
||||
def update(self, **kwargs: Any) -> int: ...
|
||||
|
||||
def exists(self) -> bool: ...
|
||||
|
||||
def explain(
|
||||
self, *, format: Optional[Any] = ..., **options: Any
|
||||
) -> str: ...
|
||||
|
||||
def explain(self, *, format: Optional[Any] = ..., **options: Any) -> str: ...
|
||||
def raw(
|
||||
self,
|
||||
raw_query: str,
|
||||
params: Any = ...,
|
||||
translations: Optional[Dict[str, str]] = ...,
|
||||
using: None = ...,
|
||||
self, raw_query: str, params: Any = ..., translations: Optional[Dict[str, str]] = ..., using: None = ...
|
||||
) -> RawQuerySet: ...
|
||||
|
||||
def values(self, *fields: Any, **expressions: Any) -> QuerySet: ...
|
||||
|
||||
def values_list(
|
||||
self, *fields: Any, flat: bool = ..., named: bool = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
def dates(
|
||||
self, field_name: str, kind: str, order: str = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
def datetimes(
|
||||
self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
def values_list(self, *fields: Any, flat: bool = ..., named: bool = ...) -> QuerySet: ...
|
||||
def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet: ...
|
||||
def datetimes(self, field_name: str, kind: str, order: str = ..., tzinfo: None = ...) -> QuerySet: ...
|
||||
def none(self) -> QuerySet[_T]: ...
|
||||
|
||||
def all(self) -> QuerySet[_T]: ...
|
||||
|
||||
def filter(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def complex_filter(
|
||||
self,
|
||||
filter_obj: Any,
|
||||
) -> QuerySet[_T]: ...
|
||||
|
||||
def complex_filter(self, filter_obj: Any) -> QuerySet[_T]: ...
|
||||
def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ...
|
||||
|
||||
def intersection(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def difference(self, *other_qs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def select_for_update(
|
||||
self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...
|
||||
) -> QuerySet: ...
|
||||
|
||||
def select_for_update(self, nowait: bool = ..., skip_locked: bool = ..., of: Tuple = ...) -> QuerySet: ...
|
||||
def select_related(self, *fields: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def prefetch_related(self, *lookups: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def annotate(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def order_by(self, *field_names: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def distinct(self, *field_names: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def extra(
|
||||
self,
|
||||
select: Optional[
|
||||
Union[Dict[str, int], Dict[str, str], OrderedDict]
|
||||
] = ...,
|
||||
where: Optional[List[str]] = ...,
|
||||
params: Optional[Union[List[int], List[str]]] = ...,
|
||||
tables: Optional[List[str]] = ...,
|
||||
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
|
||||
self,
|
||||
select: Optional[Union[Dict[str, int], Dict[str, str], OrderedDict]] = ...,
|
||||
where: Optional[List[str]] = ...,
|
||||
params: Optional[Union[List[int], List[str]]] = ...,
|
||||
tables: Optional[List[str]] = ...,
|
||||
order_by: Optional[Union[List[str], Tuple[str]]] = ...,
|
||||
select_params: Optional[Union[List[int], List[str], Tuple[int]]] = ...,
|
||||
) -> QuerySet[_T]: ...
|
||||
|
||||
def reverse(self) -> QuerySet[_T]: ...
|
||||
|
||||
def defer(self, *fields: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def only(self, *fields: Any) -> QuerySet[_T]: ...
|
||||
|
||||
def using(self, alias: Optional[str]) -> QuerySet[_T]: ...
|
||||
|
||||
@property
|
||||
def ordered(self) -> bool: ...
|
||||
|
||||
@property
|
||||
def db(self) -> str: ...
|
||||
|
||||
def resolve_expression(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
|
||||
class RawQuerySet:
|
||||
pass
|
||||
|
||||
|
||||
class RawQuery(object):
|
||||
pass
|
||||
|
||||
|
||||
class Query(object):
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
class RegisterLookupMixin:
|
||||
pass
|
||||
|
||||
|
||||
class Q(object):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
|
||||
def __or__(self, other: Q) -> Q: ...
|
||||
|
||||
def __and__(self, other: Q) -> Q: ...
|
||||
|
||||
def __invert__(self) -> Q: ...
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
from ..query import (Query as Query,
|
||||
RawQuery as RawQuery)
|
||||
from ..query import Query as Query, RawQuery as RawQuery
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from itertools import chain
|
||||
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 django.db.models.base import Model
|
||||
@@ -11,7 +10,6 @@ from django.db.models.sql import Query, RawQuery
|
||||
|
||||
FORCE: Any
|
||||
|
||||
|
||||
class SQLCompiler:
|
||||
query: Any = ...
|
||||
connection: Any = ...
|
||||
@@ -21,144 +19,65 @@ class SQLCompiler:
|
||||
annotation_col_map: Any = ...
|
||||
klass_info: Any = ...
|
||||
ordering_parts: Any = ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
query: Union[Query, RawQuery],
|
||||
connection: Any,
|
||||
using: Optional[str],
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, query: Union[Query, RawQuery], connection: Any, using: Optional[str]) -> None: ...
|
||||
col_count: Any = ...
|
||||
|
||||
def setup_query(self) -> None: ...
|
||||
|
||||
has_extra_select: Any = ...
|
||||
|
||||
def pre_sql_setup(
|
||||
self
|
||||
self
|
||||
) -> Tuple[
|
||||
List[
|
||||
Tuple[Expression, Tuple[str, Union[List[Any], Tuple[str, str]]], None]
|
||||
],
|
||||
List[Tuple[Expression, Tuple[str, Union[List[Any], Tuple[str, str]]], None]],
|
||||
List[Tuple[Expression, Tuple[str, List[Union[int, str]], bool]]],
|
||||
List[Tuple[str, List[float]]],
|
||||
]: ...
|
||||
|
||||
def get_group_by(
|
||||
self,
|
||||
select: List[
|
||||
Tuple[
|
||||
BaseExpression,
|
||||
Tuple[str, List[float]],
|
||||
Optional[str],
|
||||
]
|
||||
],
|
||||
order_by: List[Tuple[Expression, Tuple[str, List[Union[int, str]], bool]]],
|
||||
self,
|
||||
select: List[Tuple[BaseExpression, Tuple[str, List[float]], Optional[str]]],
|
||||
order_by: List[Tuple[Expression, Tuple[str, List[Union[int, str]], bool]]],
|
||||
) -> List[Tuple[str, List[float]]]: ...
|
||||
|
||||
def collapse_group_by(
|
||||
self,
|
||||
expressions: List[Expression],
|
||||
having: Union[List[Expression], Tuple],
|
||||
) -> List[Expression]: ...
|
||||
|
||||
def collapse_group_by(self, expressions: List[Expression], having: Union[List[Expression], Tuple]) -> List[Expression]: ...
|
||||
def get_select(
|
||||
self
|
||||
self
|
||||
) -> Tuple[
|
||||
List[
|
||||
Tuple[
|
||||
Expression,
|
||||
Tuple[str, List[Union[int, str]]],
|
||||
Optional[str],
|
||||
]
|
||||
],
|
||||
Optional[
|
||||
Dict[str, Any]
|
||||
],
|
||||
Dict[str, int],
|
||||
List[Tuple[Expression, Tuple[str, List[Union[int, str]]], Optional[str]]], Optional[Dict[str, Any]], Dict[str, int]
|
||||
]: ...
|
||||
|
||||
def get_order_by(
|
||||
self
|
||||
) -> List[Tuple[Expression, Tuple[str, List[Any], bool]]]: ...
|
||||
|
||||
def get_order_by(self) -> List[Tuple[Expression, Tuple[str, List[Any], bool]]]: ...
|
||||
def get_extra_select(
|
||||
self,
|
||||
order_by: List[Tuple[Expression, Tuple[str, List[Any], bool]]],
|
||||
select: List[
|
||||
Tuple[
|
||||
Expression,
|
||||
Tuple[str, List[float]],
|
||||
Optional[str],
|
||||
]
|
||||
],
|
||||
self,
|
||||
order_by: List[Tuple[Expression, Tuple[str, List[Any], bool]]],
|
||||
select: List[Tuple[Expression, Tuple[str, List[float]], Optional[str]]],
|
||||
) -> List[Tuple[Expression, Tuple[str, List[Any]], None]]: ...
|
||||
|
||||
def quote_name_unless_alias(self, name: str) -> str: ...
|
||||
|
||||
def compile(
|
||||
self, node: Any, select_format: Any = ...
|
||||
) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
|
||||
|
||||
def get_combinator_sql(
|
||||
self, combinator: str, all: bool
|
||||
) -> Tuple[List[str], Union[List[int], List[str]]]: ...
|
||||
|
||||
def as_sql(
|
||||
self, with_limits: bool = ..., with_col_aliases: bool = ...
|
||||
) -> Any: ...
|
||||
|
||||
def compile(self, node: Any, select_format: Any = ...) -> Tuple[str, Union[List[Optional[int]], Tuple[int, int]]]: ...
|
||||
def get_combinator_sql(self, combinator: str, all: bool) -> Tuple[List[str], Union[List[int], List[str]]]: ...
|
||||
def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...) -> Any: ...
|
||||
def get_default_columns(
|
||||
self,
|
||||
start_alias: Optional[str] = ...,
|
||||
opts: Optional[Any] = ...,
|
||||
from_parent: Optional[Type[Model]] = ...,
|
||||
self, start_alias: Optional[str] = ..., opts: Optional[Any] = ..., from_parent: Optional[Type[Model]] = ...
|
||||
) -> List[Expression]: ...
|
||||
|
||||
def get_distinct(self) -> Tuple[List[Any], List[Any]]: ...
|
||||
|
||||
def find_ordering_name(
|
||||
self,
|
||||
name: str,
|
||||
opts: Any,
|
||||
alias: Optional[str] = ...,
|
||||
default_order: str = ...,
|
||||
already_seen: Optional[
|
||||
Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]
|
||||
] = ...,
|
||||
self,
|
||||
name: str,
|
||||
opts: Any,
|
||||
alias: Optional[str] = ...,
|
||||
default_order: str = ...,
|
||||
already_seen: Optional[Set[Tuple[Optional[Tuple[Tuple[str, str]]], Tuple[Tuple[str, str]]]]] = ...,
|
||||
) -> List[Tuple[Expression, bool]]: ...
|
||||
|
||||
def get_from_clause(self) -> Tuple[List[str], List[Union[int, str]]]: ...
|
||||
|
||||
def get_related_selections(
|
||||
self,
|
||||
select: List[Tuple[Expression, Optional[str]]],
|
||||
opts: Optional[Any] = ...,
|
||||
root_alias: Optional[str] = ...,
|
||||
cur_depth: int = ...,
|
||||
requested: Optional[
|
||||
Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]
|
||||
] = ...,
|
||||
restricted: Optional[bool] = ...,
|
||||
self,
|
||||
select: List[Tuple[Expression, Optional[str]]],
|
||||
opts: Optional[Any] = ...,
|
||||
root_alias: Optional[str] = ...,
|
||||
cur_depth: int = ...,
|
||||
requested: Optional[Union[Dict[str, Dict[str, Dict[str, Dict[Any, Any]]]], bool]] = ...,
|
||||
restricted: Optional[bool] = ...,
|
||||
) -> List[Dict[str, Any]]: ...
|
||||
|
||||
def get_select_for_update_of_arguments(self): ...
|
||||
|
||||
def deferred_to_columns(self) -> Dict[Type[Model], Set[str]]: ...
|
||||
|
||||
def get_converters(
|
||||
self, expressions: List[Expression]
|
||||
) -> Dict[
|
||||
int, Tuple[List[Callable], Expression]
|
||||
]: ...
|
||||
|
||||
def get_converters(self, expressions: List[Expression]) -> Dict[int, Tuple[List[Callable], Expression]]: ...
|
||||
def apply_converters(
|
||||
self,
|
||||
rows: chain,
|
||||
converters: Dict[
|
||||
int, Tuple[List[Callable], Expression]
|
||||
],
|
||||
self, rows: chain, converters: Dict[int, Tuple[List[Callable], Expression]]
|
||||
) -> Iterator[
|
||||
Union[
|
||||
List[Optional[Union[bytes, datetime, int, str]]],
|
||||
@@ -166,28 +85,14 @@ class SQLCompiler:
|
||||
List[Optional[Union[datetime, float, str, UUID]]],
|
||||
]
|
||||
]: ...
|
||||
|
||||
def results_iter(
|
||||
self,
|
||||
results: Optional[
|
||||
Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]
|
||||
] = ...,
|
||||
tuple_expected: bool = ...,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...,
|
||||
self,
|
||||
results: Optional[Union[Iterator[Any], List[List[Tuple[Union[int, str]]]]]] = ...,
|
||||
tuple_expected: bool = ...,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...,
|
||||
) -> Iterator[Any]: ...
|
||||
|
||||
def has_results(self) -> bool: ...
|
||||
|
||||
def execute_sql(
|
||||
self,
|
||||
result_type: str = ...,
|
||||
chunked_fetch: bool = ...,
|
||||
chunk_size: int = ...,
|
||||
) -> Optional[Any]: ...
|
||||
|
||||
def as_subquery_condition(
|
||||
self, alias: str, columns: List[str], compiler: SQLCompiler
|
||||
) -> Tuple[str, Tuple]: ...
|
||||
|
||||
def execute_sql(self, result_type: str = ..., chunked_fetch: bool = ..., chunk_size: int = ...) -> Optional[Any]: ...
|
||||
def as_subquery_condition(self, alias: str, columns: List[str], compiler: SQLCompiler) -> Tuple[str, Tuple]: ...
|
||||
def explain_query(self) -> Iterator[str]: ...
|
||||
|
||||
@@ -3,7 +3,6 @@ from typing import Any, Callable, Optional, Union, ContextManager
|
||||
|
||||
from django.db import ProgrammingError
|
||||
|
||||
|
||||
class TransactionManagementError(ProgrammingError): ...
|
||||
|
||||
def get_connection(using: Optional[str] = ...) -> Any: ...
|
||||
@@ -24,11 +23,7 @@ class Atomic(ContextDecorator):
|
||||
savepoint: bool = ...
|
||||
def __init__(self, using: Optional[str], savepoint: bool) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(
|
||||
self, exc_type: None, exc_value: None, traceback: None
|
||||
) -> None: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
|
||||
def atomic(
|
||||
using: Optional[Union[Callable, str]] = ..., savepoint: bool = ...
|
||||
) -> ContextManager[Atomic]: ...
|
||||
def atomic(using: Optional[Union[Callable, str]] = ..., savepoint: bool = ...) -> ContextManager[Atomic]: ...
|
||||
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
DEFAULT_DB_ALIAS: str
|
||||
DJANGO_VERSION_PICKLE_KEY: str
|
||||
|
||||
@@ -20,9 +19,7 @@ class ConnectionDoesNotExist(Exception): ...
|
||||
|
||||
class ConnectionHandler:
|
||||
databases: Dict[str, Dict[str, Optional[Any]]]
|
||||
def __init__(
|
||||
self, databases: Dict[str, Dict[str, Optional[Any]]] = ...
|
||||
) -> None: ...
|
||||
def __init__(self, databases: Dict[str, Dict[str, Optional[Any]]] = ...) -> None: ...
|
||||
def ensure_defaults(self, alias: str) -> None: ...
|
||||
def prepare_test_settings(self, alias: str) -> None: ...
|
||||
def __getitem__(self, alias: str) -> Any: ...
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
from .request import (HttpRequest as HttpRequest,
|
||||
QueryDict as QueryDict)
|
||||
from .request import HttpRequest as HttpRequest, QueryDict as QueryDict
|
||||
|
||||
from .response import (BadHeaderError as BadHeaderError,
|
||||
FileResponse as FileResponse,
|
||||
Http404 as Http404,
|
||||
HttpResponse as HttpResponse,
|
||||
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||
HttpResponseForbidden as HttpResponseForbidden,
|
||||
HttpResponseGone as HttpResponseGone,
|
||||
HttpResponseNotAllowed as HttpResponseNotAllowed,
|
||||
HttpResponseNotFound as HttpResponseNotFound,
|
||||
HttpResponseNotModified as HttpResponseNotModified,
|
||||
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
||||
HttpResponseRedirect as HttpResponseRedirect,
|
||||
HttpResponseServerError as HttpResponseServerError,
|
||||
JsonResponse as JsonResponse,
|
||||
StreamingHttpResponse as StreamingHttpResponse)
|
||||
from .response import (
|
||||
BadHeaderError as BadHeaderError,
|
||||
FileResponse as FileResponse,
|
||||
Http404 as Http404,
|
||||
HttpResponse as HttpResponse,
|
||||
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||
HttpResponseForbidden as HttpResponseForbidden,
|
||||
HttpResponseGone as HttpResponseGone,
|
||||
HttpResponseNotAllowed as HttpResponseNotAllowed,
|
||||
HttpResponseNotFound as HttpResponseNotFound,
|
||||
HttpResponseNotModified as HttpResponseNotModified,
|
||||
HttpResponsePermanentRedirect as HttpResponsePermanentRedirect,
|
||||
HttpResponseRedirect as HttpResponseRedirect,
|
||||
HttpResponseServerError as HttpResponseServerError,
|
||||
JsonResponse as JsonResponse,
|
||||
StreamingHttpResponse as StreamingHttpResponse,
|
||||
)
|
||||
|
||||
from .cookie import (SimpleCookie as SimpleCookie,
|
||||
parse_cookie as parse_cookie)
|
||||
from .cookie import SimpleCookie as SimpleCookie, parse_cookie as parse_cookie
|
||||
|
||||
@@ -4,88 +4,49 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
|
||||
from django.http.request import QueryDict
|
||||
from django.utils.datastructures import ImmutableList, MultiValueDict
|
||||
|
||||
|
||||
class MultiPartParserError(Exception): ...
|
||||
|
||||
|
||||
class InputStreamExhausted(Exception): ...
|
||||
|
||||
|
||||
class MultiPartParser:
|
||||
def __init__(
|
||||
self,
|
||||
META: Dict[str, Any],
|
||||
input_data: BytesIO,
|
||||
upload_handlers: Union[List[Any], ImmutableList],
|
||||
encoding: Optional[str] = ...,
|
||||
self,
|
||||
META: Dict[str, Any],
|
||||
input_data: BytesIO,
|
||||
upload_handlers: Union[List[Any], ImmutableList],
|
||||
encoding: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
|
||||
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||
|
||||
def handle_file_complete(
|
||||
self, old_field_name: str, counters: List[int]
|
||||
) -> None: ...
|
||||
|
||||
def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ...
|
||||
def IE_sanitize(self, filename: str) -> str: ...
|
||||
|
||||
|
||||
class LazyStream:
|
||||
length: None = ...
|
||||
position: int = ...
|
||||
|
||||
def __init__(
|
||||
self, producer: Union[BoundaryIter, ChunkIter], length: None = ...
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, producer: Union[BoundaryIter, ChunkIter], length: None = ...) -> None: ...
|
||||
def tell(self): ...
|
||||
|
||||
def read(self, size: Optional[int] = ...) -> bytes: ...
|
||||
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
|
||||
def __iter__(self) -> LazyStream: ...
|
||||
|
||||
def unget(self, bytes: bytes) -> None: ...
|
||||
|
||||
|
||||
class ChunkIter:
|
||||
flo: BytesIO = ...
|
||||
chunk_size: int = ...
|
||||
|
||||
def __init__(
|
||||
self, flo: BytesIO, chunk_size: int = ...
|
||||
) -> None: ...
|
||||
|
||||
def __init__(self, flo: BytesIO, chunk_size: int = ...) -> None: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
def __iter__(self): ...
|
||||
|
||||
|
||||
class InterBoundaryIter:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
|
||||
def __iter__(self) -> InterBoundaryIter: ...
|
||||
|
||||
def __next__(self) -> LazyStream: ...
|
||||
|
||||
|
||||
class BoundaryIter:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
|
||||
def __iter__(self): ...
|
||||
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
|
||||
class Parser:
|
||||
def __init__(self, stream: LazyStream, boundary: bytes) -> None: ...
|
||||
|
||||
def __iter__(
|
||||
self
|
||||
) -> Iterator[
|
||||
Tuple[
|
||||
str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream
|
||||
]
|
||||
]: ...
|
||||
def __iter__(self) -> Iterator[Tuple[str, Dict[str, Tuple[str, Dict[str, Union[bytes, str]]]], LazyStream]]: ...
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import (Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern,
|
||||
Tuple, Union)
|
||||
from typing import Any, BinaryIO, Dict, Iterable, Iterator, List, Optional, overload, Pattern, Tuple, Union
|
||||
|
||||
from django.core.files import uploadhandler, uploadedfile
|
||||
from django.utils.datastructures import MultiValueDict, ImmutableList
|
||||
@@ -15,8 +14,7 @@ host_validation_re = ... # type: Pattern
|
||||
class UnreadablePostError(IOError): ...
|
||||
class RawPostDataException(Exception): ...
|
||||
|
||||
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler],
|
||||
ImmutableList[uploadhandler.FileUploadHandler]]
|
||||
UploadHandlerList = Union[List[uploadhandler.FileUploadHandler], ImmutableList[uploadhandler.FileUploadHandler]]
|
||||
|
||||
class HttpRequest(BinaryIO):
|
||||
GET = ... # type: QueryDict
|
||||
@@ -33,17 +31,19 @@ class HttpRequest(BinaryIO):
|
||||
def __init__(self) -> None: ...
|
||||
def get_host(self) -> str: ...
|
||||
def get_port(self) -> str: ...
|
||||
def get_full_path(self, force_append_slash: bool=False) -> str: ...
|
||||
def get_signed_cookie(self, key: str, default: str=..., salt: str='', max_age: int=None) -> str: ...
|
||||
def get_full_path(self, force_append_slash: bool = False) -> str: ...
|
||||
def get_signed_cookie(self, key: str, default: str = ..., salt: str = "", max_age: int = None) -> str: ...
|
||||
def get_raw_uri(self) -> str: ...
|
||||
def build_absolute_uri(self, location: str=None) -> str: ...
|
||||
def build_absolute_uri(self, location: str = None) -> str: ...
|
||||
@property
|
||||
def scheme(self) -> str: ...
|
||||
def is_secure(self) -> bool: ...
|
||||
def is_ajax(self) -> bool: ...
|
||||
encoding = ... # type: Optional[str]
|
||||
upload_handlers = ... # type: UploadHandlerList
|
||||
def parse_file_upload(self, META: Dict[str, str], post_data: BinaryIO) -> Tuple['QueryDict', MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
||||
encoding = ... # type: Optional[str]
|
||||
upload_handlers = ... # type: UploadHandlerList
|
||||
def parse_file_upload(
|
||||
self, META: Dict[str, str], post_data: BinaryIO
|
||||
) -> Tuple["QueryDict", MultiValueDict[str, uploadedfile.UploadedFile]]: ...
|
||||
@property
|
||||
def body(self) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -55,20 +55,22 @@ class HttpRequest(BinaryIO):
|
||||
|
||||
class QueryDict(MultiValueDict[str, str]):
|
||||
encoding = str # type: Any
|
||||
def __init__(self, query_string: Union[str, bytes, None]=None, mutable: bool=False, encoding: Optional[str]=None) -> None: ...
|
||||
def __init__(
|
||||
self, query_string: Union[str, bytes, None] = None, mutable: bool = False, encoding: Optional[str] = None
|
||||
) -> None: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def __delitem__(self, key: str) -> None: ...
|
||||
def __copy__(self) -> 'QueryDict': ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> 'QueryDict': ...
|
||||
def __copy__(self) -> "QueryDict": ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> "QueryDict": ...
|
||||
def setlist(self, key: str, list_: List[str]) -> None: ...
|
||||
def setlistdefault(self, key: str, default_list: List[str]=None) -> List[str]: ...
|
||||
def setlistdefault(self, key: str, default_list: List[str] = None) -> List[str]: ...
|
||||
def appendlist(self, key: str, value: str) -> None: ...
|
||||
def pop(self, key: str, default: List[str]=None) -> List[str]: ... # type: ignore
|
||||
def pop(self, key: str, default: List[str] = None) -> List[str]: ... # type: ignore
|
||||
def popitem(self) -> Tuple[str, str]: ...
|
||||
def clear(self) -> None: ...
|
||||
def setdefault(self, key: str, default: Optional[str]=None) -> str: ...
|
||||
def copy(self) -> 'QueryDict': ...
|
||||
def urlencode(self, safe: Optional[str]=None) -> str: ...
|
||||
def setdefault(self, key: str, default: Optional[str] = None) -> str: ...
|
||||
def copy(self) -> "QueryDict": ...
|
||||
def urlencode(self, safe: Optional[str] = None) -> str: ...
|
||||
|
||||
@overload
|
||||
def bytes_to_text(s: bytes, encoding: str) -> str: ...
|
||||
|
||||
@@ -13,9 +13,9 @@ class HttpResponseBase(six.Iterator):
|
||||
status_code = ... # type: int
|
||||
cookies = ... # type: SimpleCookie
|
||||
closed = ... # type: bool
|
||||
reason_phrase = ... # type: str
|
||||
charset = ... # type: str
|
||||
def __init__(self, content_type: str=None, status: int=None, reason: str=None, charset: str=None) -> None: ...
|
||||
reason_phrase = ... # type: str
|
||||
charset = ... # type: str
|
||||
def __init__(self, content_type: str = None, status: int = None, reason: str = None, charset: str = None) -> None: ...
|
||||
def serialize_headers(self) -> bytes: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def __setitem__(self, header: str, value: Union[str, bytes]) -> None: ...
|
||||
@@ -28,10 +28,20 @@ class HttpResponseBase(six.Iterator):
|
||||
def get(self, header: str, alternate: str) -> str: ...
|
||||
@overload
|
||||
def get(self, header: str) -> Optional[str]: ...
|
||||
def set_cookie(self, key: str, value: str='', max_age: int=None, expires: Union[str, datetime.datetime]=None, path: str='', domain: str=None, secure: bool=False, httponly: bool=False) -> None: ...
|
||||
def set_cookie(
|
||||
self,
|
||||
key: str,
|
||||
value: str = "",
|
||||
max_age: int = None,
|
||||
expires: Union[str, datetime.datetime] = None,
|
||||
path: str = "",
|
||||
domain: str = None,
|
||||
secure: bool = False,
|
||||
httponly: bool = False,
|
||||
) -> None: ...
|
||||
def setdefault(self, key: str, value: str) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str='', **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str='', domain: str=None) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: str = None) -> None: ...
|
||||
def make_bytes(self, value: object) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: object) -> None: ...
|
||||
@@ -44,7 +54,7 @@ class HttpResponseBase(six.Iterator):
|
||||
|
||||
class HttpResponse(HttpResponseBase):
|
||||
streaming = ... # type: bool
|
||||
def __init__(self, content: object=b'', *args: Any, **kwargs: Any) -> None: ...
|
||||
def __init__(self, content: object = b"", *args: Any, **kwargs: Any) -> None: ...
|
||||
def serialize(self) -> bytes: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
@@ -54,7 +64,7 @@ class HttpResponse(HttpResponseBase):
|
||||
def getvalue(self) -> bytes: ...
|
||||
|
||||
class StreamingHttpResponse(HttpResponseBase):
|
||||
def __init__(self, streaming_content: Iterable[bytes]=..., *args: Any, **kwargs: Any) -> None: ...
|
||||
def __init__(self, streaming_content: Iterable[bytes] = ..., *args: Any, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
@property
|
||||
@@ -73,26 +83,28 @@ class HttpResponseRedirectBase(HttpResponse):
|
||||
def url(self) -> str: ...
|
||||
|
||||
class HttpResponseRedirect(HttpResponseRedirectBase): ...
|
||||
|
||||
class HttpResponsePermanentRedirect(HttpResponseRedirectBase): ...
|
||||
|
||||
class HttpResponseNotModified(HttpResponse):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class HttpResponseBadRequest(HttpResponse): ...
|
||||
|
||||
class HttpResponseNotFound(HttpResponse): ...
|
||||
|
||||
class HttpResponseForbidden(HttpResponse): ...
|
||||
|
||||
class HttpResponseNotAllowed(HttpResponse):
|
||||
def __init__(self, permitted_methods: Iterable[str], *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class HttpResponseGone(HttpResponse): ...
|
||||
|
||||
class HttpResponseServerError(HttpResponse): ...
|
||||
|
||||
class Http404(Exception): ...
|
||||
|
||||
class JsonResponse(HttpResponse):
|
||||
def __init__(self, data: object, encoder: Type[JSONEncoder]=..., safe: bool=True, json_dumps_params: Dict[str, Any]=None, **kwargs: Any) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
data: object,
|
||||
encoder: Type[JSONEncoder] = ...,
|
||||
safe: bool = True,
|
||||
json_dumps_params: Dict[str, Any] = None,
|
||||
**kwargs: Any
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
from .base import reverse as reverse
|
||||
|
||||
from .conf import (include as include,
|
||||
path as path,
|
||||
re_path as re_path)
|
||||
from .conf import include as include, path as path, re_path as re_path
|
||||
|
||||
from .resolvers import (ResolverMatch as ResolverMatch,
|
||||
get_ns_resolver as get_ns_resolver,
|
||||
get_resolver as get_resolver)
|
||||
from .resolvers import ResolverMatch as ResolverMatch, get_ns_resolver as get_ns_resolver, get_resolver as get_resolver
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .converters import (
|
||||
register_converter as register_converter
|
||||
)
|
||||
from .converters import register_converter as register_converter
|
||||
|
||||
@@ -3,17 +3,12 @@ from uuid import UUID
|
||||
|
||||
from django.urls.resolvers import ResolverMatch
|
||||
|
||||
|
||||
def resolve(path: str, urlconf: Optional[str] = ...) -> ResolverMatch: ...
|
||||
def reverse(
|
||||
viewname: Optional[Union[Callable, str]],
|
||||
urlconf: Optional[str] = ...,
|
||||
args: Optional[Union[List[UUID], Tuple]] = ...,
|
||||
kwargs: Optional[
|
||||
Union[
|
||||
Dict[str, None], Dict[str, bytes], Dict[str, str], Dict[str, UUID]
|
||||
]
|
||||
] = ...,
|
||||
kwargs: Optional[Union[Dict[str, None], Dict[str, bytes], Dict[str, str], Dict[str, UUID]]] = ...,
|
||||
current_app: Optional[str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
|
||||
@@ -2,19 +2,10 @@ from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
|
||||
from .resolvers import URLPattern, URLResolver
|
||||
|
||||
|
||||
def include(
|
||||
arg: Union[
|
||||
List[Tuple[str, Callable]],
|
||||
List[URLPattern],
|
||||
List[URLResolver],
|
||||
Tuple[List[URLResolver], str],
|
||||
str,
|
||||
],
|
||||
arg: Union[List[Tuple[str, Callable]], List[URLPattern], List[URLResolver], Tuple[List[URLResolver], str], str],
|
||||
namespace: Optional[str] = ...,
|
||||
) -> Union[
|
||||
Tuple[List[Any], str, str], Tuple[List[URLResolver], None, None]
|
||||
]: ...
|
||||
) -> Union[Tuple[List[Any], str, str], Tuple[List[URLResolver], None, None]]: ...
|
||||
|
||||
path: Any
|
||||
re_path: Any
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Any, Dict, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class IntConverter:
|
||||
regex: str = ...
|
||||
def to_python(self, value: str) -> int: ...
|
||||
@@ -27,9 +26,5 @@ DEFAULT_CONVERTERS: Any
|
||||
REGISTERED_CONVERTERS: Any
|
||||
|
||||
def register_converter(converter: Type[Any], type_name: str) -> None: ...
|
||||
def get_converters() -> Dict[
|
||||
str, Union[IntConverter, StringConverter, UUIDConverter]
|
||||
]: ...
|
||||
def get_converter(
|
||||
raw_converter: str
|
||||
) -> Union[IntConverter, StringConverter, UUIDConverter]: ...
|
||||
def get_converters() -> Dict[str, Union[IntConverter, StringConverter, UUIDConverter]]: ...
|
||||
def get_converter(raw_converter: str) -> Union[IntConverter, StringConverter, UUIDConverter]: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from django.http import Http404
|
||||
|
||||
|
||||
class Resolver404(Http404):
|
||||
pass
|
||||
|
||||
|
||||
class NoReverseMatch(Exception):
|
||||
pass
|
||||
|
||||
@@ -3,7 +3,6 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
from django.urls.converters import UUIDConverter
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
|
||||
class ResolverMatch:
|
||||
func: Callable = ...
|
||||
args: Tuple = ...
|
||||
@@ -25,19 +24,13 @@ class ResolverMatch:
|
||||
) -> None: ...
|
||||
def __getitem__(self, index: int) -> Any: ...
|
||||
|
||||
def get_resolver(
|
||||
urlconf: Optional[Union[Type[Any], str]] = ...
|
||||
) -> URLResolver: ...
|
||||
def get_ns_resolver(
|
||||
ns_pattern: str, resolver: URLResolver, converters: Tuple
|
||||
) -> URLResolver: ...
|
||||
def get_resolver(urlconf: Optional[Union[Type[Any], str]] = ...) -> URLResolver: ...
|
||||
def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: Tuple) -> URLResolver: ...
|
||||
|
||||
class LocaleRegexDescriptor:
|
||||
attr: str = ...
|
||||
def __init__(self, attr: Any) -> None: ...
|
||||
def __get__(
|
||||
self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...
|
||||
) -> LocaleRegexDescriptor: ...
|
||||
def __get__(self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...) -> LocaleRegexDescriptor: ...
|
||||
|
||||
class CheckURLMixin:
|
||||
def describe(self) -> str: ...
|
||||
@@ -46,24 +39,16 @@ class RegexPattern(CheckURLMixin):
|
||||
regex: Any = ...
|
||||
name: Optional[str] = ...
|
||||
converters: Dict[Any, Any] = ...
|
||||
def __init__(
|
||||
self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
||||
) -> None: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ...
|
||||
def __init__(self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
|
||||
class RoutePattern(CheckURLMixin):
|
||||
regex: Any = ...
|
||||
name: Optional[str] = ...
|
||||
converters: Dict[str, UUIDConverter] = ...
|
||||
def __init__(
|
||||
self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
||||
) -> None: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ...
|
||||
def __init__(self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
|
||||
class LocalePrefixPattern:
|
||||
@@ -74,9 +59,7 @@ class LocalePrefixPattern:
|
||||
def regex(self): ...
|
||||
@property
|
||||
def language_prefix(self) -> str: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||
def check(self) -> List[Any]: ...
|
||||
def describe(self) -> str: ...
|
||||
|
||||
@@ -87,11 +70,7 @@ class URLPattern:
|
||||
default_args: Optional[Dict[str, str]] = ...
|
||||
name: Optional[str] = ...
|
||||
def __init__(
|
||||
self,
|
||||
pattern: Any,
|
||||
callback: Callable,
|
||||
default_args: Optional[Dict[str, str]] = ...,
|
||||
name: Optional[str] = ...,
|
||||
self, pattern: Any, callback: Callable, default_args: Optional[Dict[str, str]] = ..., name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
def resolve(self, path: str) -> Optional[ResolverMatch]: ...
|
||||
@@ -109,9 +88,7 @@ class URLResolver:
|
||||
self,
|
||||
pattern: Any,
|
||||
urlconf_name: Optional[str],
|
||||
default_kwargs: Optional[
|
||||
Union[Dict[str, Dict[Any, Any]], Dict[str, str]]
|
||||
] = ...,
|
||||
default_kwargs: Optional[Union[Dict[str, Dict[Any, Any]], Dict[str, str]]] = ...,
|
||||
app_name: Optional[str] = ...,
|
||||
namespace: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@@ -122,11 +99,7 @@ class URLResolver:
|
||||
@property
|
||||
def app_dict(self) -> Dict[str, List[str]]: ...
|
||||
def resolve(self, path: str) -> ResolverMatch: ...
|
||||
def urlconf_module(
|
||||
self
|
||||
) -> Optional[Union[List[Tuple[str, Callable]], Type[Any]]]: ...
|
||||
def urlconf_module(self) -> Optional[Union[List[Tuple[str, Callable]], Type[Any]]]: ...
|
||||
def url_patterns(self) -> List[Tuple[str, Callable]]: ...
|
||||
def resolve_error_handler(
|
||||
self, view_type: int
|
||||
) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
from typing import Callable, Tuple, Union
|
||||
|
||||
|
||||
def get_callable(lookup_view: Union[Callable, str]) -> Callable: ...
|
||||
|
||||
|
||||
def get_mod_func(callback: str) -> Tuple[str, str]: ...
|
||||
|
||||
@@ -14,13 +14,7 @@ class BaseConverter:
|
||||
def __init__(self, digits: str, sign: str = ...) -> None: ...
|
||||
def encode(self, i: int) -> str: ...
|
||||
def decode(self, s: str) -> int: ...
|
||||
def convert(
|
||||
self,
|
||||
number: Union[int, str],
|
||||
from_digits: str,
|
||||
to_digits: str,
|
||||
sign: str,
|
||||
) -> Tuple[int, str]: ...
|
||||
def convert(self, number: Union[int, str], from_digits: str, to_digits: str, sign: str) -> Tuple[int, str]: ...
|
||||
|
||||
base2: Any
|
||||
base16: Any
|
||||
|
||||
@@ -2,15 +2,30 @@
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from typing import (Any, Callable, Dict, Generic, Iterable, Iterator, List, Mapping,
|
||||
MutableMapping, MutableSet, Optional, overload, Tuple, TypeVar, Union)
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Generic,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
MutableSet,
|
||||
Optional,
|
||||
overload,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
|
||||
KT = TypeVar('KT')
|
||||
VT = TypeVar('VT')
|
||||
KT = TypeVar("KT")
|
||||
VT = TypeVar("VT")
|
||||
|
||||
class OrderedSet(MutableSet[KT], Generic[KT]):
|
||||
dict = ... # type: OrderedDict[KT, None]
|
||||
def __init__(self, iterable: Iterable[KT]=None) -> None: ...
|
||||
dict = ... # type: OrderedDict[KT, None]
|
||||
def __init__(self, iterable: Iterable[KT] = None) -> None: ...
|
||||
def add(self, item: KT) -> None: ...
|
||||
def remove(self, item: KT) -> None: ...
|
||||
def discard(self, item: KT) -> None: ...
|
||||
@@ -21,26 +36,25 @@ class OrderedSet(MutableSet[KT], Generic[KT]):
|
||||
class MultiValueDictKeyError(KeyError): ...
|
||||
|
||||
class MultiValueDict(MutableMapping[KT, VT], Generic[KT, VT]):
|
||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[KT, List[VT]]]=...) -> None: ...
|
||||
def __copy__(self) -> 'MultiValueDict[KT, VT]': ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> 'MultiValueDict[KT, VT]': ...
|
||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[KT, List[VT]]] = ...) -> None: ...
|
||||
def __copy__(self) -> "MultiValueDict[KT, VT]": ...
|
||||
def __deepcopy__(self, memo: Dict[int, object]) -> "MultiValueDict[KT, VT]": ...
|
||||
def __getitem__(self, key: KT) -> Union[VT, List[VT]]: ... # type: ignore
|
||||
def pop(self, key: KT, default: List[VT]=None) -> List[VT]: ... # type: ignore
|
||||
def pop(self, key: KT, default: List[VT] = None) -> List[VT]: ... # type: ignore
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def __setstate__(self, obj_dict: Dict[str, Any]) -> None: ...
|
||||
def get(self, key: KT, default: VT=None) -> Union[Optional[VT], List[VT]]: ... # type: ignore
|
||||
def getlist(self, key: KT, default: List[VT]=None) -> List[VT]: ...
|
||||
def get(self, key: KT, default: VT = None) -> Union[Optional[VT], List[VT]]: ... # type: ignore
|
||||
def getlist(self, key: KT, default: List[VT] = None) -> List[VT]: ...
|
||||
def setlist(self, key: KT, list_: List[VT]) -> None: ...
|
||||
def setlistdefault(self, key: KT, default_list: List[VT]=None) -> List[VT]: ...
|
||||
def setlistdefault(self, key: KT, default_list: List[VT] = None) -> List[VT]: ...
|
||||
def appendlist(self, key: KT, value: VT) -> None: ...
|
||||
def lists(self) -> Iterable[Tuple[KT, List[VT]]]: ...
|
||||
def copy(self) -> 'MultiValueDict[KT, VT]': ...
|
||||
def copy(self) -> "MultiValueDict[KT, VT]": ...
|
||||
@overload # type: ignore
|
||||
def update(self, args: Mapping[KT, VT]) -> None: ...
|
||||
@overload
|
||||
def update(self, *args: Mapping[KT, VT], **kwargs: Iterable[Tuple[KT, VT]]) -> None: ... # type: ignore
|
||||
def dict(self) -> Dict[KT, Union[VT, List[VT]]]: ...
|
||||
|
||||
# These overrides are needed to convince mypy that this isn't an abstract class
|
||||
def __delitem__(self, k: KT) -> None: ...
|
||||
def __setitem__(self, k: KT, v: VT) -> None: ...
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
from django.db.models.base import Model
|
||||
|
||||
|
||||
def curry(_curried_func: Any, *args: Any, **kwargs: Any): ...
|
||||
|
||||
class cached_property:
|
||||
@@ -52,6 +51,4 @@ class SimpleLazyObject(LazyObject):
|
||||
def __copy__(self) -> List[int]: ...
|
||||
def __deepcopy__(self, memo: Dict[Any, Any]) -> List[int]: ...
|
||||
|
||||
def partition(
|
||||
predicate: Callable, values: List[Model]
|
||||
) -> Tuple[List[Model], List[Model]]: ...
|
||||
def partition(predicate: Callable, values: List[Model]) -> Tuple[List[Model], List[Model]]: ...
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
class SafeData:
|
||||
def __html__(self) -> SafeText: ...
|
||||
|
||||
|
||||
class SafeBytes(bytes, SafeData):
|
||||
def __add__(self, rhs: Any): ...
|
||||
|
||||
|
||||
class SafeText(str, SafeData):
|
||||
def __add__(self, rhs: str) -> str: ...
|
||||
|
||||
|
||||
SafeString = SafeText
|
||||
|
||||
|
||||
def mark_safe(s: Any) -> Any: ...
|
||||
|
||||
@@ -10,7 +10,7 @@ class UTC(tzinfo):
|
||||
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
|
||||
class FixedOffset(tzinfo):
|
||||
def __init__(self, offset: int=None, name: str=None) -> None: ...
|
||||
def __init__(self, offset: int = None, name: str = None) -> None: ...
|
||||
def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
def tzname(self, dt: Optional[datetime]) -> str: ...
|
||||
def dst(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
@@ -44,9 +44,9 @@ class override(ContextDecorator):
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
|
||||
|
||||
def localtime(value: datetime, timezone: tzinfo=None) -> datetime: ...
|
||||
def localtime(value: datetime, timezone: tzinfo = None) -> datetime: ...
|
||||
def now() -> datetime: ...
|
||||
def is_aware(value: datetime) -> bool: ...
|
||||
def is_naive(value: datetime) -> bool: ...
|
||||
def make_aware(value: datetime, timezone: tzinfo=None, is_dst: bool=None) -> datetime: ...
|
||||
def make_naive(value: datetime, timezone: tzinfo=None) -> datetime: ...
|
||||
def make_aware(value: datetime, timezone: tzinfo = None, is_dst: bool = None) -> datetime: ...
|
||||
def make_naive(value: datetime, timezone: tzinfo = None) -> datetime: ...
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from django.views.generic.base import View
|
||||
|
||||
__all__ = ['View']
|
||||
__all__ = ["View"]
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
from django.views.generic.base import RedirectView as RedirectView, TemplateView as TemplateView, View as View
|
||||
from django.views.generic.dates import ArchiveIndexView as ArchiveIndexView, DateDetailView as DateDetailView, DayArchiveView as DayArchiveView, MonthArchiveView as MonthArchiveView, TodayArchiveView as TodayArchiveView, WeekArchiveView as WeekArchiveView, YearArchiveView as YearArchiveView
|
||||
from django.views.generic.dates import (
|
||||
ArchiveIndexView as ArchiveIndexView,
|
||||
DateDetailView as DateDetailView,
|
||||
DayArchiveView as DayArchiveView,
|
||||
MonthArchiveView as MonthArchiveView,
|
||||
TodayArchiveView as TodayArchiveView,
|
||||
WeekArchiveView as WeekArchiveView,
|
||||
YearArchiveView as YearArchiveView,
|
||||
)
|
||||
from django.views.generic.detail import DetailView as DetailView
|
||||
from django.views.generic.edit import CreateView as CreateView, DeleteView as DeleteView, FormView as FormView, UpdateView as UpdateView
|
||||
from django.views.generic.edit import (
|
||||
CreateView as CreateView,
|
||||
DeleteView as DeleteView,
|
||||
FormView as FormView,
|
||||
UpdateView as UpdateView,
|
||||
)
|
||||
from django.views.generic.list import ListView as ListView
|
||||
|
||||
class GenericViewError(Exception): ...
|
||||
|
||||
@@ -66,7 +66,9 @@ class BaseDateListView(MultipleObjectMixin, DateMixin, View):
|
||||
def get_ordering(self) -> Sequence[str]: ...
|
||||
def get_dated_queryset(self, **lookup: object) -> models.query.QuerySet: ...
|
||||
def get_date_list_period(self) -> str: ...
|
||||
def get_date_list(self, queryset: models.query.QuerySet, date_type: str = None, ordering: str = ...) -> models.query.QuerySet: ...
|
||||
def get_date_list(
|
||||
self, queryset: models.query.QuerySet, date_type: str = None, ordering: str = ...
|
||||
) -> models.query.QuerySet: ...
|
||||
|
||||
class BaseArchiveIndexView(BaseDateListView):
|
||||
context_object_name = ... # type: str
|
||||
@@ -110,7 +112,7 @@ class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView
|
||||
template_name_suffix = ... # type: str
|
||||
|
||||
class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView):
|
||||
def get_object(self, queryset: models.query.QuerySet=None) -> models.Model: ...
|
||||
def get_object(self, queryset: models.query.QuerySet = None) -> models.Model: ...
|
||||
|
||||
class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView):
|
||||
template_name_suffix = ... # type: str
|
||||
|
||||
@@ -19,12 +19,13 @@ class MultipleObjectMixin(ContextMixin):
|
||||
request = ... # type: HttpRequest
|
||||
kwargs = ... # type: Dict[str, object]
|
||||
object_list = ... # type: QuerySet
|
||||
|
||||
def get_queryset(self) -> QuerySet: ...
|
||||
def get_ordering(self) -> Sequence[str]: ...
|
||||
def paginate_queryset(self, queryset: QuerySet, page_size: int) -> Tuple[Paginator, int, QuerySet, bool]: ...
|
||||
def get_paginate_by(self, queryset: QuerySet) -> Optional[int]: ...
|
||||
def get_paginator(self, queryset: QuerySet, per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., **kwargs: Any) -> Paginator: ...
|
||||
def get_paginator(
|
||||
self, queryset: QuerySet, per_page: int, orphans: int = ..., allow_empty_first_page: bool = ..., **kwargs: Any
|
||||
) -> Paginator: ...
|
||||
def get_paginate_orphans(self) -> int: ...
|
||||
def get_allow_empty(self) -> bool: ...
|
||||
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
||||
|
||||
Reference in New Issue
Block a user