File: encoding.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 (74 lines) | stat: -rw-r--r-- 3,332 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import datetime
from decimal import Decimal
from typing import Any, Literal, TypeGuard, TypeVar, overload

from django.utils.functional import Promise

class DjangoUnicodeDecodeError(UnicodeDecodeError):
    obj: bytes
    def __init__(self, obj: bytes, *args: Any) -> None: ...

_P = TypeVar("_P", bound=Promise)
_S = TypeVar("_S", bound=str)
_B = TypeVar("_B", bound=bytes)
_PT = TypeVar("_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time)

@overload
def smart_str(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ...
@overload
def smart_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ...
@overload
def smart_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ...
@overload
def smart_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ...
@overload
def smart_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ...
@overload
def smart_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ...
def is_protected_type(obj: Any) -> TypeGuard[_PT]: ...
@overload
def force_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ...
@overload
def force_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ...
@overload
def force_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ...
@overload
def force_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ...
@overload
def force_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ...
@overload
def smart_bytes(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ...
@overload
def smart_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ...
@overload
def smart_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ...
@overload
def smart_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ...
@overload
def smart_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ...
@overload
def force_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ...
@overload
def force_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ...
@overload
def force_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ...
@overload
def force_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ...
@overload
def iri_to_uri(iri: None) -> None: ...
@overload
def iri_to_uri(iri: str | Promise) -> str: ...
@overload
def uri_to_iri(uri: None) -> None: ...
@overload
def uri_to_iri(uri: Any) -> str: ...
def escape_uri_path(path: str) -> str: ...
def punycode(domain: str) -> str: ...
def repercent_broken_unicode(path: bytes) -> bytes: ...
@overload
def filepath_to_uri(path: None) -> None: ...
@overload
def filepath_to_uri(path: str) -> str: ...
def get_system_encoding() -> str: ...

DEFAULT_LOCALE_ENCODING: str