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

Add type hint to entering PoolAcquireContext. #763

Closed

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.

@robhaswell robhaswell changed the title Allow type checkers to determine that entering a PoolAcquireContext returns a Connection Add 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.

@robhaswell robhaswell closed this Oct 30, 2024
Sign up for free to 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