-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Wrong type hint for tracing Signal sequence #3595
Copy link
Copy link
Closed
Labels
Description
Long story short
Type hints for tracing Signal contents look wrong.
Expected behaviour
mypy does not report an error when adding handlers to a signal object.
Actual behaviour
mypy reports an error of
error: List item 0 has incompatible type "Callable[[ClientSession, SimpleNamespace, TraceConnectionCreateEndParams], Coroutine[Any, Any, None]]"; expected "Callable[[TraceConfig], Awaitable[None]]"Steps to reproduce
Run mypy over this snippet
import types
import aiohttp
import datadog
async def reuse_keepalive_connection(
session: aiohttp.ClientSession,
trace_config_ctx: types.SimpleNamespace,
params: aiohttp.TraceConnectionReuseconnParams,
) -> None:
"""statsd counter; how often has a connection been reused"""
datadog.statsd.increment("client.request.connection.reuse")
tracer = aiohttp.TraceConfig()
tracer.on_connection_reuseconn.extend([reuse_keepalive_connection])Your environment
aiohttp 3.5.4
python 3.7.2
mypy 0.660
Reactions are currently unavailable