mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 20:54:29 +08:00
integrate more stubs
This commit is contained in:
@@ -4,12 +4,9 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
|||||||
from django.contrib.flatpages.sitemaps import FlatPageSitemap
|
from django.contrib.flatpages.sitemaps import FlatPageSitemap
|
||||||
from django.contrib.sitemaps import Sitemap
|
from django.contrib.sitemaps import Sitemap
|
||||||
from django.core.checks.messages import CheckMessage, Warning
|
from django.core.checks.messages import CheckMessage, Warning
|
||||||
|
from django.urls.converters import UUIDConverter
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
from .converters import get_converter
|
|
||||||
from .exceptions import NoReverseMatch, Resolver404
|
|
||||||
from .utils import get_callable
|
|
||||||
|
|
||||||
|
|
||||||
class ResolverMatch:
|
class ResolverMatch:
|
||||||
func: Callable = ...
|
func: Callable = ...
|
||||||
@@ -30,17 +27,7 @@ class ResolverMatch:
|
|||||||
app_names: Optional[List[Optional[str]]] = ...,
|
app_names: Optional[List[Optional[str]]] = ...,
|
||||||
namespaces: Optional[List[Optional[str]]] = ...,
|
namespaces: Optional[List[Optional[str]]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __getitem__(
|
def __getitem__(self, index: int) -> Any: ...
|
||||||
self, index: int
|
|
||||||
) -> Union[
|
|
||||||
Callable,
|
|
||||||
Dict[str, Dict[str, Type[FlatPageSitemap]]],
|
|
||||||
Dict[str, Dict[str, Sitemap]],
|
|
||||||
Dict[str, OrderedDict],
|
|
||||||
Dict[str, int],
|
|
||||||
Dict[str, str],
|
|
||||||
Tuple,
|
|
||||||
]: ...
|
|
||||||
|
|
||||||
def get_resolver(
|
def get_resolver(
|
||||||
urlconf: Optional[Union[Type[Any], str]] = ...
|
urlconf: Optional[Union[Type[Any], str]] = ...
|
||||||
@@ -74,7 +61,7 @@ class RegexPattern(CheckURLMixin):
|
|||||||
class RoutePattern(CheckURLMixin):
|
class RoutePattern(CheckURLMixin):
|
||||||
regex: Any = ...
|
regex: Any = ...
|
||||||
name: Optional[str] = ...
|
name: Optional[str] = ...
|
||||||
converters: Dict[str, django.urls.converters.UUIDConverter] = ...
|
converters: Dict[str, UUIDConverter] = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
from .utils import (ProgrammingError as ProgrammingError,
|
||||||
|
IntegrityError as IntegrityError)
|
||||||
@@ -21,4 +21,6 @@ from .query import (QuerySet as QuerySet,
|
|||||||
|
|
||||||
from .query_utils import Q as Q
|
from .query_utils import Q as Q
|
||||||
|
|
||||||
from .lookups import (Lookup as Lookup)
|
from .lookups import Lookup as Lookup
|
||||||
|
|
||||||
|
from .expressions import F as F
|
||||||
|
|||||||
@@ -177,3 +177,7 @@ class CombinedExpression(SQLiteNumericMixin, Expression):
|
|||||||
summarize: bool = ...,
|
summarize: bool = ...,
|
||||||
for_save: bool = ...,
|
for_save: bool = ...,
|
||||||
) -> CombinedExpression: ...
|
) -> CombinedExpression: ...
|
||||||
|
|
||||||
|
|
||||||
|
class F(Combinable):
|
||||||
|
def __init__(self, name: str): ...
|
||||||
@@ -35,3 +35,7 @@ class SlugField(CharField):
|
|||||||
|
|
||||||
class TextField(Field):
|
class TextField(Field):
|
||||||
def __get__(self, instance, owner) -> str: ...
|
def __get__(self, instance, owner) -> str: ...
|
||||||
|
|
||||||
|
|
||||||
|
class BooleanField(Field):
|
||||||
|
def __get__(self, instance, owner) -> bool: ...
|
||||||
|
|||||||
34
django-stubs/db/transaction.pyi
Normal file
34
django-stubs/db/transaction.pyi
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
from contextlib import ContextDecorator
|
||||||
|
from typing import Any, Callable, Optional, Union, ContextManager
|
||||||
|
|
||||||
|
from django.db import ProgrammingError
|
||||||
|
|
||||||
|
|
||||||
|
class TransactionManagementError(ProgrammingError): ...
|
||||||
|
|
||||||
|
def get_connection(using: Optional[str] = ...) -> Any: ...
|
||||||
|
def get_autocommit(using: Optional[str] = ...) -> bool: ...
|
||||||
|
def set_autocommit(autocommit: bool, using: None = ...) -> Any: ...
|
||||||
|
def commit(using: None = ...) -> Any: ...
|
||||||
|
def rollback(using: None = ...) -> Any: ...
|
||||||
|
def savepoint(using: None = ...) -> str: ...
|
||||||
|
def savepoint_rollback(sid: str, using: None = ...) -> None: ...
|
||||||
|
def savepoint_commit(sid: Any, using: Optional[Any] = ...) -> None: ...
|
||||||
|
def clean_savepoints(using: Optional[Any] = ...) -> None: ...
|
||||||
|
def get_rollback(using: None = ...) -> bool: ...
|
||||||
|
def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ...
|
||||||
|
def on_commit(func: Callable, using: None = ...) -> None: ...
|
||||||
|
|
||||||
|
class Atomic(ContextDecorator):
|
||||||
|
using: Optional[str] = ...
|
||||||
|
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 atomic(
|
||||||
|
using: Optional[Union[Callable, str]] = ..., savepoint: bool = ...
|
||||||
|
) -> ContextManager[Atomic]: ...
|
||||||
|
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||||
33
django-stubs/db/utils.pyi
Normal file
33
django-stubs/db/utils.pyi
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULT_DB_ALIAS: str
|
||||||
|
DJANGO_VERSION_PICKLE_KEY: str
|
||||||
|
|
||||||
|
class Error(Exception): ...
|
||||||
|
class InterfaceError(Error): ...
|
||||||
|
class DatabaseError(Error): ...
|
||||||
|
class DataError(DatabaseError): ...
|
||||||
|
class OperationalError(DatabaseError): ...
|
||||||
|
class IntegrityError(DatabaseError): ...
|
||||||
|
class InternalError(DatabaseError): ...
|
||||||
|
class ProgrammingError(DatabaseError): ...
|
||||||
|
class NotSupportedError(DatabaseError): ...
|
||||||
|
|
||||||
|
def load_backend(backend_name: str) -> Any: ...
|
||||||
|
|
||||||
|
class ConnectionDoesNotExist(Exception): ...
|
||||||
|
|
||||||
|
class ConnectionHandler:
|
||||||
|
databases: Dict[str, Dict[str, Optional[Any]]]
|
||||||
|
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: ...
|
||||||
|
def __setitem__(self, key: Any, value: Any) -> None: ...
|
||||||
|
def __delitem__(self, key: Any) -> None: ...
|
||||||
|
def __iter__(self): ...
|
||||||
|
def all(self) -> List[Any]: ...
|
||||||
|
def close_all(self) -> None: ...
|
||||||
@@ -1,21 +1,20 @@
|
|||||||
from django.http.cookie import SimpleCookie, parse_cookie
|
from .request import (HttpRequest as HttpRequest)
|
||||||
from django.http.request import (
|
|
||||||
HttpRequest, QueryDict, RawPostDataException, UnreadablePostError,
|
|
||||||
)
|
|
||||||
from django.http.response import (
|
|
||||||
BadHeaderError, FileResponse, Http404, HttpResponse,
|
|
||||||
HttpResponseBadRequest, HttpResponseForbidden, HttpResponseGone,
|
|
||||||
HttpResponseNotAllowed, HttpResponseNotFound, HttpResponseNotModified,
|
|
||||||
HttpResponsePermanentRedirect, HttpResponseRedirect,
|
|
||||||
HttpResponseServerError, JsonResponse, StreamingHttpResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
from .response import (BadHeaderError as BadHeaderError,
|
||||||
'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict',
|
FileResponse as FileResponse,
|
||||||
'RawPostDataException', 'UnreadablePostError',
|
Http404 as Http404,
|
||||||
'HttpResponse', 'StreamingHttpResponse', 'HttpResponseRedirect',
|
HttpResponse as HttpResponse,
|
||||||
'HttpResponsePermanentRedirect', 'HttpResponseNotModified',
|
HttpResponseBadRequest as HttpResponseBadRequest,
|
||||||
'HttpResponseBadRequest', 'HttpResponseForbidden', 'HttpResponseNotFound',
|
HttpResponseForbidden as HttpResponseForbidden,
|
||||||
'HttpResponseNotAllowed', 'HttpResponseGone', 'HttpResponseServerError',
|
HttpResponseGone as HttpResponseGone,
|
||||||
'Http404', 'BadHeaderError', 'JsonResponse', 'FileResponse',
|
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)
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# Stubs for django.http.cookie (Python 3.5)
|
from typing import Any, Dict
|
||||||
|
|
||||||
from typing import Dict
|
SimpleCookie: Any
|
||||||
from http.cookies import SimpleCookie, Morsel
|
|
||||||
|
|
||||||
cookie_pickles_properly = ... # type: bool
|
|
||||||
|
|
||||||
def parse_cookie(cookie: str) -> Dict[str, str]: ...
|
def parse_cookie(cookie: str) -> Dict[str, str]: ...
|
||||||
|
|||||||
91
django-stubs/http/multipartparser.pyi
Normal file
91
django-stubs/http/multipartparser.pyi
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
from io import BytesIO
|
||||||
|
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] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
|
||||||
|
def parse(self) -> Tuple[QueryDict, MultiValueDict]: ...
|
||||||
|
|
||||||
|
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 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 __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
|
||||||
|
]
|
||||||
|
]: ...
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
from .base import ( # type: ignore # stub not done yet
|
from .conf import (
|
||||||
clear_script_prefix, clear_url_caches, get_script_prefix, get_urlconf,
|
include as include,
|
||||||
is_valid_path, resolve, reverse, reverse_lazy, set_script_prefix,
|
path as path,
|
||||||
set_urlconf, translate_url,
|
re_path as re_path
|
||||||
)
|
)
|
||||||
from .exceptions import NoReverseMatch, Resolver404 # type: ignore # stub not done yet
|
|
||||||
from .resolvers import (
|
from .resolvers import (
|
||||||
LocaleRegexProvider, LocaleRegexURLResolver, RegexURLPattern,
|
LocaleRegexProvider, LocaleRegexURLResolver, RegexURLPattern,
|
||||||
RegexURLResolver, ResolverMatch, get_ns_resolver, get_resolver,
|
RegexURLResolver, ResolverMatch, get_ns_resolver, get_resolver,
|
||||||
|
|||||||
33
django-stubs/urls/base.pyi
Normal file
33
django-stubs/urls/base.pyi
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from django.urls.resolvers import ResolverMatch
|
||||||
|
|
||||||
|
from .exceptions import NoReverseMatch, Resolver404
|
||||||
|
from .resolvers import get_ns_resolver, get_resolver
|
||||||
|
from .utils import get_callable
|
||||||
|
|
||||||
|
|
||||||
|
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]
|
||||||
|
]
|
||||||
|
] = ...,
|
||||||
|
current_app: Optional[str] = ...,
|
||||||
|
) -> str: ...
|
||||||
|
|
||||||
|
reverse_lazy: Any
|
||||||
|
|
||||||
|
def clear_url_caches() -> None: ...
|
||||||
|
def set_script_prefix(prefix: str) -> None: ...
|
||||||
|
def get_script_prefix() -> str: ...
|
||||||
|
def clear_script_prefix() -> None: ...
|
||||||
|
def set_urlconf(urlconf_name: Optional[Union[Type[Any], str]]) -> None: ...
|
||||||
|
def get_urlconf(default: None = ...) -> Optional[Union[Type[Any], str]]: ...
|
||||||
|
def is_valid_path(path: str, urlconf: Optional[str] = ...) -> bool: ...
|
||||||
|
def translate_url(url: str, lang_code: str) -> str: ...
|
||||||
23
django-stubs/urls/conf.pyi
Normal file
23
django-stubs/urls/conf.pyi
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from typing import Any, Callable, List, Optional, Tuple, Union
|
||||||
|
|
||||||
|
from django.urls.resolvers import URLPattern, URLResolver
|
||||||
|
|
||||||
|
from .resolvers import (LocalePrefixPattern, RegexPattern, RoutePattern,
|
||||||
|
URLPattern, URLResolver)
|
||||||
|
|
||||||
|
|
||||||
|
def include(
|
||||||
|
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]
|
||||||
|
]: ...
|
||||||
|
|
||||||
|
path: Any
|
||||||
|
re_path: Any
|
||||||
35
django-stubs/urls/converters.pyi
Normal file
35
django-stubs/urls/converters.pyi
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
from typing import Any, Dict, Type, Union
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
|
||||||
|
class IntConverter:
|
||||||
|
regex: str = ...
|
||||||
|
def to_python(self, value: str) -> int: ...
|
||||||
|
def to_url(self, value: Union[int, str]) -> str: ...
|
||||||
|
|
||||||
|
class StringConverter:
|
||||||
|
regex: str = ...
|
||||||
|
def to_python(self, value: str) -> str: ...
|
||||||
|
def to_url(self, value: Union[int, str, UUID]) -> Union[int, str, UUID]: ...
|
||||||
|
|
||||||
|
class UUIDConverter:
|
||||||
|
regex: str = ...
|
||||||
|
def to_python(self, value: str) -> UUID: ...
|
||||||
|
def to_url(self, value: Union[str, UUID]) -> str: ...
|
||||||
|
|
||||||
|
class SlugConverter(StringConverter):
|
||||||
|
regex: str = ...
|
||||||
|
|
||||||
|
class PathConverter(StringConverter):
|
||||||
|
regex: str = ...
|
||||||
|
|
||||||
|
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]: ...
|
||||||
9
django-stubs/urls/exceptions.pyi
Normal file
9
django-stubs/urls/exceptions.pyi
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django.http import Http404
|
||||||
|
|
||||||
|
|
||||||
|
class Resolver404(Http404):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class NoReverseMatch(Exception):
|
||||||
|
pass
|
||||||
@@ -1,75 +1,132 @@
|
|||||||
# Stubs for django.urls.resolvers (Python 3.5)
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
|
||||||
#
|
|
||||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
|
||||||
|
|
||||||
from typing import Any, Callable, Dict, Iterable, List, Optional, Pattern, Tuple, Union
|
from django.urls.converters import UUIDConverter
|
||||||
|
|
||||||
from django.http.response import HttpResponse
|
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
|
|
||||||
# Auxiliar types
|
|
||||||
URLPattern = Union['RegexURLResolver', 'RegexURLPattern']
|
|
||||||
Params = Dict[str, object] # Arguments for views
|
|
||||||
# Auxiliar type for allowed resolver configurations
|
|
||||||
URLConf = Union[str, List[URLPattern]]
|
|
||||||
|
|
||||||
# The result type for regex_helper.normalize()
|
|
||||||
NormalizedRegexForms = List[Tuple[str, List[str]]]
|
|
||||||
ReverseLookup = MultiValueDict[str, Tuple[NormalizedRegexForms, str, Params]]
|
|
||||||
Namespace = Dict[str, Tuple[str, 'RegexURLResolver']]
|
|
||||||
AppDict = Dict[str, List[str]]
|
|
||||||
|
|
||||||
_View = Callable[..., HttpResponse]
|
|
||||||
|
|
||||||
class ResolverMatch:
|
class ResolverMatch:
|
||||||
func = ... # type: Callable
|
func: Callable = ...
|
||||||
args = ... # type: Iterable[object]
|
args: Tuple = ...
|
||||||
kwargs = ... # type: Params
|
kwargs: Dict[str, Any] = ...
|
||||||
url_name = ... # type: Optional[str]
|
url_name: Optional[str] = ...
|
||||||
app_names = ... # type: List[str]
|
app_names: List[str] = ...
|
||||||
app_name = ... # type: str
|
app_name: str = ...
|
||||||
namespaces = ... # type: List[str]
|
namespaces: List[str] = ...
|
||||||
namespace = ... # type: str
|
namespace: str = ...
|
||||||
view_name = ... # type: str
|
view_name: str = ...
|
||||||
def __init__(self, func: Callable, args: Iterable[object], kwargs: Params, url_name: str=None, app_names: Iterable[str]=None, namespaces: Iterable[str]=None) -> None: ...
|
def __init__(
|
||||||
|
self,
|
||||||
|
func: Callable,
|
||||||
|
args: Tuple,
|
||||||
|
kwargs: Dict[str, Any],
|
||||||
|
url_name: Optional[str] = ...,
|
||||||
|
app_names: Optional[List[Optional[str]]] = ...,
|
||||||
|
namespaces: Optional[List[Optional[str]]] = ...,
|
||||||
|
) -> None: ...
|
||||||
def __getitem__(self, index: int) -> Any: ...
|
def __getitem__(self, index: int) -> Any: ...
|
||||||
|
|
||||||
def get_resolver(urlconf: Optional[URLConf]=None) -> 'RegexURLResolver': ...
|
def get_resolver(
|
||||||
def get_ns_resolver(ns_pattern: str, resolver: 'RegexURLResolver') -> 'RegexURLResolver': ...
|
urlconf: Optional[Union[Type[Any], str]] = ...
|
||||||
|
) -> URLResolver: ...
|
||||||
|
def get_ns_resolver(
|
||||||
|
ns_pattern: str, resolver: URLResolver, converters: Tuple
|
||||||
|
) -> URLResolver: ...
|
||||||
|
|
||||||
class LocaleRegexProvider:
|
class LocaleRegexDescriptor:
|
||||||
def __init__(self, regex: Optional[str]) -> None: ...
|
attr: str = ...
|
||||||
|
def __init__(self, attr: Any) -> None: ...
|
||||||
|
def __get__(
|
||||||
|
self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...
|
||||||
|
) -> LocaleRegexDescriptor: ...
|
||||||
|
|
||||||
|
class CheckURLMixin:
|
||||||
|
def describe(self) -> str: ...
|
||||||
|
|
||||||
|
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 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 check(self) -> List[Warning]: ...
|
||||||
|
|
||||||
|
class LocalePrefixPattern:
|
||||||
|
prefix_default_language: bool = ...
|
||||||
|
converters: Dict[Any, Any] = ...
|
||||||
|
def __init__(self, prefix_default_language: bool = ...) -> None: ...
|
||||||
@property
|
@property
|
||||||
def regex(self) -> Pattern[str]: ...
|
def regex(self): ...
|
||||||
|
@property
|
||||||
|
def language_prefix(self) -> str: ...
|
||||||
|
def match(
|
||||||
|
self, path: str
|
||||||
|
) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||||
|
def check(self) -> List[Any]: ...
|
||||||
|
def describe(self) -> str: ...
|
||||||
|
|
||||||
class RegexURLPattern(LocaleRegexProvider):
|
class URLPattern:
|
||||||
callback = ... # type: _View
|
lookup_str: str
|
||||||
default_args = ... # type: Params
|
pattern: Any = ...
|
||||||
name = ... # type: Optional[str]
|
callback: Callable = ...
|
||||||
def __init__(self, regex: str, callback: _View, default_args: Params=None, name: str=None) -> None: ...
|
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] = ...,
|
||||||
|
) -> None: ...
|
||||||
|
def check(self) -> List[Warning]: ...
|
||||||
def resolve(self, path: str) -> Optional[ResolverMatch]: ...
|
def resolve(self, path: str) -> Optional[ResolverMatch]: ...
|
||||||
def lookup_str(self) -> str: ...
|
|
||||||
|
|
||||||
class RegexURLResolver(LocaleRegexProvider):
|
class URLResolver:
|
||||||
urlconf_name = ... # type: URLConf
|
url_patterns: List[Tuple[str, Callable]]
|
||||||
default_kwargs = ... # type: Params
|
urlconf_module: Optional[Union[List[Tuple[str, Callable]], Type[Any]]]
|
||||||
namespace = ... # type: Optional[str]
|
pattern: Any = ...
|
||||||
app_name = ... # type: Optional[str]
|
urlconf_name: Optional[str] = ...
|
||||||
def __init__(self, regex: Optional[str], urlconf_name: URLConf, default_kwargs: Params=None, app_name: str=None, namespace: str=None) -> None: ...
|
callback: None = ...
|
||||||
|
default_kwargs: Dict[str, Union[Dict[Any, Any], str]] = ...
|
||||||
|
namespace: Optional[str] = ...
|
||||||
|
app_name: Optional[str] = ...
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
pattern: Any,
|
||||||
|
urlconf_name: Optional[str],
|
||||||
|
default_kwargs: Optional[
|
||||||
|
Union[Dict[str, Dict[Any, Any]], Dict[str, str]]
|
||||||
|
] = ...,
|
||||||
|
app_name: Optional[str] = ...,
|
||||||
|
namespace: Optional[str] = ...,
|
||||||
|
) -> None: ...
|
||||||
@property
|
@property
|
||||||
def reverse_dict(self) -> ReverseLookup: ...
|
def reverse_dict(self) -> MultiValueDict: ...
|
||||||
@property
|
@property
|
||||||
def namespace_dict(self) -> Namespace: ...
|
def namespace_dict(self) -> Dict[str, Tuple[str, URLResolver]]: ...
|
||||||
@property
|
@property
|
||||||
def app_dict(self) -> AppDict: ...
|
def app_dict(self) -> Dict[str, List[str]]: ...
|
||||||
def resolve(self, path: str) -> ResolverMatch: ...
|
def resolve(self, path: str) -> ResolverMatch: ...
|
||||||
def urlconf_module(self) -> Union[Iterable[URLPattern], Any]: ...
|
def urlconf_module(
|
||||||
def url_patterns(self) -> Iterable[URLPattern]: ...
|
self
|
||||||
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Params]: ...
|
) -> Optional[Union[List[Tuple[str, Callable]], Type[Any]]]: ...
|
||||||
def reverse(self, lookup_view: str, *args: object, **kwargs: object) -> str: ...
|
def url_patterns(self) -> List[Tuple[str, Callable]]: ...
|
||||||
|
def resolve_error_handler(
|
||||||
class LocaleRegexURLResolver(RegexURLResolver):
|
self, view_type: int
|
||||||
prefix_default_language = ... # type: bool
|
) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||||
def __init__(self, urlconf_name: URLConf, default_kwargs: Params=None, app_name: str=None, namespace: str=None, prefix_default_language: bool=True) -> None: ...
|
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...
|
||||||
@property
|
|
||||||
def regex(self) -> Pattern[str]: ...
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Stubs for django.urls.utils (Python 3.5)
|
|
||||||
|
|
||||||
from typing import Callable, Tuple, Union
|
from typing import Callable, Tuple, Union
|
||||||
|
|
||||||
def get_callable(lookup_view: Union[str, Callable]) -> Callable: ...
|
|
||||||
|
def get_callable(lookup_view: Union[Callable, str]) -> Callable: ...
|
||||||
|
|
||||||
|
|
||||||
def get_mod_func(callback: str) -> Tuple[str, str]: ...
|
def get_mod_func(callback: str) -> Tuple[str, str]: ...
|
||||||
|
|||||||
Reference in New Issue
Block a user