massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / urllib / parse.pyi
1 import sys
2 from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Tuple, Union, overload
3
4 if sys.version_info >= (3, 9):
5     from types import GenericAlias
6
7 _Str = Union[bytes, str]
8
9 uses_relative: list[str]
10 uses_netloc: list[str]
11 uses_params: list[str]
12 non_hierarchical: list[str]
13 uses_query: list[str]
14 uses_fragment: list[str]
15 scheme_chars: str
16 MAX_CACHE_SIZE: int
17
18 class _ResultMixinBase(Generic[AnyStr]):
19     def geturl(self) -> AnyStr: ...
20
21 class _ResultMixinStr(_ResultMixinBase[str]):
22     def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ...
23
24 class _ResultMixinBytes(_ResultMixinBase[str]):
25     def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ...
26
27 class _NetlocResultMixinBase(Generic[AnyStr]):
28     username: AnyStr | None
29     password: AnyStr | None
30     hostname: AnyStr | None
31     port: int | None
32     if sys.version_info >= (3, 9):
33         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
34
35 class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ...
36 class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ...
37
38 class _DefragResultBase(Tuple[Any, ...], Generic[AnyStr]):
39     url: AnyStr
40     fragment: AnyStr
41
42 class _SplitResultBase(NamedTuple):
43     scheme: str
44     netloc: str
45     path: str
46     query: str
47     fragment: str
48
49 class _SplitResultBytesBase(NamedTuple):
50     scheme: bytes
51     netloc: bytes
52     path: bytes
53     query: bytes
54     fragment: bytes
55
56 class _ParseResultBase(NamedTuple):
57     scheme: str
58     netloc: str
59     path: str
60     params: str
61     query: str
62     fragment: str
63
64 class _ParseResultBytesBase(NamedTuple):
65     scheme: bytes
66     netloc: bytes
67     path: bytes
68     params: bytes
69     query: bytes
70     fragment: bytes
71
72 # Structured result objects for string data
73 class DefragResult(_DefragResultBase[str], _ResultMixinStr): ...
74 class SplitResult(_SplitResultBase, _NetlocResultMixinStr): ...
75 class ParseResult(_ParseResultBase, _NetlocResultMixinStr): ...
76
77 # Structured result objects for bytes data
78 class DefragResultBytes(_DefragResultBase[bytes], _ResultMixinBytes): ...
79 class SplitResultBytes(_SplitResultBytesBase, _NetlocResultMixinBytes): ...
80 class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ...
81
82 def parse_qs(
83     qs: AnyStr | None,
84     keep_blank_values: bool = ...,
85     strict_parsing: bool = ...,
86     encoding: str = ...,
87     errors: str = ...,
88     max_num_fields: int | None = ...,
89     separator: str = ...,
90 ) -> dict[AnyStr, list[AnyStr]]: ...
91 def parse_qsl(
92     qs: AnyStr | None,
93     keep_blank_values: bool = ...,
94     strict_parsing: bool = ...,
95     encoding: str = ...,
96     errors: str = ...,
97     max_num_fields: int | None = ...,
98     separator: str = ...,
99 ) -> list[tuple[AnyStr, AnyStr]]: ...
100 @overload
101 def quote(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
102 @overload
103 def quote(string: bytes, safe: _Str = ...) -> str: ...
104 def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ...
105 @overload
106 def quote_plus(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
107 @overload
108 def quote_plus(string: bytes, safe: _Str = ...) -> str: ...
109 def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ...
110 def unquote_to_bytes(string: _Str) -> bytes: ...
111 def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ...
112 @overload
113 def urldefrag(url: str) -> DefragResult: ...
114 @overload
115 def urldefrag(url: bytes | None) -> DefragResultBytes: ...
116 def urlencode(
117     query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]],
118     doseq: bool = ...,
119     safe: AnyStr = ...,
120     encoding: str = ...,
121     errors: str = ...,
122     quote_via: Callable[[str, AnyStr, str, str], str] = ...,
123 ) -> str: ...
124 def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = ...) -> AnyStr: ...
125 @overload
126 def urlparse(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> ParseResult: ...
127 @overload
128 def urlparse(url: bytes | None, scheme: bytes | None = ..., allow_fragments: bool = ...) -> ParseResultBytes: ...
129 @overload
130 def urlsplit(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> SplitResult: ...
131 @overload
132 def urlsplit(url: bytes | None, scheme: bytes | None = ..., allow_fragments: bool = ...) -> SplitResultBytes: ...
133 @overload
134 def urlunparse(
135     components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]
136 ) -> AnyStr: ...
137 @overload
138 def urlunparse(components: Sequence[AnyStr | None]) -> AnyStr: ...
139 @overload
140 def urlunsplit(components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ...
141 @overload
142 def urlunsplit(components: Sequence[AnyStr | None]) -> AnyStr: ...