From 2f0059fa8b248a6ccfd02912883678147f803617 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sun, 23 Jan 2022 23:22:16 +0100 Subject: [PATCH] Revert fix MultiDict typing with multidict-6.0.0 (#64733) (#64792) * revert #64733 * pin down multidict to < 6.0.0 --- homeassistant/package_constraints.txt | 4 ++++ homeassistant/util/aiohttp.py | 6 +++--- script/gen_requirements_all.py | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 81d219b8ad3eca..2deba3f4d1d4fb 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -95,3 +95,7 @@ pytest_asyncio==1000000000.0.0 # https://github.com/jkeljo/sisyphus-control/issues/6 python-engineio>=3.13.1,<4.0 python-socketio>=4.6.0,<5.0 + +# Constrain multidict to avoid typing issues +# https://github.com/home-assistant/core/pull/64792 +multidict<6.0.0 diff --git a/homeassistant/util/aiohttp.py b/homeassistant/util/aiohttp.py index 765a9994a6711e..aa1aea1abc3707 100644 --- a/homeassistant/util/aiohttp.py +++ b/homeassistant/util/aiohttp.py @@ -44,13 +44,13 @@ def __init__( self.method = method self.url = url self.status = status - self.headers: CIMultiDict[str, str] = CIMultiDict(headers or {}) + self.headers: CIMultiDict[str] = CIMultiDict(headers or {}) self.query_string = query_string or "" self._content = content self.mock_source = mock_source @property - def query(self) -> MultiDict[str, str]: + def query(self) -> MultiDict[str]: """Return a dictionary with the query variables.""" return MultiDict(parse_qsl(self.query_string, keep_blank_values=True)) @@ -68,7 +68,7 @@ async def json(self) -> Any: """Return the body as JSON.""" return json.loads(self._text) - async def post(self) -> MultiDict[str, str]: + async def post(self) -> MultiDict[str]: """Return POST parameters.""" return MultiDict(parse_qsl(self._text, keep_blank_values=True)) diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index 952bd8b8f48de5..bfba8bddd43d55 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -120,6 +120,10 @@ # https://github.com/jkeljo/sisyphus-control/issues/6 python-engineio>=3.13.1,<4.0 python-socketio>=4.6.0,<5.0 + +# Constrain multidict to avoid typing issues +# https://github.com/home-assistant/core/pull/64792 +multidict<6.0.0 """ IGNORE_PRE_COMMIT_HOOK_ID = (