Skip to content

Commit 046db95

Browse files
authored
Add overloads for URL parameter functions
1 parent 4076e24 commit 046db95

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from re import Pattern
2-
from typing import Final, TypeAlias
2+
from typing import Final, TypeAlias, overload
33

44
always_safe: Final[str]
55
urlencoded: Final[set[str]]
@@ -9,10 +9,20 @@ _ExplodedQueryString: TypeAlias = list[tuple[str, str]]
99

1010
def url_encode(params: _ExplodedQueryString) -> str: ...
1111
def url_decode(query: str) -> _ExplodedQueryString: ...
12+
@overload
1213
def add_params_to_qs(query: str, params: _ExplodedQueryString) -> str: ...
14+
@overload
15+
def add_params_to_qs(query: str, params: dict[str, str]) -> str: ...
1316
def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = False) -> str: ...
1417
def quote(s: str, safe: bytes = b"/") -> str: ...
1518
def unquote(s: str | bytes) -> str: ...
1619
def quote_url(s: str) -> str: ...
17-
def extract_params(raw: dict[str, str] | _ExplodedQueryString) -> _ExplodedQueryString: ...
20+
@overload
21+
def extract_params(raw: None) -> None: ...
22+
@overload
23+
def extract_params(raw: dict[str, str]) -> _ExplodedQueryString: ...
24+
@overload
25+
def extract_params(raw: _ExplodedQueryString) -> _ExplodedQueryString: ...
26+
@overload
27+
def extract_params(raw: str) -> _ExplodedQueryString | None: ...
1828
def is_valid_url(url: str, fragments_allowed: bool = True) -> bool: ...

0 commit comments

Comments
 (0)