f"cannot adapt type {cls.__name__} to format {Format(format).name}"
)
- def load_rows(self, row0: int, row1: int) -> Sequence[Tuple[Any, ...]]:
+ def load_rows(self, row0: int, row1: int) -> List[Tuple[Any, ...]]:
res = self._pgresult
if not res:
raise e.InterfaceError("result not set")
self._pos += 1
return record
- def fetchmany(self, size: int = 0) -> List[Sequence[Any]]:
+ def fetchmany(self, size: int = 0) -> Sequence[Sequence[Any]]:
"""
Return the next *size* records from the current recordset.
self._pos, min(self._pos + size, self.pgresult.ntuples)
)
self._pos += len(records)
- return records # type: ignore[return-value]
+ return records
- def fetchall(self) -> List[Sequence[Any]]:
+ def fetchall(self) -> Sequence[Sequence[Any]]:
"""
Return all the remaining records from the current recordset.
"""
assert self.pgresult
records = self._transformer.load_rows(self._pos, self.pgresult.ntuples)
self._pos += self.pgresult.ntuples
- return records # type: ignore[return-value]
+ return records
def __iter__(self) -> Iterator[Sequence[Any]]:
self._check_result()
self._pos += 1
return rv
- async def fetchmany(self, size: int = 0) -> List[Sequence[Any]]:
+ async def fetchmany(self, size: int = 0) -> Sequence[Sequence[Any]]:
self._check_result()
assert self.pgresult
self._pos, min(self._pos + size, self.pgresult.ntuples)
)
self._pos += len(records)
- return records # type: ignore[return-value]
+ return records
- async def fetchall(self) -> List[Sequence[Any]]:
+ async def fetchall(self) -> Sequence[Sequence[Any]]:
self._check_result()
assert self.pgresult
records = self._transformer.load_rows(self._pos, self.pgresult.ntuples)
self._pos += self.pgresult.ntuples
- return records # type: ignore[return-value]
+ return records
async def __aiter__(self) -> AsyncIterator[Sequence[Any]]:
self._check_result()
def get_dumper(self, obj: Any, format: Format) -> "Dumper":
...
- def load_rows(self, row0: int, row1: int) -> Sequence[Tuple[Any, ...]]:
+ def load_rows(self, row0: int, row1: int) -> List[Tuple[Any, ...]]:
...
def load_row(self, row: int) -> Optional[Tuple[Any, ...]]:
)
@classmethod
- def _from_records(cls, recs: List[Any]) -> Optional["CompositeInfo"]:
+ def _from_records(cls, recs: Sequence[Any]) -> Optional["CompositeInfo"]:
if not recs:
return None
if len(recs) > 1:
# Copyright (C) 2020 The Psycopg Team
import re
-from typing import Any, Dict, Generic, List, Optional, TypeVar, Type, Union
+from typing import Any, Dict, Generic, Optional, Sequence, TypeVar, Type, Union
from typing import cast, TYPE_CHECKING
from decimal import Decimal
from datetime import date, datetime
)
@classmethod
- def _from_records(cls, recs: List[Any]) -> Optional["RangeInfo"]:
+ def _from_records(cls, recs: Sequence[Any]) -> Optional["RangeInfo"]:
if not recs:
return None
if len(recs) > 1:
self, params: Sequence[Any], formats: Sequence[Format]
) -> Tuple[List[Any], Tuple[int, ...]]: ...
def get_dumper(self, obj: Any, format: Format) -> Dumper: ...
- def load_rows(self, row0: int, row1: int) -> Sequence[Tuple[Any, ...]]: ...
+ def load_rows(self, row0: int, row1: int) -> List[Tuple[Any, ...]]: ...
def load_row(self, row: int) -> Optional[Tuple[Any, ...]]: ...
def load_sequence(
self, record: Sequence[Optional[bytes]]
return ps, ts
- def load_rows(self, int row0, int row1) -> Sequence[Tuple[Any, ...]]:
+ def load_rows(self, int row0, int row1) -> List[Tuple[Any, ...]]:
if self._pgresult is None:
raise e.InterfaceError("result not set")