mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 16:27:09 +08:00
initial commit
This commit is contained in:
41
django/urls/base.pyi
Normal file
41
django/urls/base.pyi
Normal file
@@ -0,0 +1,41 @@
|
||||
from django.urls.resolvers import ResolverMatch
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def clear_url_caches() -> None: ...
|
||||
|
||||
|
||||
def get_script_prefix() -> str: ...
|
||||
|
||||
|
||||
def get_urlconf(default: None = ...) -> Optional[Union[str, Type[object]]]: ...
|
||||
|
||||
|
||||
def is_valid_path(path: str, urlconf: Optional[str] = ...) -> bool: ...
|
||||
|
||||
|
||||
def resolve(path: str, urlconf: Optional[str] = ...) -> ResolverMatch: ...
|
||||
|
||||
|
||||
def reverse(
|
||||
viewname: Optional[Union[str, Callable]],
|
||||
urlconf: Optional[str] = ...,
|
||||
args: Any = ...,
|
||||
kwargs: Any = ...,
|
||||
current_app: Optional[str] = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def set_script_prefix(prefix: str) -> None: ...
|
||||
|
||||
|
||||
def set_urlconf(urlconf_name: Any) -> None: ...
|
||||
|
||||
|
||||
def translate_url(url: str, lang_code: str) -> str: ...
|
||||
23
django/urls/conf.pyi
Normal file
23
django/urls/conf.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
from django.urls.resolvers import (
|
||||
CheckURLMixin,
|
||||
URLPattern,
|
||||
URLResolver,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _path(
|
||||
route: str,
|
||||
view: Any,
|
||||
kwargs: Any = ...,
|
||||
name: Optional[str] = ...,
|
||||
Pattern: Type[CheckURLMixin] = ...
|
||||
) -> Union[URLPattern, URLResolver]: ...
|
||||
|
||||
|
||||
def include(arg: Any, namespace: Optional[str] = ...) -> Any: ...
|
||||
24
django/urls/converters.pyi
Normal file
24
django/urls/converters.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Union,
|
||||
)
|
||||
from urlpatterns.converters import DynamicConverter
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
def get_converter(raw_converter: str) -> Any: ...
|
||||
|
||||
|
||||
def get_converters(
|
||||
) -> Dict[str, Union[IntConverter, StringConverter, UUIDConverter, DynamicConverter]]: ...
|
||||
|
||||
|
||||
class IntConverter:
|
||||
def to_python(self, value: str) -> int: ...
|
||||
def to_url(self, value: Union[str, int]) -> str: ...
|
||||
|
||||
|
||||
class StringConverter:
|
||||
def to_python(self, value: str) -> str: ...
|
||||
def to_url(self, value: Union[str, UUID, int]) -> Union[str, UUID, int]: ...
|
||||
Reference in New Issue
Block a user