Skip to content

Commit d3889ed

Browse files
authored
[Authlib] add_params_to_qs, extract_params: Fix accepted types (#15786)
1 parent 4076e24 commit d3889ed

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

Lines changed: 8 additions & 3 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,15 @@ _ExplodedQueryString: TypeAlias = list[tuple[str, str]]
99

1010
def url_encode(params: _ExplodedQueryString) -> str: ...
1111
def url_decode(query: str) -> _ExplodedQueryString: ...
12-
def add_params_to_qs(query: str, params: _ExplodedQueryString) -> str: ...
12+
def add_params_to_qs(query: str, params: _ExplodedQueryString | dict[str, str]) -> str: ...
1313
def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = False) -> str: ...
1414
def quote(s: str, safe: bytes = b"/") -> str: ...
1515
def unquote(s: str | bytes) -> str: ...
1616
def quote_url(s: str) -> str: ...
17-
def extract_params(raw: dict[str, str] | _ExplodedQueryString) -> _ExplodedQueryString: ...
17+
@overload
18+
def extract_params(raw: None) -> None: ...
19+
@overload
20+
def extract_params(raw: dict[str, str]) -> _ExplodedQueryString: ...
21+
@overload
22+
def extract_params(raw: _ExplodedQueryString | tuple[tuple[str, str], ...] | str) -> _ExplodedQueryString | None: ...
1823
def is_valid_url(url: str, fragments_allowed: bool = True) -> bool: ...

0 commit comments

Comments
 (0)