Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong type hint for tracing Signal sequence #3595

Open
stj opened this issue Feb 6, 2019 · 2 comments

Comments

@stj
Copy link
Contributor

commented Feb 6, 2019

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

@stj stj referenced this issue Feb 6, 2019
1 of 5 tasks complete
@aio-libs-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 6, 2019

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #401 (Signals), #1749 (Type hinting in code), #3230 (iter_chunks type annotation wrong), #3032 (Doc: signals), and #1309 (Client Tracing).

@asvetlov

This comment has been minimized.

Copy link
Member

commented May 8, 2019

Fixed by #3596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.