Skip to content

Commit dffac8b

Browse files
[Backport 8.15] Fix aiohttp call type: ignore differently (#193)
(cherry picked from commit d50788d) Co-authored-by: Quentin Pradet <[email protected]>
1 parent 3daf810 commit dffac8b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

elastic_transport/_node/_http_aiohttp.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import re
2424
import ssl
2525
import warnings
26-
from typing import Any, MutableMapping, Optional, Union
26+
from typing import Optional, TypedDict, Union
2727

2828
from .._compat import warn_stacklevel
2929
from .._exceptions import ConnectionError, ConnectionTimeout, SecurityWarning, TlsError
@@ -55,6 +55,10 @@
5555

5656
# See aio-libs/aiohttp#1769 and #5012
5757
_AIOHTTP_FIXED_HEAD_BUG = _AIOHTTP_SEMVER_VERSION >= (3, 7, 0)
58+
59+
class RequestKwarg(TypedDict, total=False):
60+
ssl: aiohttp.Fingerprint
61+
5862
except ImportError: # pragma: nocover
5963
_AIOHTTP_AVAILABLE = False
6064
_AIOHTTP_META_VERSION = ""
@@ -170,7 +174,7 @@ async def perform_request( # type: ignore[override]
170174
else:
171175
body_to_send = None
172176

173-
kwargs: MutableMapping[str, Any] = {}
177+
kwargs: RequestKwarg = {}
174178
if self._ssl_assert_fingerprint:
175179
kwargs["ssl"] = aiohttp_fingerprint(self._ssl_assert_fingerprint)
176180

@@ -182,7 +186,7 @@ async def perform_request( # type: ignore[override]
182186
data=body_to_send,
183187
headers=request_headers,
184188
timeout=aiohttp_timeout,
185-
**kwargs, # type: ignore[arg-type]
189+
**kwargs,
186190
) as response:
187191
if is_head: # We actually called 'GET' so throw away the data.
188192
await response.release()

0 commit comments

Comments
 (0)