Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions stubs/psycopg2/psycopg2/_psycopg.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from typing import Any, Callable, TypeVar, overload
from _typeshed import Self
from collections.abc import Callable, Iterable, Mapping, Sequence
from types import TracebackType
from typing import Any, TypeVar, overload

import psycopg2
import psycopg2.extensions

_Vars = Sequence[Any] | Mapping[str, Any] | None

BINARY: Any
BINARYARRAY: Any
BOOLEAN: Any
Expand Down Expand Up @@ -358,8 +363,8 @@ class cursor:
def copy_expert(self, sql, file, size=...): ...
def copy_from(self, file, table, sep=..., null=..., size=..., columns=...): ...
def copy_to(self, file, table, sep=..., null=..., columns=...): ...
def execute(self, query, vars=...): ...
def executemany(self, query, vars_list): ...
def execute(self, query: str | bytes, vars: _Vars = ...) -> None: ...
def executemany(self, query: str | bytes, vars_list: Iterable[_Vars]) -> None: ...
Comment on lines +366 to +367

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

psycopg2 also accepts Composable as the query: #7494.

def fetchall(self) -> list[tuple[Any, ...]]: ...
def fetchmany(self, size=...) -> list[tuple[Any, ...]]: ...
def fetchone(self) -> tuple[Any, ...] | Any: ...
Expand All @@ -368,10 +373,12 @@ class cursor:
def scroll(self, value, mode=...): ...
def setinputsizes(self, sizes): ...
def setoutputsize(self, size, column=...): ...
def __enter__(self): ...
def __exit__(self, type, value, traceback): ...
def __iter__(self): ...
def __next__(self): ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __iter__(self: Self) -> Self: ...
def __next__(self) -> tuple[Any, ...]: ...

class lobject:
closed: Any
Expand Down