From 51bb92fcf0fd1cf3d6478d3b82cacb0231cd3951 Mon Sep 17 00:00:00 2001 From: Rob Haswell Date: Wed, 26 May 2021 13:08:52 +0100 Subject: [PATCH] Allow type checkers to determine that entering a PoolAcquireContext returns a Connection. --- asyncpg/pool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncpg/pool.py b/asyncpg/pool.py index c4321a2f..1710e8ec 100644 --- a/asyncpg/pool.py +++ b/asyncpg/pool.py @@ -779,7 +779,7 @@ def __init__(self, pool, timeout): self.connection = None self.done = False - async def __aenter__(self): + async def __aenter__(self) -> connection.Connection: if self.connection is not None or self.done: raise exceptions.InterfaceError('a connection is already acquired') self.connection = await self.pool._acquire(self.timeout)