Skip to content

Commit

Permalink
fix: fix type for parse_search_params()
Browse files Browse the repository at this point in the history
  • Loading branch information
Master-Hash committed Oct 31, 2023
1 parent a3bbeaa commit d617183
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ada_url/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ada_url.ada_adapter import (
URL,
HostType,
SchemeType,
URL,
URLSearchParams,
check_url,
idna,
Expand Down
16 changes: 13 additions & 3 deletions ada_url/ada_adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
from enum import IntEnum
from typing import Final, Iterable, Iterator, List, Optional, Tuple, TypedDict, Union
from typing import (
Dict,
Final,
Iterable,
Iterator,
List,
Optional,
Tuple,
TypedDict,
Union,
)

from ada_url._ada_wrapper import ffi, lib

Expand Down Expand Up @@ -648,7 +658,7 @@ def replace_url(s: str, **kwargs: str) -> str:
return _get_str(lib.ada_get_href(urlobj))


def parse_search_params(s: str) -> dict:
def parse_search_params(s: str) -> Dict[str, List[str]]:
"""
Returns a dictionary representing the parsed URL Parameters specified by *s*.
The returned dictionary maps each key to a list of values associated with it.
Expand All @@ -660,7 +670,7 @@ def parse_search_params(s: str) -> dict:
{'key1': ['value1', 'value2'], 'key2': ['value3']}
"""
ret = {}
ret: Dict[str, List[str]] = {}
for key, value in URLSearchParams(s).items():
if key not in ret:
ret[key] = [value]
Expand Down

0 comments on commit d617183

Please sign in to comment.