psycopg2: improve cursor_factory params (#11085)

This commit is contained in:
Avasam
2023-12-06 17:29:23 -05:00
committed by GitHub
parent aded4aa390
commit 4246c54a12
3 changed files with 13 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ _T_conn = TypeVar("_T_conn", bound=connection)
def connect(
dsn: str | None,
connection_factory: Callable[..., _T_conn],
cursor_factory: Callable[..., cursor] | None = None,
cursor_factory: Callable[[connection, str | bytes | None], cursor] | None = None,
**kwargs: Any,
) -> _T_conn: ...
@overload
@@ -47,13 +47,13 @@ def connect(
dsn: str | None = None,
*,
connection_factory: Callable[..., _T_conn],
cursor_factory: Callable[..., cursor] | None = None,
cursor_factory: Callable[[connection, str | bytes | None], cursor] | None = None,
**kwargs: Any,
) -> _T_conn: ...
@overload
def connect(
dsn: str | None = None,
connection_factory: Callable[..., connection] | None = None,
cursor_factory: Callable[..., cursor] | None = None,
cursor_factory: Callable[[connection, str | bytes | None], cursor] | None = None,
**kwargs: Any,
) -> connection: ...

View File

@@ -412,7 +412,7 @@ class connection:
def binary_types(self) -> dict[Incomplete, Incomplete]: ...
@property
def closed(self) -> int: ...
cursor_factory: Callable[..., _Cursor]
cursor_factory: Callable[[connection, str | bytes | None], cursor]
@property
def dsn(self) -> str: ...
@property
@@ -452,13 +452,13 @@ class connection:
@overload
def cursor(
self, name: str | bytes | None = None, cursor_factory: None = None, withhold: bool = False, scrollable: bool | None = None
) -> _Cursor: ...
) -> cursor: ...
@overload
def cursor(
self,
name: str | bytes | None = None,
*,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -466,7 +466,7 @@ class connection:
def cursor(
self,
name: str | bytes | None,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...

View File

@@ -46,7 +46,7 @@ class DictConnection(_connection):
self,
name: str | bytes | None = None,
*,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -54,7 +54,7 @@ class DictConnection(_connection):
def cursor(
self,
name: str | bytes | None,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -91,7 +91,7 @@ class RealDictConnection(_connection):
self,
name: str | bytes | None = None,
*,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -99,7 +99,7 @@ class RealDictConnection(_connection):
def cursor(
self,
name: str | bytes | None,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -128,7 +128,7 @@ class NamedTupleConnection(_connection):
self,
name: str | bytes | None = None,
*,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...
@@ -136,7 +136,7 @@ class NamedTupleConnection(_connection):
def cursor(
self,
name: str | bytes | None,
cursor_factory: Callable[..., _T_cur],
cursor_factory: Callable[[_connection, str | bytes | None], _T_cur],
withhold: bool = False,
scrollable: bool | None = None,
) -> _T_cur: ...