Skip to content

Conversation

@robhaswell
Copy link

This branch allows type checking editors like VScode to determine that async with pg.acquire() as conn results in conn having a type of asyncpg.connection.Connection.

@robhaswellrobhaswell changed the title Allow type checkers to determine that entering a PoolAcquireContext returns a ConnectionAdd type hint to entering PoolAcquireContext.May 26, 2021
@MarsBatya
Copy link

i face the same issue today in 2022. and for whatever reason "-> connection.Connection:" doesn't seem to be working. But if i actually "from .connection import Connection" and make it "-> Connection:", everything works great. I don't feel like a very experienced pullrequester, can someone please check what's wrong 😂

@DanielNoord
Copy link
Contributor

DanielNoord commented Oct 29, 2024

See my explanation in #578 (comment).

This would actually be incorrect and I have proposed an improved patch in that PR.

I'd suggest closing this PR to not have two PRs open with the same intent.

@robhaswell
Copy link
Author

Thanks will do.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@robhaswell@MarsBatya@DanielNoord