Skip to content

Commit 7e836db

Browse files
authored
Move abstract methods to AbstractConnectionPool (#6340)
1 parent 6708ffa commit 7e836db

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
psycopg2.connection
22
psycopg2.cursor
3+
psycopg2.pool.AbstractConnectionPool.closeall
4+
psycopg2.pool.AbstractConnectionPool.getconn
5+
psycopg2.pool.AbstractConnectionPool.putconn

stubs/psycopg2/psycopg2/pool.pyi

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ class AbstractConnectionPool:
99
maxconn: Any
1010
closed: bool
1111
def __init__(self, minconn, maxconn, *args, **kwargs) -> None: ...
12+
# getconn, putconn and closeall are officially documented as methods of the
13+
# abstract base class, but in reality, they only exist on the children classes
14+
def getconn(self, key: Any | None = ...): ...
15+
def putconn(self, conn: Any, key: Any | None = ..., close: bool = ...) -> None: ...
16+
def closeall(self) -> None: ...
1217

13-
class SimpleConnectionPool(AbstractConnectionPool):
14-
getconn: Any
15-
putconn: Any
16-
closeall: Any
18+
class SimpleConnectionPool(AbstractConnectionPool): ...
1719

1820
class ThreadedConnectionPool(AbstractConnectionPool):
19-
def __init__(self, minconn, maxconn, *args, **kwargs) -> None: ...
20-
def getconn(self, key: Any | None = ...): ...
21+
# This subclass has a default value for conn which doesn't exist
22+
# in the SimpleConnectionPool class, nor in the documentation
2123
def putconn(self, conn: Any | None = ..., key: Any | None = ..., close: bool = ...) -> None: ...
22-
def closeall(self) -> None: ...

0 commit comments

Comments
 (0)