mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 08:17:08 +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]: ...
|
||||
Reference in New Issue
Block a user