diff --git a/stubs/hdbcli/hdbcli/dbapi.pyi b/stubs/hdbcli/hdbcli/dbapi.pyi index 758b7d4d2..c236a8880 100644 --- a/stubs/hdbcli/hdbcli/dbapi.pyi +++ b/stubs/hdbcli/hdbcli/dbapi.pyi @@ -4,13 +4,13 @@ from collections.abc import Sequence from datetime import date, datetime, time from types import TracebackType from typing import Any, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from .resultrow import ResultRow apilevel: str threadsafety: int -paramstyle: tuple[str, ...] +paramstyle: tuple[str, ...] # hdbcli defines it as a tuple which does not follow PEP 249 connect = Connection class Connection: @@ -47,7 +47,7 @@ class LOB: def read(self, size: int = ..., position: int = ...) -> str | bytes: ... def write(self, object: str | bytes) -> int: ... -_Parameters: TypeAlias = Sequence[tuple[Any, ...]] +_Parameters: TypeAlias = Sequence[tuple[Any, ...]] | None class Cursor: description: tuple[tuple[Any, ...], ...] @@ -55,17 +55,17 @@ class Cursor: statementhash: str | None connection: Connection arraysize: int - refreshts: Incomplete + refreshts: int | None maxage: int def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __enter__(self) -> Incomplete: ... + def __enter__(self) -> Self: ... def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... def callproc(self, procname: str, parameters: tuple[Any, ...] = ..., overview: bool = ...) -> tuple[Any, ...]: ... def close(self) -> None: ... def description_ext(self) -> Sequence[tuple[Any, ...]]: ... - def execute(self, operation: str, parameters: tuple[Any, ...]) -> bool: ... - def executemany(self, operation: str, parameters: _Parameters) -> Any: ... - def executemanyprepared(self, parameters: _Parameters) -> Any: ... + def execute(self, operation: str, parameters: tuple[Any, ...] | None = ...) -> bool: ... + def executemany(self, operation: str, parameters: _Parameters = ...) -> Any: ... + def executemanyprepared(self, parameters: _Parameters = ...) -> Any: ... def executeprepared(self, parameters: _Parameters = ...) -> Any: ... def fetchone(self, uselob: bool = ...) -> ResultRow | None: ... def fetchall(self) -> list[ResultRow]: ... diff --git a/stubs/hdbcli/hdbcli/resultrow.pyi b/stubs/hdbcli/hdbcli/resultrow.pyi index cf0ee12ec..8c3da3881 100644 --- a/stubs/hdbcli/hdbcli/resultrow.pyi +++ b/stubs/hdbcli/hdbcli/resultrow.pyi @@ -1,6 +1,15 @@ -from typing import Any +from collections.abc import Iterator, Sequence +from typing import Any, overload class ResultRow: def __init__(self, *args: Any, **kwargs: Any) -> None: ... column_names: tuple[str, ...] column_values: tuple[Any, ...] + + def __len__(self) -> int: ... + @overload + def __getitem__(self, index: int) -> Any: ... + @overload + def __getitem__(self, index: slice) -> Sequence[Any]: ... + def __iter__(self) -> Iterator[Any]: ... + # __next__, __delitem__, __setitem__ are technically defined but lead always to an error