2 from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Tuple, Union, overload
4 if sys.version_info >= (3, 9):
5 from types import GenericAlias
7 _Str = Union[bytes, str]
9 uses_relative: list[str]
10 uses_netloc: list[str]
11 uses_params: list[str]
12 non_hierarchical: list[str]
14 uses_fragment: list[str]
18 class _ResultMixinBase(Generic[AnyStr]):
19 def geturl(self) -> AnyStr: ...
21 class _ResultMixinStr(_ResultMixinBase[str]):
22 def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ...
24 class _ResultMixinBytes(_ResultMixinBase[str]):
25 def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ...
27 class _NetlocResultMixinBase(Generic[AnyStr]):
28 username: AnyStr | None
29 password: AnyStr | None
30 hostname: AnyStr | None
32 if sys.version_info >= (3, 9):
33 def __class_getitem__(cls, item: Any) -> GenericAlias: ...
35 class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ...
36 class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ...
38 class _DefragResultBase(Tuple[Any, ...], Generic[AnyStr]):
42 class _SplitResultBase(NamedTuple):
49 class _SplitResultBytesBase(NamedTuple):
56 class _ParseResultBase(NamedTuple):
64 class _ParseResultBytesBase(NamedTuple):
72 # Structured result objects for string data
73 class DefragResult(_DefragResultBase[str], _ResultMixinStr): ...
74 class SplitResult(_SplitResultBase, _NetlocResultMixinStr): ...
75 class ParseResult(_ParseResultBase, _NetlocResultMixinStr): ...
77 # Structured result objects for bytes data
78 class DefragResultBytes(_DefragResultBase[bytes], _ResultMixinBytes): ...
79 class SplitResultBytes(_SplitResultBytesBase, _NetlocResultMixinBytes): ...
80 class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ...
84 keep_blank_values: bool = ...,
85 strict_parsing: bool = ...,
88 max_num_fields: int | None = ...,
90 ) -> dict[AnyStr, list[AnyStr]]: ...
93 keep_blank_values: bool = ...,
94 strict_parsing: bool = ...,
97 max_num_fields: int | None = ...,
99 ) -> list[tuple[AnyStr, AnyStr]]: ...
101 def quote(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
103 def quote(string: bytes, safe: _Str = ...) -> str: ...
104 def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ...
106 def quote_plus(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
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: ...
113 def urldefrag(url: str) -> DefragResult: ...
115 def urldefrag(url: bytes | None) -> DefragResultBytes: ...
117 query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]],
122 quote_via: Callable[[str, AnyStr, str, str], str] = ...,
124 def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = ...) -> AnyStr: ...
126 def urlparse(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> ParseResult: ...
128 def urlparse(url: bytes | None, scheme: bytes | None = ..., allow_fragments: bool = ...) -> ParseResultBytes: ...
130 def urlsplit(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> SplitResult: ...
132 def urlsplit(url: bytes | None, scheme: bytes | None = ..., allow_fragments: bool = ...) -> SplitResultBytes: ...
135 components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]
138 def urlunparse(components: Sequence[AnyStr | None]) -> AnyStr: ...
140 def urlunsplit(components: tuple[AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None, AnyStr | None]) -> AnyStr: ...
142 def urlunsplit(components: Sequence[AnyStr | None]) -> AnyStr: ...