mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 12:14:28 +08:00
first version finished
This commit is contained in:
119
django/urls/resolvers.pyi
Normal file
119
django/urls/resolvers.pyi
Normal file
@@ -0,0 +1,119 @@
|
||||
from django.core.checks.messages import (
|
||||
Error,
|
||||
Warning,
|
||||
)
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _route_to_regex(route: str, is_endpoint: bool = ...) -> Any: ...
|
||||
|
||||
|
||||
def get_ns_resolver(
|
||||
ns_pattern: str,
|
||||
resolver: URLResolver,
|
||||
converters: Tuple
|
||||
) -> URLResolver: ...
|
||||
|
||||
|
||||
def get_resolver(urlconf: Optional[Union[str, Type[object]]] = ...) -> URLResolver: ...
|
||||
|
||||
|
||||
class CheckURLMixin:
|
||||
def _check_pattern_startswith_slash(self) -> List[Any]: ...
|
||||
def describe(self) -> str: ...
|
||||
|
||||
|
||||
class LocalePrefixPattern:
|
||||
def __init__(self, prefix_default_language: bool = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def describe(self) -> str: ...
|
||||
@property
|
||||
def language_prefix(self) -> str: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||
|
||||
|
||||
class RegexPattern:
|
||||
def __init__(self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _check_include_trailing_dollar(self) -> List[Any]: ...
|
||||
def _compile(self, regex: str): ...
|
||||
def check(self) -> List[Any]: ...
|
||||
def match(self, path: str) -> Any: ...
|
||||
|
||||
|
||||
class ResolverMatch:
|
||||
def __getitem__(self, index: int) -> Any: ...
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable,
|
||||
args: Tuple,
|
||||
kwargs: Dict[str, Any],
|
||||
url_name: Optional[str] = ...,
|
||||
app_names: Optional[Union[List[str], List[Union[None, str]], List[None]]] = ...,
|
||||
namespaces: Optional[Union[List[str], List[Union[None, str]], List[None]]] = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
|
||||
class RoutePattern:
|
||||
def __init__(self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
def match(self, path: str) -> Any: ...
|
||||
|
||||
|
||||
class URLPattern:
|
||||
def __init__(
|
||||
self,
|
||||
pattern: CheckURLMixin,
|
||||
callback: Callable,
|
||||
default_args: Any = ...,
|
||||
name: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _check_pattern_name(self) -> List[Any]: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
@cached_property
|
||||
def lookup_str(self) -> str: ...
|
||||
def resolve(self, path: str) -> Optional[ResolverMatch]: ...
|
||||
|
||||
|
||||
class URLResolver:
|
||||
def __init__(
|
||||
self,
|
||||
pattern: Union[LocalePrefixPattern, CheckURLMixin],
|
||||
urlconf_name: Any,
|
||||
default_kwargs: None = ...,
|
||||
app_name: Optional[str] = ...,
|
||||
namespace: Optional[str] = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _is_callback(self, name: str) -> bool: ...
|
||||
def _populate(self) -> None: ...
|
||||
def _reverse_with_prefix(self, lookup_view: Optional[str], _prefix: str, *args, **kwargs) -> str: ...
|
||||
@property
|
||||
def app_dict(self) -> Dict[str, List[str]]: ...
|
||||
def check(self) -> Union[List[Warning], List[Error]]: ...
|
||||
@property
|
||||
def namespace_dict(self) -> Dict[str, Tuple[str, URLResolver]]: ...
|
||||
def resolve(self, path: str) -> ResolverMatch: ...
|
||||
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||
def reverse(self, lookup_view: str, *args, **kwargs) -> str: ...
|
||||
@property
|
||||
def reverse_dict(self) -> MultiValueDict: ...
|
||||
@cached_property
|
||||
def url_patterns(
|
||||
self
|
||||
) -> Union[List[URLResolver], List[Union[URLPattern, URLResolver]], List[URLPattern], List[Tuple[str, Callable]]]: ...
|
||||
@cached_property
|
||||
def urlconf_module(self) -> Any: ...
|
||||
11
django/urls/utils.pyi
Normal file
11
django/urls/utils.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_callable(lookup_view: Union[str, Callable]) -> Callable: ...
|
||||
|
||||
|
||||
def get_mod_func(callback: str) -> Tuple[str, str]: ...
|
||||
4
django/utils/_os.pyi
Normal file
4
django/utils/_os.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
def safe_join(base: str, *paths) -> str: ...
|
||||
|
||||
|
||||
def symlinks_supported(): ...
|
||||
38
django/utils/archive.pyi
Normal file
38
django/utils/archive.pyi
Normal file
@@ -0,0 +1,38 @@
|
||||
from typing import (
|
||||
List,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def extract(path: str, to_path: str = ...) -> None: ...
|
||||
|
||||
|
||||
class Archive:
|
||||
def __enter__(self) -> Archive: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(self, file: str) -> None: ...
|
||||
@staticmethod
|
||||
def _archive_cls(file: str) -> Type[BaseArchive]: ...
|
||||
def close(self) -> None: ...
|
||||
def extract(self, to_path: str = ...) -> None: ...
|
||||
|
||||
|
||||
class BaseArchive:
|
||||
@staticmethod
|
||||
def _copy_permissions(mode: int, filename: str) -> None: ...
|
||||
def has_leading_dir(self, paths: List[str]) -> bool: ...
|
||||
def split_leading_dir(self, path: str) -> Union[List[str], Tuple[str, str]]: ...
|
||||
|
||||
|
||||
class TarArchive:
|
||||
def __init__(self, file: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def extract(self, to_path: str) -> None: ...
|
||||
|
||||
|
||||
class ZipArchive:
|
||||
def __init__(self, file: str) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def extract(self, to_path: str) -> None: ...
|
||||
18
django/utils/autoreload.pyi
Normal file
18
django/utils/autoreload.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def check_errors(fn: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def clean_files(filelist: Union[List[Union[None, bool]], List[str], List[Union[None, str]]]) -> List[str]: ...
|
||||
|
||||
|
||||
def gen_filenames(only_new: bool = ...) -> List[str]: ...
|
||||
|
||||
|
||||
def reset_translations() -> None: ...
|
||||
10
django/utils/baseconv.pyi
Normal file
10
django/utils/baseconv.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import (
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseConverter:
|
||||
def convert(self, number: Union[str, int], from_digits: str, to_digits: str, sign: str) -> Tuple[int, str]: ...
|
||||
def decode(self, s: str) -> int: ...
|
||||
def encode(self, i: int) -> str: ...
|
||||
101
django/utils/cache.pyi
Normal file
101
django/utils/cache.pyi
Normal file
@@ -0,0 +1,101 @@
|
||||
from django.core.cache import DefaultCacheProxy
|
||||
from django.core.cache.backends.locmem import LocMemCache
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import (
|
||||
HttpResponse,
|
||||
HttpResponseBase,
|
||||
HttpResponseNotModified,
|
||||
)
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _generate_cache_header_key(key_prefix: str, request: WSGIRequest) -> str: ...
|
||||
|
||||
|
||||
def _generate_cache_key(
|
||||
request: WSGIRequest,
|
||||
method: str,
|
||||
headerlist: List[str],
|
||||
key_prefix: str
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def _i18n_cache_key_suffix(request: WSGIRequest, cache_key: str) -> str: ...
|
||||
|
||||
|
||||
def _if_match_passes(target_etag: Optional[str], etags: List[str]) -> bool: ...
|
||||
|
||||
|
||||
def _if_modified_since_passes(last_modified: Optional[int], if_modified_since: int) -> bool: ...
|
||||
|
||||
|
||||
def _if_none_match_passes(target_etag: Optional[str], etags: List[str]) -> bool: ...
|
||||
|
||||
|
||||
def _if_unmodified_since_passes(last_modified: int, if_unmodified_since: int) -> bool: ...
|
||||
|
||||
|
||||
def _not_modified(
|
||||
request: WSGIRequest,
|
||||
response: Optional[HttpResponse] = ...
|
||||
) -> HttpResponseNotModified: ...
|
||||
|
||||
|
||||
def _precondition_failed(request: WSGIRequest) -> HttpResponse: ...
|
||||
|
||||
|
||||
def _to_tuple(s: str) -> Union[Tuple[str, str], Tuple[str, bool]]: ...
|
||||
|
||||
|
||||
def add_never_cache_headers(response: HttpResponse) -> None: ...
|
||||
|
||||
|
||||
def get_cache_key(
|
||||
request: WSGIRequest,
|
||||
key_prefix: Optional[str] = ...,
|
||||
method: str = ...,
|
||||
cache: Optional[Union[DefaultCacheProxy, backends.locmem.LocMemCache]] = ...
|
||||
) -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_conditional_response(
|
||||
request: WSGIRequest,
|
||||
etag: Optional[str] = ...,
|
||||
last_modified: Optional[int] = ...,
|
||||
response: Optional[HttpResponse] = ...
|
||||
) -> Optional[HttpResponse]: ...
|
||||
|
||||
|
||||
def get_max_age(response: HttpResponse) -> Optional[int]: ...
|
||||
|
||||
|
||||
def has_vary_header(response: HttpResponse, header_query: str) -> bool: ...
|
||||
|
||||
|
||||
def learn_cache_key(
|
||||
request: WSGIRequest,
|
||||
response: HttpResponse,
|
||||
cache_timeout: Optional[Union[float, int]] = ...,
|
||||
key_prefix: Optional[str] = ...,
|
||||
cache: Optional[Union[DefaultCacheProxy, backends.locmem.LocMemCache]] = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def patch_cache_control(response: HttpResponseBase, **kwargs) -> None: ...
|
||||
|
||||
|
||||
def patch_response_headers(response: HttpResponse, cache_timeout: int = ...) -> None: ...
|
||||
|
||||
|
||||
def patch_vary_headers(
|
||||
response: HttpResponseBase,
|
||||
newheaders: Union[Tuple[str], Tuple[str, str]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def set_response_etag(response: HttpResponse) -> HttpResponse: ...
|
||||
18
django/utils/crypto.pyi
Normal file
18
django/utils/crypto.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from hmac import HMAC
|
||||
from typing import (
|
||||
Callable,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def constant_time_compare(val1: Union[str, bytes], val2: Union[str, bytes]) -> bool: ...
|
||||
|
||||
|
||||
def get_random_string(length: int = ..., allowed_chars: str = ...) -> str: ...
|
||||
|
||||
|
||||
def pbkdf2(password: str, salt: str, iterations: int, dklen: int = ..., digest: Callable = ...) -> bytes: ...
|
||||
|
||||
|
||||
def salted_hmac(key_salt: str, value: Union[str, bytes], secret: Optional[Union[str, bytes]] = ...) -> HMAC: ...
|
||||
8
django/utils/datastructures.pyi
Normal file
8
django/utils/datastructures.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from typing import (
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class DictWrapper:
|
||||
def __getitem__(self, key: str) -> Optional[Union[str, int]]: ...
|
||||
52
django/utils/dateformat.pyi
Normal file
52
django/utils/dateformat.pyi
Normal file
@@ -0,0 +1,52 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
)
|
||||
from typing import Union
|
||||
|
||||
|
||||
def format(value: Union[time, str, date], format_string: str) -> str: ...
|
||||
|
||||
|
||||
def time_format(value: Union[date, time, str], format_string: str) -> str: ...
|
||||
|
||||
|
||||
class DateFormat:
|
||||
def I(self) -> str: ...
|
||||
def L(self) -> bool: ...
|
||||
def M(self) -> str: ...
|
||||
def S(self) -> str: ...
|
||||
def U(self) -> int: ...
|
||||
def Y(self) -> int: ...
|
||||
def c(self) -> str: ...
|
||||
def d(self) -> str: ...
|
||||
def j(self) -> int: ...
|
||||
def m(self) -> str: ...
|
||||
def n(self) -> int: ...
|
||||
def o(self) -> int: ...
|
||||
def r(self) -> str: ...
|
||||
def t(self) -> str: ...
|
||||
def y(self) -> str: ...
|
||||
|
||||
|
||||
class Formatter:
|
||||
def format(self, formatstr: str) -> str: ...
|
||||
|
||||
|
||||
class TimeFormat:
|
||||
def A(self) -> str: ...
|
||||
def G(self) -> int: ...
|
||||
def H(self) -> str: ...
|
||||
def O(self) -> str: ...
|
||||
def P(self) -> str: ...
|
||||
def T(self) -> str: ...
|
||||
def Z(self) -> Union[str, int]: ...
|
||||
def __init__(self, obj: Union[time, date, str]) -> None: ...
|
||||
def a(self) -> str: ...
|
||||
def e(self) -> str: ...
|
||||
def f(self) -> Union[str, int]: ...
|
||||
def g(self) -> int: ...
|
||||
def h(self) -> str: ...
|
||||
def i(self) -> str: ...
|
||||
def s(self) -> str: ...
|
||||
def u(self) -> str: ...
|
||||
19
django/utils/dateparse.pyi
Normal file
19
django/utils/dateparse.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def parse_date(value: str) -> Optional[date]: ...
|
||||
|
||||
|
||||
def parse_datetime(value: str) -> datetime: ...
|
||||
|
||||
|
||||
def parse_duration(value: str) -> Optional[timedelta]: ...
|
||||
|
||||
|
||||
def parse_time(value: str) -> Optional[time]: ...
|
||||
28
django/utils/datetime_safe.pyi
Normal file
28
django/utils/datetime_safe.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
)
|
||||
from typing import (
|
||||
List,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _findall(text: str, substr: str) -> List[int]: ...
|
||||
|
||||
|
||||
def new_date(d: date) -> date: ...
|
||||
|
||||
|
||||
def new_datetime(d: datetime) -> datetime: ...
|
||||
|
||||
|
||||
def strftime(dt: Union[date, datetime], fmt: str) -> str: ...
|
||||
|
||||
|
||||
class date:
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
|
||||
|
||||
class datetime:
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
12
django/utils/deconstruct.pyi
Normal file
12
django/utils/deconstruct.pyi
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.contrib.postgres.validators import KeysValidator
|
||||
from django.core.validators import RegexValidator
|
||||
from typing import (
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def deconstructible(
|
||||
*args,
|
||||
path = ...
|
||||
) -> Type[Union[KeysValidator, RegexValidator]]: ...
|
||||
37
django/utils/decorators.pyi
Normal file
37
django/utils/decorators.pyi
Normal file
@@ -0,0 +1,37 @@
|
||||
from django.middleware.cache import CacheMiddleware
|
||||
from django.middleware.csrf import CsrfViewMiddleware
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _multi_decorate(decorators: Union[Tuple[Callable, Callable], Callable], method: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def _update_method_wrapper(_wrapper: Callable, decorator: Callable) -> None: ...
|
||||
|
||||
|
||||
def decorator_from_middleware(middleware_class: Type[CsrfViewMiddleware]) -> Callable: ...
|
||||
|
||||
|
||||
def decorator_from_middleware_with_args(middleware_class: Type[CacheMiddleware]) -> Callable: ...
|
||||
|
||||
|
||||
def make_middleware_decorator(middleware_class: Any) -> Callable: ...
|
||||
|
||||
|
||||
def method_decorator(decorator: Callable, name: str = ...) -> Callable: ...
|
||||
|
||||
|
||||
class classonlymethod:
|
||||
def __get__(self, instance: None, cls: Any = ...) -> Callable: ...
|
||||
|
||||
|
||||
class classproperty:
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> str: ...
|
||||
def __init__(self, method: Callable = ...) -> None: ...
|
||||
def getter(self, method: Callable) -> classproperty: ...
|
||||
23
django/utils/deprecation.pyi
Normal file
23
django/utils/deprecation.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import HttpResponseBase
|
||||
from typing import (
|
||||
Callable,
|
||||
Optional,
|
||||
Type,
|
||||
)
|
||||
|
||||
|
||||
class MiddlewareMixin:
|
||||
def __call__(self, request: WSGIRequest) -> HttpResponseBase: ...
|
||||
def __init__(self, get_response: Optional[Callable] = ...) -> None: ...
|
||||
|
||||
|
||||
class warn_about_renamed_method:
|
||||
def __call__(self, f: Callable) -> Callable: ...
|
||||
def __init__(
|
||||
self,
|
||||
class_name: str,
|
||||
old_method_name: str,
|
||||
new_method_name: str,
|
||||
deprecation_warning: Type[DeprecationWarning]
|
||||
) -> None: ...
|
||||
14
django/utils/duration.pyi
Normal file
14
django/utils/duration.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import timedelta
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
def _get_duration_components(duration: timedelta) -> Tuple[int, int, int, int, int]: ...
|
||||
|
||||
|
||||
def duration_iso_string(duration: timedelta) -> str: ...
|
||||
|
||||
|
||||
def duration_microseconds(delta: timedelta) -> int: ...
|
||||
|
||||
|
||||
def duration_string(duration: timedelta) -> str: ...
|
||||
46
django/utils/encoding.pyi
Normal file
46
django/utils/encoding.pyi
Normal file
@@ -0,0 +1,46 @@
|
||||
from datetime import date
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def escape_uri_path(path: str) -> str: ...
|
||||
|
||||
|
||||
def filepath_to_uri(path: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
|
||||
def force_bytes(
|
||||
s: Any,
|
||||
encoding: str = ...,
|
||||
strings_only: bool = ...,
|
||||
errors: str = ...
|
||||
) -> Union[date, bytes]: ...
|
||||
|
||||
|
||||
def force_text(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_system_encoding() -> str: ...
|
||||
|
||||
|
||||
def iri_to_uri(iri: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
|
||||
def is_protected_type(obj: Any) -> bool: ...
|
||||
|
||||
|
||||
def repercent_broken_unicode(path: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def smart_text(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ...
|
||||
|
||||
|
||||
def uri_to_iri(uri: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
|
||||
class DjangoUnicodeDecodeError:
|
||||
def __init__(self, obj: bytes, *args) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
96
django/utils/feedgenerator.pyi
Normal file
96
django/utils/feedgenerator.pyi
Normal file
@@ -0,0 +1,96 @@
|
||||
from io import StringIO
|
||||
from datetime import (
|
||||
date,
|
||||
datetime,
|
||||
)
|
||||
from django.http.response import HttpResponse
|
||||
from django.utils.safestring import SafeText
|
||||
from django.utils.xmlutils import SimplerXMLGenerator
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_tag_uri(url: str, date: datetime) -> str: ...
|
||||
|
||||
|
||||
def rfc2822_date(date: date) -> str: ...
|
||||
|
||||
|
||||
def rfc3339_date(date: datetime) -> str: ...
|
||||
|
||||
|
||||
class Atom1Feed:
|
||||
def add_item_elements(self, handler: SimplerXMLGenerator, item: Dict[str, Any]) -> None: ...
|
||||
def add_root_elements(self, handler: SimplerXMLGenerator) -> None: ...
|
||||
def root_attributes(self) -> Dict[str, str]: ...
|
||||
def write(self, outfile: Union[StringIO, HttpResponse], encoding: str) -> None: ...
|
||||
def write_items(self, handler: SimplerXMLGenerator) -> None: ...
|
||||
|
||||
|
||||
class Enclosure:
|
||||
def __init__(self, url: str, length: Union[str, int], mime_type: str) -> None: ...
|
||||
|
||||
|
||||
class Rss201rev2Feed:
|
||||
def add_item_elements(self, handler: SimplerXMLGenerator, item: Dict[str, Any]) -> None: ...
|
||||
|
||||
|
||||
class RssFeed:
|
||||
def add_root_elements(self, handler: SimplerXMLGenerator) -> None: ...
|
||||
def endChannelElement(self, handler: SimplerXMLGenerator) -> None: ...
|
||||
def rss_attributes(self) -> Dict[str, str]: ...
|
||||
def write(self, outfile: HttpResponse, encoding: str) -> None: ...
|
||||
def write_items(self, handler: SimplerXMLGenerator) -> None: ...
|
||||
|
||||
|
||||
class RssUserland091Feed:
|
||||
def add_item_elements(self, handler: SimplerXMLGenerator, item: Dict[str, Any]) -> None: ...
|
||||
|
||||
|
||||
class SyndicationFeed:
|
||||
def __init__(
|
||||
self,
|
||||
title: str,
|
||||
link: str,
|
||||
description: str,
|
||||
language: Optional[str] = ...,
|
||||
author_email: Optional[str] = ...,
|
||||
author_name: Optional[str] = ...,
|
||||
author_link: Optional[str] = ...,
|
||||
subtitle: Optional[str] = ...,
|
||||
categories: Optional[Tuple[str, str]] = ...,
|
||||
feed_url: Optional[str] = ...,
|
||||
feed_copyright: Optional[str] = ...,
|
||||
feed_guid: Optional[str] = ...,
|
||||
ttl: Optional[int] = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def add_item(
|
||||
self,
|
||||
title: SafeText,
|
||||
link: str,
|
||||
description: str,
|
||||
author_email: Optional[str] = ...,
|
||||
author_name: Optional[str] = ...,
|
||||
author_link: Optional[str] = ...,
|
||||
pubdate: Optional[datetime] = ...,
|
||||
comments: None = ...,
|
||||
unique_id: str = ...,
|
||||
unique_id_is_permalink: Optional[bool] = ...,
|
||||
categories: Optional[Tuple[str, str]] = ...,
|
||||
item_copyright: Optional[str] = ...,
|
||||
ttl: None = ...,
|
||||
updateddate: Optional[datetime] = ...,
|
||||
enclosures: List[Enclosure] = ...,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def item_attributes(self, item: Dict[str, Any]) -> Dict[Any, Any]: ...
|
||||
def latest_post_date(self) -> datetime: ...
|
||||
def root_attributes(self) -> Dict[Any, Any]: ...
|
||||
def writeString(self, encoding: str) -> str: ...
|
||||
59
django/utils/formats.pyi
Normal file
59
django/utils/formats.pyi
Normal file
@@ -0,0 +1,59 @@
|
||||
from datetime import (
|
||||
date,
|
||||
time,
|
||||
)
|
||||
from decimal import Decimal
|
||||
from typing import (
|
||||
Any,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def date_format(
|
||||
value: Union[time, date, str],
|
||||
format: Optional[str] = ...,
|
||||
use_l10n: Optional[bool] = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def get_format(
|
||||
format_type: str,
|
||||
lang: Optional[str] = ...,
|
||||
use_l10n: Optional[bool] = ...
|
||||
) -> Union[str, List[str], int]: ...
|
||||
|
||||
|
||||
def get_format_modules(lang: str = ..., reverse: bool = ...) -> List[Any]: ...
|
||||
|
||||
|
||||
def iter_format_modules(lang: str, format_module_path: Optional[str] = ...) -> Iterator[Any]: ...
|
||||
|
||||
|
||||
def localize(value: Any, use_l10n: Optional[bool] = ...) -> Any: ...
|
||||
|
||||
|
||||
def localize_input(value: Any, default: Optional[str] = ...) -> Optional[str]: ...
|
||||
|
||||
|
||||
def number_format(
|
||||
value: Union[Decimal, float, str, int],
|
||||
decimal_pos: Optional[int] = ...,
|
||||
use_l10n: Optional[bool] = ...,
|
||||
force_grouping: bool = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def reset_format_cache() -> None: ...
|
||||
|
||||
|
||||
def sanitize_separators(value: Union[str, int]) -> Union[str, int]: ...
|
||||
|
||||
|
||||
def time_format(
|
||||
value: Union[date, time, str],
|
||||
format: Optional[str] = ...,
|
||||
use_l10n: None = ...
|
||||
) -> str: ...
|
||||
24
django/utils/functional.pyi
Normal file
24
django/utils/functional.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
class LazyObject:
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __reduce__(self) -> Any: ...
|
||||
def __setattr__(self, name: str, value: object) -> None: ...
|
||||
|
||||
|
||||
class SimpleLazyObject:
|
||||
def __copy__(self) -> object: ...
|
||||
def __deepcopy__(self, memo: Dict[Any, Any]) -> List[int]: ...
|
||||
def __init__(self, func: Callable) -> None: ...
|
||||
def _setup(self) -> None: ...
|
||||
|
||||
|
||||
class cached_property:
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
|
||||
65
django/utils/html.pyi
Normal file
65
django/utils/html.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _strip_once(value: str) -> str: ...
|
||||
|
||||
|
||||
def avoid_wrapping(value: str) -> str: ...
|
||||
|
||||
|
||||
def conditional_escape(text: Any) -> str: ...
|
||||
|
||||
|
||||
def escape(text: Any) -> SafeText: ...
|
||||
|
||||
|
||||
def escapejs(value: str) -> SafeText: ...
|
||||
|
||||
|
||||
def format_html(format_string: str, *args, **kwargs) -> SafeText: ...
|
||||
|
||||
|
||||
def format_html_join(
|
||||
sep: str,
|
||||
format_string: str,
|
||||
args_generator: Union[List[Tuple[str]], List[Tuple[str, str]]]
|
||||
) -> SafeText: ...
|
||||
|
||||
|
||||
def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ...
|
||||
|
||||
|
||||
def linebreaks(value: str, autoescape: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def smart_urlquote(url: str) -> str: ...
|
||||
|
||||
|
||||
def strip_spaces_between_tags(value: str) -> str: ...
|
||||
|
||||
|
||||
def strip_tags(value: str) -> str: ...
|
||||
|
||||
|
||||
def urlize(
|
||||
text: str,
|
||||
trim_url_limit: Optional[int] = ...,
|
||||
nofollow: bool = ...,
|
||||
autoescape: bool = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
class MLStripper:
|
||||
def __init__(self) -> None: ...
|
||||
def get_data(self) -> str: ...
|
||||
def handle_charref(self, name: str) -> None: ...
|
||||
def handle_data(self, d: str) -> None: ...
|
||||
def handle_entityref(self, name: str) -> None: ...
|
||||
79
django/utils/http.pyi
Normal file
79
django/utils/http.pyi
Normal file
@@ -0,0 +1,79 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from urllib.parse import (
|
||||
ParseResult,
|
||||
SplitResult,
|
||||
)
|
||||
|
||||
|
||||
def _is_safe_url(url: str, allowed_hosts: Set[str], require_https: bool = ...) -> bool: ...
|
||||
|
||||
|
||||
def _urlparse(url: str, scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ...
|
||||
|
||||
|
||||
def _urlsplit(url: str, scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ...
|
||||
|
||||
|
||||
def base36_to_int(s: str) -> int: ...
|
||||
|
||||
|
||||
def cookie_date(epoch_seconds: float = ...) -> str: ...
|
||||
|
||||
|
||||
def http_date(epoch_seconds: Union[float, int] = ...) -> str: ...
|
||||
|
||||
|
||||
def int_to_base36(i: Union[str, int, Dict[int, int]]) -> str: ...
|
||||
|
||||
|
||||
def is_safe_url(url: Optional[str], allowed_hosts: Optional[Set[str]], require_https: bool = ...) -> bool: ...
|
||||
|
||||
|
||||
def is_same_domain(host: str, pattern: str) -> bool: ...
|
||||
|
||||
|
||||
def limited_parse_qsl(
|
||||
qs: str,
|
||||
keep_blank_values: bool = ...,
|
||||
encoding: str = ...,
|
||||
errors: str = ...,
|
||||
fields_limit: Optional[int] = ...
|
||||
) -> List[Tuple[str, str]]: ...
|
||||
|
||||
|
||||
def parse_etags(etag_str: str) -> List[str]: ...
|
||||
|
||||
|
||||
def parse_http_date(date: str) -> int: ...
|
||||
|
||||
|
||||
def parse_http_date_safe(date: str) -> int: ...
|
||||
|
||||
|
||||
def quote_etag(etag_str: str) -> str: ...
|
||||
|
||||
|
||||
def urlencode(query: Any, doseq: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def urlquote(url: str, safe: str = ...) -> str: ...
|
||||
|
||||
|
||||
def urlquote_plus(url: str, safe: str = ...) -> str: ...
|
||||
|
||||
|
||||
def urlsafe_base64_decode(s: Union[str, bytes]) -> bytes: ...
|
||||
|
||||
|
||||
def urlsafe_base64_encode(s: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def urlunquote_plus(quoted_url: str) -> str: ...
|
||||
16
django/utils/inspect.pyi
Normal file
16
django/utils/inspect.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
def func_accepts_kwargs(func: Callable) -> bool: ...
|
||||
|
||||
|
||||
def func_accepts_var_args(func: Callable) -> bool: ...
|
||||
|
||||
|
||||
def func_supports_parameter(func: Callable, parameter: str) -> bool: ...
|
||||
|
||||
|
||||
def get_func_args(func: Callable) -> List[str]: ...
|
||||
1
django/utils/ipv6.pyi
Normal file
1
django/utils/ipv6.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def is_valid_ipv6_address(ip_str: str) -> bool: ...
|
||||
4
django/utils/itercompat.pyi
Normal file
4
django/utils/itercompat.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
def is_iterable(x: Any) -> bool: ...
|
||||
26
django/utils/jslex.pyi
Normal file
26
django/utils/jslex.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from typing import (
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
def literals(choices: str, prefix: str = ..., suffix: str = ...) -> str: ...
|
||||
|
||||
|
||||
def prepare_js_for_gettext(js: str) -> str: ...
|
||||
|
||||
|
||||
class JsLexer:
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
|
||||
class Lexer:
|
||||
def __init__(self, states: Dict[str, List[Tok]], first: str) -> None: ...
|
||||
def lex(self, text: str) -> Iterator[Tuple[str, str]]: ...
|
||||
|
||||
|
||||
class Tok:
|
||||
def __init__(self, name: str, regex: str, next: Optional[str] = ...) -> None: ...
|
||||
49
django/utils/log.pyi
Normal file
49
django/utils/log.pyi
Normal file
@@ -0,0 +1,49 @@
|
||||
from django.core.mail.backends.locmem import EmailBackend
|
||||
from logging import LogRecord
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ...
|
||||
|
||||
|
||||
def log_response(
|
||||
message: str,
|
||||
*args,
|
||||
response = ...,
|
||||
request = ...,
|
||||
logger = ...,
|
||||
level = ...,
|
||||
exc_info = ...
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class AdminEmailHandler:
|
||||
def __init__(self, include_html: bool = ..., email_backend: None = ...) -> None: ...
|
||||
def connection(self) -> EmailBackend: ...
|
||||
def emit(self, record: LogRecord) -> None: ...
|
||||
def format_subject(self, subject: str) -> str: ...
|
||||
def send_mail(self, subject: str, message: str, *args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
class CallbackFilter:
|
||||
def __init__(self, callback: Callable) -> None: ...
|
||||
def filter(self, record: str) -> int: ...
|
||||
|
||||
|
||||
class RequireDebugFalse:
|
||||
def filter(self, record: Union[str, LogRecord]) -> bool: ...
|
||||
|
||||
|
||||
class RequireDebugTrue:
|
||||
def filter(self, record: LogRecord) -> bool: ...
|
||||
|
||||
|
||||
class ServerFormatter:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def format(self, record: LogRecord) -> str: ...
|
||||
def uses_server_time(self) -> bool: ...
|
||||
7
django/utils/lorem_ipsum.pyi
Normal file
7
django/utils/lorem_ipsum.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
def paragraph() -> str: ...
|
||||
|
||||
|
||||
def sentence() -> str: ...
|
||||
|
||||
|
||||
def words(count: int, common: bool = ...) -> str: ...
|
||||
13
django/utils/module_loading.pyi
Normal file
13
django/utils/module_loading.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
|
||||
def autodiscover_modules(*args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
def import_string(dotted_path: str) -> object: ...
|
||||
|
||||
|
||||
def module_dir(module: Any) -> str: ...
|
||||
|
||||
|
||||
def module_has_submodule(package: Any, module_name: str) -> bool: ...
|
||||
17
django/utils/numberformat.pyi
Normal file
17
django/utils/numberformat.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from decimal import Decimal
|
||||
from typing import (
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def format(
|
||||
number: Union[float, str, int, Decimal],
|
||||
decimal_sep: str,
|
||||
decimal_pos: Optional[int] = ...,
|
||||
grouping: Union[Tuple[int, int, int], int, Tuple[int, int, int, int, int]] = ...,
|
||||
thousand_sep: str = ...,
|
||||
force_grouping: bool = ...,
|
||||
use_l10n: Optional[bool] = ...
|
||||
) -> str: ...
|
||||
28
django/utils/regex_helper.pyi
Normal file
28
django/utils/regex_helper.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def contains(
|
||||
source: Union[str, Group, NonCapture],
|
||||
inst: Type[Group]
|
||||
) -> bool: ...
|
||||
|
||||
|
||||
def flatten_result(source: Any) -> Union[Tuple[List[str], List[List[str]]], Tuple[List[str], List[List[Any]]]]: ...
|
||||
|
||||
|
||||
def get_quantifier(ch: str, input_iter: Iterator[Any]) -> Union[Tuple[int, None], Tuple[int, str]]: ...
|
||||
|
||||
|
||||
def normalize(
|
||||
pattern: str
|
||||
) -> Union[List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[str]]]]: ...
|
||||
|
||||
|
||||
def walk_to_end(ch: str, input_iter: Iterator[Any]) -> None: ...
|
||||
22
django/utils/safestring.pyi
Normal file
22
django/utils/safestring.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.forms.boundfield import BoundField
|
||||
from typing import (
|
||||
Callable,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _safety_decorator(safety_marker: Callable, func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def mark_safe(
|
||||
s: Union[str, Callable, BoundField]
|
||||
) -> Union[SafeText, Callable, BoundField]: ...
|
||||
|
||||
|
||||
class SafeData:
|
||||
def __html__(self) -> SafeText: ...
|
||||
|
||||
|
||||
class SafeText:
|
||||
def __add__(self, rhs: str) -> str: ...
|
||||
def __str__(self) -> SafeText: ...
|
||||
14
django/utils/six.pyi
Normal file
14
django/utils/six.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
from _frozen_importlib_external import _NamespacePath
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class _SixMetaPathImporter:
|
||||
def find_module(
|
||||
self,
|
||||
fullname: str,
|
||||
path: Optional[Union[List[str], _NamespacePath]] = ...
|
||||
) -> None: ...
|
||||
18
django/utils/termcolors.pyi
Normal file
18
django/utils/termcolors.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
Dict,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def colorize(text: str = ..., opts: Union[str, Tuple] = ..., **kwargs) -> str: ...
|
||||
|
||||
|
||||
def make_style(opts: Tuple = ..., **kwargs) -> Callable: ...
|
||||
|
||||
|
||||
def parse_color_setting(
|
||||
config_string: str
|
||||
) -> Optional[Union[Dict[str, Dict[str, str]], Dict[str, Dict[str, Union[str, Tuple[str]]]]]]: ...
|
||||
65
django/utils/text.pyi
Normal file
65
django/utils/text.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _format_lazy(format_string: str, *args, **kwargs) -> str: ...
|
||||
|
||||
|
||||
def camel_case_to_spaces(value: str) -> str: ...
|
||||
|
||||
|
||||
def capfirst(x: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
|
||||
def compress_sequence(sequence: Union[List[bytes], map]) -> Iterator[bytes]: ...
|
||||
|
||||
|
||||
def compress_string(s: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def get_text_list(list_: List[str], last_word: str = ...) -> str: ...
|
||||
|
||||
|
||||
def get_valid_filename(s: str) -> str: ...
|
||||
|
||||
|
||||
def normalize_newlines(text: str) -> str: ...
|
||||
|
||||
|
||||
def phone2numeric(phone: str) -> str: ...
|
||||
|
||||
|
||||
def slugify(value: str, allow_unicode: bool = ...) -> SafeText: ...
|
||||
|
||||
|
||||
def smart_split(text: str) -> Iterator[str]: ...
|
||||
|
||||
|
||||
def unescape_entities(text: str) -> str: ...
|
||||
|
||||
|
||||
def unescape_string_literal(s: str) -> str: ...
|
||||
|
||||
|
||||
def wrap(text: str, width: int) -> str: ...
|
||||
|
||||
|
||||
class StreamingBuffer:
|
||||
def __init__(self) -> None: ...
|
||||
def read(self) -> bytes: ...
|
||||
def write(self, val: bytes) -> None: ...
|
||||
|
||||
|
||||
class Truncator:
|
||||
def __init__(self, text: str) -> None: ...
|
||||
def _text_chars(self, length: int, truncate: Optional[str], text: str, truncate_len: int) -> str: ...
|
||||
def _text_words(self, length: int, truncate: Optional[str]) -> str: ...
|
||||
def _truncate_html(self, length: int, truncate: Optional[str], text: str, truncate_len: int, words: bool) -> str: ...
|
||||
def add_truncation_text(self, text: str, truncate: Optional[str] = ...) -> str: ...
|
||||
def chars(self, num: int, truncate: Optional[str] = ..., html: bool = ...) -> str: ...
|
||||
def words(self, num: int, truncate: Optional[str] = ..., html: bool = ...) -> str: ...
|
||||
13
django/utils/timesince.pyi
Normal file
13
django/utils/timesince.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def timesince(
|
||||
d: date,
|
||||
now: Optional[date] = ...,
|
||||
reversed: bool = ...,
|
||||
time_strings: None = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def timeuntil(d: date, now: Optional[date] = ..., time_strings: None = ...) -> str: ...
|
||||
69
django/utils/timezone.pyi
Normal file
69
django/utils/timezone.pyi
Normal file
@@ -0,0 +1,69 @@
|
||||
from datetime import (
|
||||
datetime,
|
||||
time,
|
||||
timedelta,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _get_timezone_name(timezone: FixedOffset) -> str: ...
|
||||
|
||||
|
||||
def activate(timezone: Union[str, FixedOffset]) -> None: ...
|
||||
|
||||
|
||||
def deactivate() -> None: ...
|
||||
|
||||
|
||||
def get_current_timezone() -> FixedOffset: ...
|
||||
|
||||
|
||||
def get_current_timezone_name() -> str: ...
|
||||
|
||||
|
||||
def get_fixed_timezone(offset: int) -> FixedOffset: ...
|
||||
|
||||
|
||||
def is_aware(value: Union[time, datetime]) -> bool: ...
|
||||
|
||||
|
||||
def is_naive(value: datetime) -> bool: ...
|
||||
|
||||
|
||||
def localtime(
|
||||
value: Optional[datetime] = ...,
|
||||
timezone: Optional[FixedOffset] = ...
|
||||
) -> datetime: ...
|
||||
|
||||
|
||||
def make_aware(
|
||||
value: datetime,
|
||||
timezone: Optional[FixedOffset] = ...,
|
||||
is_dst: Optional[bool] = ...
|
||||
) -> datetime: ...
|
||||
|
||||
|
||||
def make_naive(value: datetime, timezone: FixedOffset = ...) -> datetime: ...
|
||||
|
||||
|
||||
def now() -> datetime: ...
|
||||
|
||||
|
||||
def template_localtime(value: Any, use_tz: Optional[bool] = ...) -> Any: ...
|
||||
|
||||
|
||||
class FixedOffset:
|
||||
def __init__(self, offset: Optional[int] = ..., name: Optional[str] = ...) -> None: ...
|
||||
def dst(self, dt: datetime) -> timedelta: ...
|
||||
def tzname(self, dt: Optional[datetime]) -> str: ...
|
||||
def utcoffset(self, dt: datetime) -> timedelta: ...
|
||||
|
||||
|
||||
class override:
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(self, timezone: Optional[Union[str, FixedOffset]]) -> None: ...
|
||||
65
django/utils/translation/__init__.pyi
Normal file
65
django/utils/translation/__init__.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from typing import (
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def activate(language: str) -> None: ...
|
||||
|
||||
|
||||
def check_for_language(lang_code: Optional[str]) -> bool: ...
|
||||
|
||||
|
||||
def deactivate() -> None: ...
|
||||
|
||||
|
||||
def deactivate_all() -> None: ...
|
||||
|
||||
|
||||
def get_language() -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_language_bidi() -> bool: ...
|
||||
|
||||
|
||||
def get_language_from_path(path: str) -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_language_from_request(request: WSGIRequest, check_path: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def get_language_info(lang_code: str): ...
|
||||
|
||||
|
||||
def gettext(message: str) -> str: ...
|
||||
|
||||
|
||||
def gettext_noop(message: str) -> str: ...
|
||||
|
||||
|
||||
def ngettext(singular: str, plural: str, number: Union[float, int]) -> str: ...
|
||||
|
||||
|
||||
def npgettext(context: str, singular: str, plural: str, number: int) -> str: ...
|
||||
|
||||
|
||||
def pgettext(context: str, message: str) -> str: ...
|
||||
|
||||
|
||||
def templatize(src: str, **kwargs) -> str: ...
|
||||
|
||||
|
||||
def to_language(locale: str) -> str: ...
|
||||
|
||||
|
||||
def to_locale(language: str) -> str: ...
|
||||
|
||||
|
||||
def trim_whitespace(s: str) -> str: ...
|
||||
|
||||
|
||||
class override:
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ...
|
||||
def __init__(self, language: Optional[str], deactivate: bool = ...) -> None: ...
|
||||
4
django/utils/translation/template.pyi
Normal file
4
django/utils/translation/template.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
def blankout(src: str, char: str) -> str: ...
|
||||
|
||||
|
||||
def templatize(src: str, origin: str = ...) -> str: ...
|
||||
10
django/utils/translation/trans_null.pyi
Normal file
10
django/utils/translation/trans_null.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
def check_for_language(x: str) -> bool: ...
|
||||
|
||||
|
||||
def get_language_from_path(request: str) -> None: ...
|
||||
|
||||
|
||||
def get_supported_language_variant(lang_code: str, strict: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def ngettext(singular: str, plural: str, number: int) -> str: ...
|
||||
85
django/utils/translation/trans_real.pyi
Normal file
85
django/utils/translation/trans_real.pyi
Normal file
@@ -0,0 +1,85 @@
|
||||
from collections import OrderedDict
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from gettext import NullTranslations
|
||||
from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def activate(language: str) -> None: ...
|
||||
|
||||
|
||||
def all_locale_paths() -> List[str]: ...
|
||||
|
||||
|
||||
def check_for_language(lang_code: str) -> bool: ...
|
||||
|
||||
|
||||
def deactivate() -> None: ...
|
||||
|
||||
|
||||
def deactivate_all() -> None: ...
|
||||
|
||||
|
||||
def do_ntranslate(singular: str, plural: str, number: Union[float, int], translation_function: str) -> str: ...
|
||||
|
||||
|
||||
def get_language() -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_language_bidi() -> bool: ...
|
||||
|
||||
|
||||
def get_language_from_path(path: str, strict: bool = ...) -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_language_from_request(request: WSGIRequest, check_path: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def get_languages() -> OrderedDict: ...
|
||||
|
||||
|
||||
def get_supported_language_variant(lang_code: Optional[str], strict: bool = ...) -> str: ...
|
||||
|
||||
|
||||
def gettext(message: str) -> str: ...
|
||||
|
||||
|
||||
def gettext_noop(message: str) -> str: ...
|
||||
|
||||
|
||||
def ngettext(singular: str, plural: str, number: Union[float, int]) -> str: ...
|
||||
|
||||
|
||||
def npgettext(context: str, singular: str, plural: str, number: int) -> str: ...
|
||||
|
||||
|
||||
def parse_accept_lang_header(lang_string: str) -> Tuple: ...
|
||||
|
||||
|
||||
def pgettext(context: str, message: str) -> str: ...
|
||||
|
||||
|
||||
def reset_cache(**kwargs) -> None: ...
|
||||
|
||||
|
||||
def translation(language: str) -> DjangoTranslation: ...
|
||||
|
||||
|
||||
class DjangoTranslation:
|
||||
def __init__(
|
||||
self,
|
||||
language: str,
|
||||
domain: Optional[str] = ...,
|
||||
localedirs: Optional[List[str]] = ...
|
||||
) -> None: ...
|
||||
def _add_fallback(self, localedirs: Optional[List[str]] = ...) -> None: ...
|
||||
def _add_installed_apps_translations(self) -> None: ...
|
||||
def _add_local_translations(self) -> None: ...
|
||||
def _init_translation_catalog(self) -> None: ...
|
||||
def _new_gnu_trans(self, localedir: str, use_null_fallback: bool = ...) -> NullTranslations: ...
|
||||
def merge(self, other: NullTranslations) -> None: ...
|
||||
def to_language(self) -> str: ...
|
||||
29
django/utils/tree.pyi
Normal file
29
django/utils/tree.pyi
Normal file
@@ -0,0 +1,29 @@
|
||||
from django.db.models.query_utils import Q
|
||||
from django.db.models.sql.where import WhereNode
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
class Node:
|
||||
def __bool__(self) -> bool: ...
|
||||
def __contains__(self, other: Tuple[str, int]) -> bool: ...
|
||||
def __deepcopy__(self, memodict: Dict[Any, Any]) -> Q: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(self, children: Any = ..., connector: Optional[str] = ..., negated: bool = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
@classmethod
|
||||
def _new_instance(
|
||||
cls,
|
||||
children: Any = ...,
|
||||
connector: str = ...,
|
||||
negated: bool = ...
|
||||
) -> WhereNode: ...
|
||||
def add(self, data: Any, conn_type: str, squash: bool = ...) -> Any: ...
|
||||
def negate(self) -> None: ...
|
||||
19
django/utils/version.pyi
Normal file
19
django/utils/version.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import (
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
def get_complete_version(version: Optional[Tuple[int, int, int, str, int]] = ...) -> Tuple[int, int, int, str, int]: ...
|
||||
|
||||
|
||||
def get_docs_version(version: None = ...) -> str: ...
|
||||
|
||||
|
||||
def get_git_changeset() -> str: ...
|
||||
|
||||
|
||||
def get_main_version(version: Tuple[int, int, int, str, int] = ...) -> str: ...
|
||||
|
||||
|
||||
def get_version(version: Optional[Tuple[int, int, int, str, int]] = ...) -> str: ...
|
||||
15
django/utils/xmlutils.pyi
Normal file
15
django/utils/xmlutils.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class SimplerXMLGenerator:
|
||||
def addQuickElement(
|
||||
self,
|
||||
name: str,
|
||||
contents: Optional[str] = ...,
|
||||
attrs: Optional[Dict[str, str]] = ...
|
||||
) -> None: ...
|
||||
def characters(self, content: str) -> None: ...
|
||||
def startElement(self, name: str, attrs: Dict[str, str]) -> None: ...
|
||||
9
django/views/csrf.pyi
Normal file
9
django/views/csrf.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.http.request import HttpRequest
|
||||
from django.http.response import HttpResponseForbidden
|
||||
|
||||
|
||||
def csrf_failure(
|
||||
request: HttpRequest,
|
||||
reason: str = ...,
|
||||
template_name: str = ...
|
||||
) -> HttpResponseForbidden: ...
|
||||
80
django/views/debug.pyi
Normal file
80
django/views/debug.pyi
Normal file
@@ -0,0 +1,80 @@
|
||||
from _frozen_importlib import FrozenImporter
|
||||
from _frozen_importlib_external import SourceFileLoader
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.request import QueryDict
|
||||
from django.http.response import (
|
||||
Http404,
|
||||
HttpResponseNotFound,
|
||||
)
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def cleanse_setting(key: Union[str, int], value: Any) -> Any: ...
|
||||
|
||||
|
||||
def get_default_exception_reporter_filter() -> SafeExceptionReporterFilter: ...
|
||||
|
||||
|
||||
def get_exception_reporter_filter(
|
||||
request: Optional[WSGIRequest]
|
||||
) -> SafeExceptionReporterFilter: ...
|
||||
|
||||
|
||||
def get_safe_settings() -> Dict[str, Any]: ...
|
||||
|
||||
|
||||
def technical_404_response(
|
||||
request: WSGIRequest,
|
||||
exception: Http404
|
||||
) -> HttpResponseNotFound: ...
|
||||
|
||||
|
||||
class CallableSettingWrapper:
|
||||
def __init__(self, callable_setting: Type[object]) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
|
||||
class ExceptionReporter:
|
||||
def __init__(
|
||||
self,
|
||||
request: Optional[WSGIRequest],
|
||||
exc_type: None,
|
||||
exc_value: Optional[str],
|
||||
tb: None,
|
||||
is_email: bool = ...
|
||||
) -> None: ...
|
||||
def _get_lines_from_file(
|
||||
self,
|
||||
filename: str,
|
||||
lineno: int,
|
||||
context_lines: int,
|
||||
loader: Optional[Union[SourceFileLoader, Type[FrozenImporter]]] = ...,
|
||||
module_name: str = ...
|
||||
) -> Union[Tuple[int, List[str], str, List[str]], Tuple[None, List[Any], None, List[Any]], Tuple[int, List[str], str, List[Any]]]: ...
|
||||
def get_traceback_data(self) -> Dict[str, Any]: ...
|
||||
def get_traceback_frames(self) -> List[Any]: ...
|
||||
def get_traceback_html(self) -> SafeText: ...
|
||||
def get_traceback_text(self) -> SafeText: ...
|
||||
|
||||
|
||||
class SafeExceptionReporterFilter:
|
||||
def cleanse_special_types(self, request: Optional[WSGIRequest], value: Any) -> Any: ...
|
||||
def get_cleansed_multivaluedict(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
multivaluedict: QueryDict
|
||||
) -> QueryDict: ...
|
||||
def get_post_parameters(
|
||||
self,
|
||||
request: Optional[WSGIRequest]
|
||||
) -> QueryDict: ...
|
||||
def is_active(self, request: Optional[WSGIRequest]) -> bool: ...
|
||||
10
django/views/decorators/cache.pyi
Normal file
10
django/views/decorators/cache.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def cache_page(timeout: Union[float, int], *, cache = ..., key_prefix = ...) -> Callable: ...
|
||||
|
||||
|
||||
def never_cache(view_func: Callable) -> Callable: ...
|
||||
26
django/views/decorators/csrf.pyi
Normal file
26
django/views/decorators/csrf.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from csrf_tests.tests import TestingHttpRequest
|
||||
from django.http.request import HttpRequest
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
|
||||
def csrf_exempt(view_func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
class _EnsureCsrfCookie:
|
||||
def _reject(self, request: TestingHttpRequest, reason: str) -> None: ...
|
||||
def process_view(
|
||||
self,
|
||||
request: TestingHttpRequest,
|
||||
callback: Callable,
|
||||
callback_args: Tuple,
|
||||
callback_kwargs: Dict[Any, Any]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class _EnsureCsrfToken:
|
||||
def _reject(self, request: HttpRequest, reason: str) -> None: ...
|
||||
7
django/views/decorators/debug.pyi
Normal file
7
django/views/decorators/debug.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Callable
|
||||
|
||||
|
||||
def sensitive_post_parameters(*parameters) -> Callable: ...
|
||||
|
||||
|
||||
def sensitive_variables(*variables) -> Callable: ...
|
||||
13
django/views/decorators/http.pyi
Normal file
13
django/views/decorators/http.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
def condition(etag_func: Callable = ..., last_modified_func: None = ...) -> Callable: ...
|
||||
|
||||
|
||||
def etag(etag_func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def require_http_methods(request_method_list: List[str]) -> Callable: ...
|
||||
7
django/views/decorators/vary.pyi
Normal file
7
django/views/decorators/vary.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Callable
|
||||
|
||||
|
||||
def vary_on_cookie(func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def vary_on_headers(*headers) -> Callable: ...
|
||||
40
django/views/defaults.pyi
Normal file
40
django/views/defaults.pyi
Normal file
@@ -0,0 +1,40 @@
|
||||
from django.core.exceptions import (
|
||||
PermissionDenied,
|
||||
SuspiciousOperation,
|
||||
)
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import (
|
||||
Http404,
|
||||
HttpResponseBadRequest,
|
||||
HttpResponseForbidden,
|
||||
HttpResponseNotFound,
|
||||
HttpResponseServerError,
|
||||
)
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def bad_request(
|
||||
request: WSGIRequest,
|
||||
exception: SuspiciousOperation,
|
||||
template_name: str = ...
|
||||
) -> HttpResponseBadRequest: ...
|
||||
|
||||
|
||||
def page_not_found(
|
||||
request: WSGIRequest,
|
||||
exception: Optional[Http404],
|
||||
template_name: str = ...
|
||||
) -> HttpResponseNotFound: ...
|
||||
|
||||
|
||||
def permission_denied(
|
||||
request: WSGIRequest,
|
||||
exception: PermissionDenied,
|
||||
template_name: str = ...
|
||||
) -> HttpResponseForbidden: ...
|
||||
|
||||
|
||||
def server_error(
|
||||
request: WSGIRequest,
|
||||
template_name: str = ...
|
||||
) -> HttpResponseServerError: ...
|
||||
78
django/views/generic/base.pyi
Normal file
78
django/views/generic/base.pyi
Normal file
@@ -0,0 +1,78 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import (
|
||||
HttpResponse,
|
||||
HttpResponseNotAllowed,
|
||||
HttpResponseRedirect,
|
||||
HttpResponseRedirectBase,
|
||||
)
|
||||
from django.template.response import TemplateResponse
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class ContextMixin:
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
|
||||
|
||||
class RedirectView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseRedirectBase: ...
|
||||
def get_redirect_url(self, *args, **kwargs) -> str: ...
|
||||
def options(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseRedirect: ...
|
||||
def post(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
|
||||
class TemplateResponseMixin:
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
def render_to_response(
|
||||
self,
|
||||
context: Dict[str, Any],
|
||||
**response_kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class TemplateView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class View:
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def _allowed_methods(self) -> List[str]: ...
|
||||
@classmethod
|
||||
def as_view(cls, **initkwargs) -> Callable: ...
|
||||
def dispatch(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> Union[View, HttpResponse]: ...
|
||||
def http_method_not_allowed(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseNotAllowed: ...
|
||||
138
django/views/generic/dates.pyi
Normal file
138
django/views/generic/dates.pyi
Normal file
@@ -0,0 +1,138 @@
|
||||
from datetime import date
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views.generic.list import MultipleObjectTemplateResponseMixin
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _date_from_string(
|
||||
year: int,
|
||||
year_format: str,
|
||||
month: str = ...,
|
||||
month_format: str = ...,
|
||||
day: Union[str, int] = ...,
|
||||
day_format: str = ...,
|
||||
delim: str = ...
|
||||
) -> date: ...
|
||||
|
||||
|
||||
def _get_next_prev(
|
||||
generic_view: MultipleObjectTemplateResponseMixin,
|
||||
date: date,
|
||||
is_previous: bool,
|
||||
period: str
|
||||
) -> Optional[date]: ...
|
||||
|
||||
|
||||
def timezone_today() -> date: ...
|
||||
|
||||
|
||||
class BaseArchiveIndexView:
|
||||
def get_dated_items(self) -> Tuple[QuerySet, QuerySet, Dict[Any, Any]]: ...
|
||||
|
||||
|
||||
class BaseDateDetailView:
|
||||
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
|
||||
|
||||
|
||||
class BaseDateListView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
def get_date_list(
|
||||
self,
|
||||
queryset: QuerySet,
|
||||
date_type: None = ...,
|
||||
ordering: str = ...
|
||||
) -> QuerySet: ...
|
||||
def get_date_list_period(self) -> str: ...
|
||||
def get_dated_queryset(self, **lookup) -> QuerySet: ...
|
||||
def get_ordering(self) -> Union[str, Tuple[str, str]]: ...
|
||||
|
||||
|
||||
class BaseDayArchiveView:
|
||||
def _get_dated_items(
|
||||
self,
|
||||
date: date
|
||||
) -> Union[Tuple[None, QuerySet, Dict[str, Union[date, None]]], Tuple[None, QuerySet, Dict[str, date]]]: ...
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Union[Tuple[None, QuerySet, Dict[str, Union[date, None]]], Tuple[None, QuerySet, Dict[str, date]]]: ...
|
||||
|
||||
|
||||
class BaseMonthArchiveView:
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Union[Tuple[QuerySet, QuerySet, Dict[str, Union[date, None]]], Tuple[QuerySet, QuerySet, Dict[str, date]]]: ...
|
||||
|
||||
|
||||
class BaseTodayArchiveView:
|
||||
def get_dated_items(self): ...
|
||||
|
||||
|
||||
class BaseWeekArchiveView:
|
||||
def get_dated_items(self) -> Tuple[None, QuerySet, Dict[str, date]]: ...
|
||||
|
||||
|
||||
class BaseYearArchiveView:
|
||||
def get_dated_items(
|
||||
self
|
||||
) -> Union[Tuple[QuerySet, QuerySet, Dict[str, Union[date, None]]], Tuple[QuerySet, QuerySet, Dict[str, date]]]: ...
|
||||
def get_make_object_list(self) -> bool: ...
|
||||
|
||||
|
||||
class DateMixin:
|
||||
def _make_date_lookup_arg(self, value: date) -> date: ...
|
||||
def _make_single_date_lookup(self, date: date) -> Dict[str, date]: ...
|
||||
def get_allow_future(self) -> bool: ...
|
||||
def get_date_field(self) -> str: ...
|
||||
@cached_property
|
||||
def uses_datetime_field(self) -> bool: ...
|
||||
|
||||
|
||||
class DayMixin:
|
||||
def _get_current_day(self, date: date) -> date: ...
|
||||
def _get_next_day(self, date: date) -> date: ...
|
||||
def get_day(self) -> int: ...
|
||||
def get_day_format(self) -> str: ...
|
||||
def get_next_day(self, date: date) -> None: ...
|
||||
def get_previous_day(self, date: date) -> date: ...
|
||||
|
||||
|
||||
class MonthMixin:
|
||||
def _get_current_month(self, date: date) -> date: ...
|
||||
def _get_next_month(self, date: date) -> date: ...
|
||||
def get_month(self) -> Union[str, int]: ...
|
||||
def get_month_format(self) -> str: ...
|
||||
def get_next_month(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_month(self, date: date) -> Optional[date]: ...
|
||||
|
||||
|
||||
class WeekMixin:
|
||||
def _get_current_week(self, date: date) -> date: ...
|
||||
def _get_next_week(self, date: date) -> date: ...
|
||||
def _get_weekday(self, date: date) -> int: ...
|
||||
def get_next_week(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_week(self, date: date) -> Optional[date]: ...
|
||||
def get_week(self) -> int: ...
|
||||
def get_week_format(self) -> str: ...
|
||||
|
||||
|
||||
class YearMixin:
|
||||
def _get_current_year(self, date: date) -> date: ...
|
||||
def _get_next_year(self, date: date) -> date: ...
|
||||
def get_next_year(self, date: date) -> Optional[date]: ...
|
||||
def get_previous_year(self, date: date) -> Optional[date]: ...
|
||||
def get_year(self) -> int: ...
|
||||
def get_year_format(self) -> str: ...
|
||||
32
django/views/generic/detail.pyi
Normal file
32
django/views/generic/detail.pyi
Normal file
@@ -0,0 +1,32 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseDetailView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class SingleObjectMixin:
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
def get_context_object_name(self, obj: Union[Model, Dict[str, str]]) -> Optional[str]: ...
|
||||
def get_object(self, queryset: Optional[QuerySet] = ...) -> Model: ...
|
||||
def get_queryset(self) -> QuerySet: ...
|
||||
def get_slug_field(self) -> str: ...
|
||||
|
||||
|
||||
class SingleObjectTemplateResponseMixin:
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
86
django/views/generic/edit.pyi
Normal file
86
django/views/generic/edit.pyi
Normal file
@@ -0,0 +1,86 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.db.models.base import Model
|
||||
from django.forms.forms import (
|
||||
BaseForm,
|
||||
Form,
|
||||
)
|
||||
from django.forms.models import ModelForm
|
||||
from django.http.response import HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseCreateView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class BaseUpdateView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class DeletionMixin:
|
||||
def delete(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseRedirect: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
def post(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> HttpResponseRedirect: ...
|
||||
|
||||
|
||||
class FormMixin:
|
||||
def form_invalid(self, form: Form) -> TemplateResponse: ...
|
||||
def form_valid(self, form: Form) -> HttpResponseRedirect: ...
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
def get_form(self, form_class: None = ...) -> BaseForm: ...
|
||||
def get_form_class(self) -> Any: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Union[None, MultiValueDict]]: ...
|
||||
def get_initial(self) -> Dict[Any, Any]: ...
|
||||
def get_prefix(self) -> None: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
|
||||
|
||||
class ModelFormMixin:
|
||||
def get_form_class(self) -> Type[ModelForm]: ...
|
||||
def get_form_kwargs(
|
||||
self
|
||||
) -> Dict[str, Union[None, MultiValueDict, Model]]: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
|
||||
|
||||
class ProcessFormView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
def post(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> Union[TemplateResponse, HttpResponseRedirect]: ...
|
||||
54
django/views/generic/list.pyi
Normal file
54
django/views/generic/list.pyi
Normal file
@@ -0,0 +1,54 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.core.paginator import (
|
||||
Page,
|
||||
Paginator,
|
||||
)
|
||||
from django.db.models.query import QuerySet
|
||||
from django.template.response import TemplateResponse
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class BaseListView:
|
||||
def get(
|
||||
self,
|
||||
request: WSGIRequest,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> TemplateResponse: ...
|
||||
|
||||
|
||||
class MultipleObjectMixin:
|
||||
def get_allow_empty(self) -> bool: ...
|
||||
def get_context_data(self, *, object_list = ..., **kwargs) -> Dict[str, Any]: ...
|
||||
def get_context_object_name(
|
||||
self,
|
||||
object_list: Optional[Union[QuerySet, List[Dict[str, str]]]]
|
||||
) -> Optional[str]: ...
|
||||
def get_ordering(self) -> None: ...
|
||||
def get_paginate_by(self, queryset: Union[QuerySet, List[Dict[str, str]]]) -> Optional[int]: ...
|
||||
def get_paginate_orphans(self) -> int: ...
|
||||
def get_paginator(
|
||||
self,
|
||||
queryset: QuerySet,
|
||||
per_page: int,
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
**kwargs
|
||||
) -> Paginator: ...
|
||||
def get_queryset(self) -> Union[QuerySet, List[Dict[str, str]]]: ...
|
||||
def paginate_queryset(
|
||||
self,
|
||||
queryset: QuerySet,
|
||||
page_size: int
|
||||
) -> Tuple[Paginator, Page, QuerySet, bool]: ...
|
||||
|
||||
|
||||
class MultipleObjectTemplateResponseMixin:
|
||||
def get_template_names(self) -> List[str]: ...
|
||||
44
django/views/i18n.pyi
Normal file
44
django/views/i18n.pyi
Normal file
@@ -0,0 +1,44 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import (
|
||||
HttpResponse,
|
||||
HttpResponseRedirect,
|
||||
JsonResponse,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def get_formats() -> Dict[str, Union[str, int, List[str]]]: ...
|
||||
|
||||
|
||||
def set_language(request: WSGIRequest) -> HttpResponseRedirect: ...
|
||||
|
||||
|
||||
class JSONCatalog:
|
||||
def render_to_response(
|
||||
self,
|
||||
context: Dict[str, Union[Dict[str, Union[str, List[str]]], Dict[str, Union[str, int, List[str]]], str]],
|
||||
**response_kwargs
|
||||
) -> JsonResponse: ...
|
||||
|
||||
|
||||
class JavaScriptCatalog:
|
||||
@property
|
||||
def _num_plurals(self) -> int: ...
|
||||
@property
|
||||
def _plural_string(self) -> Optional[str]: ...
|
||||
def get(self, request: WSGIRequest, *args, **kwargs) -> HttpResponse: ...
|
||||
def get_catalog(self) -> Dict[str, Union[str, List[str]]]: ...
|
||||
def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
|
||||
def get_paths(self, packages: List[str]) -> List[str]: ...
|
||||
def get_plural(self) -> Optional[str]: ...
|
||||
def render_to_response(
|
||||
self,
|
||||
context: Dict[str, Union[Dict[str, Union[str, int, List[str]]], None, Dict[str, str], Dict[str, Union[str, List[str]]]]],
|
||||
**response_kwargs
|
||||
) -> HttpResponse: ...
|
||||
24
django/views/static.pyi
Normal file
24
django/views/static.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import (
|
||||
FileResponse,
|
||||
HttpResponse,
|
||||
)
|
||||
from pathlib import PosixPath
|
||||
from typing import (
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def directory_index(path: str, fullpath: PosixPath) -> HttpResponse: ...
|
||||
|
||||
|
||||
def serve(
|
||||
request: WSGIRequest,
|
||||
path: str,
|
||||
document_root: str = ...,
|
||||
show_indexes: bool = ...
|
||||
) -> Union[HttpResponse, FileResponse]: ...
|
||||
|
||||
|
||||
def was_modified_since(header: Optional[str] = ..., mtime: float = ..., size: int = ...) -> bool: ...
|
||||
Reference in New Issue
Block a user