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

Make PoolAcquireContext return a Connection type #578

Open
wants to merge 1 commit into
base: master
from

Conversation

@Yrlish
Copy link

@Yrlish Yrlish commented May 20, 2020

__aenter__ in PoolAcquireContext should be defined to return a Connection type. This will help IDEs to properly help suggesting methods when using syntax:

with my_pool.acquire() as con:
  con  # this is now defined as type Connection by the acquire method
  pass

instead of doing this:

with my_pool.acquire() as con:  # type: Connection
  pass

Before:
image

After:
image

`__aenter__` should be defined to return a `Connection` type. This will help IDEs to properly help suggesting methods when using with `pool.acquire() as con`
@Yrlish
Copy link
Author

@Yrlish Yrlish commented May 20, 2020

I forgot I have made an relevant issue 1.5 years ago #387.

@elprans
Copy link
Member

@elprans elprans commented Jul 18, 2020

There is a comprehensive effort to add type annotations in #577

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.