File: base.pyi

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (44 lines) | stat: -rw-r--r-- 1,798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from collections.abc import Callable, Mapping, Sequence
from typing import Any, Literal, TypeAlias

from django.http.request import QueryDict
from django.http.response import HttpResponseBase
from django.urls.resolvers import ResolverMatch
from django.utils.functional import _StrPromise

# https://github.com/python/typeshed/blob/87f599dc8312ac67b941b5f2b47274534a1a2d3a/stdlib/urllib/parse.pyi#L136-L138
_QueryType: TypeAlias = (
    Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]]
)

def resolve(path: str | _StrPromise, urlconf: str | None = ...) -> ResolverMatch: ...

# NOTE: make sure `reverse` and `reverse_lazy` objects are in sync:
def reverse(
    viewname: Callable[..., HttpResponseBase] | str | None,
    urlconf: str | None = None,
    args: Sequence[Any] | None = None,
    kwargs: dict[str, Any] | None = None,
    current_app: str | None = None,
    *,
    query: QueryDict | _QueryType | None = None,
    fragment: str | None = None,
) -> str: ...
def reverse_lazy(
    viewname: Callable[..., HttpResponseBase] | str | None,
    urlconf: str | None = None,
    args: Sequence[Any] | None = None,
    kwargs: dict[str, Any] | None = None,
    current_app: str | None = None,
    *,
    query: QueryDict | _QueryType | None = None,
    fragment: str | None = None,
) -> _StrPromise: ...
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: str | None) -> None: ...
def get_urlconf(default: str | None = ...) -> str | None: ...
def is_valid_path(path: str, urlconf: str | None = ...) -> Literal[False] | ResolverMatch: ...
def translate_url(url: str, lang_code: str) -> str: ...