From fe5e12795f5ab4bdd405d839566c4c2b5af00ae7 Mon Sep 17 00:00:00 2001 From: David Euresti Date: Sun, 11 Feb 2018 08:19:39 -0800 Subject: [PATCH] Fix signature of CaseInsensitiveDict (#1873) The values can be more than just strings. --- third_party/2and3/requests/structures.pyi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/third_party/2and3/requests/structures.pyi b/third_party/2and3/requests/structures.pyi index ad9044f2b..9956e9c5a 100644 --- a/third_party/2and3/requests/structures.pyi +++ b/third_party/2and3/requests/structures.pyi @@ -1,9 +1,11 @@ -from typing import Any, Iterator, MutableMapping, Text, Tuple, Union +from typing import Any, Iterator, MutableMapping, Tuple, TypeVar, Generic -class CaseInsensitiveDict(MutableMapping[str, Union[Text, bytes]]): - def lower_items(self) -> Iterator[Tuple[str, Union[Text, bytes]]]: ... - def __setitem__(self, key: str, value: Union[Text, bytes]) -> None: ... - def __getitem__(self, key: str) -> Union[Text, bytes]: ... +_VT = TypeVar('_VT') + +class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): + def lower_items(self) -> Iterator[Tuple[str, _VT]]: ... + def __setitem__(self, key: str, value: _VT) -> None: ... + def __getitem__(self, key: str) -> _VT: ... def __delitem__(self, key: str) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ...