From 94d3b990465a5d3b128cd4321b2914aa505926cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 15 Aug 2019 17:05:12 +0300 Subject: [PATCH] [3.6] Type hint istr keys allowed in LooseHeaders (#3976) (cherry picked from commit ec5aee70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ville Skyttä --- CHANGES/3976.bugfix | 1 + aiohttp/typedefs.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 CHANGES/3976.bugfix diff --git a/CHANGES/3976.bugfix b/CHANGES/3976.bugfix new file mode 100644 index 00000000000..4e567ff3a11 --- /dev/null +++ b/CHANGES/3976.bugfix @@ -0,0 +1 @@ +Accept istr keys in LooseHeaders type hints. diff --git a/aiohttp/typedefs.py b/aiohttp/typedefs.py index d7c97a435dd..3c42f6abe30 100644 --- a/aiohttp/typedefs.py +++ b/aiohttp/typedefs.py @@ -12,7 +12,13 @@ Union, ) -from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy +from multidict import ( + CIMultiDict, + CIMultiDictProxy, + MultiDict, + MultiDictProxy, + istr, +) from yarl import URL DEFAULT_JSON_ENCODER = json.dumps @@ -33,7 +39,8 @@ Byteish = Union[bytes, bytearray, memoryview] JSONEncoder = Callable[[Any], str] JSONDecoder = Callable[[str], Any] -LooseHeaders = Union[Mapping[str, str], _CIMultiDict, _CIMultiDictProxy] +LooseHeaders = Union[Mapping[Union[str, istr], str], _CIMultiDict, + _CIMultiDictProxy] RawHeaders = Tuple[Tuple[bytes, bytes], ...] StrOrURL = Union[str, URL] LooseCookies = Union[Iterable[Tuple[str, 'BaseCookie[str]']],