diff --git a/third_party/2and3/pymysql/connections.pyi b/third_party/2and3/pymysql/connections.pyi index 098c17708..3789924b8 100644 --- a/third_party/2and3/pymysql/connections.pyi +++ b/third_party/2and3/pymysql/connections.pyi @@ -100,10 +100,10 @@ class Connection: def __enter__(self): ... def __exit__(self, exc, value, traceback): ... def query(self, sql): ... - def next_result(self): ... + def next_result(self, unbuffered: bool = ...): ... def affected_rows(self): ... def kill(self, thread_id): ... - def ping(self, reconnect=True): ... + def ping(self, reconnect: bool = ...): ... def set_charset(self, charset): ... def read_packet(self, packet_type=...): ... def insert_id(self): ... @@ -112,6 +112,7 @@ class Connection: def get_host_info(self): ... def get_proto_info(self): ... def get_server_info(self): ... + def show_warnings(self): ... Warning = ... # type: Any Error = ... # type: Any InterfaceError = ... # type: Any diff --git a/third_party/2and3/pymysql/cursors.pyi b/third_party/2and3/pymysql/cursors.pyi index be8cb90ee..80f37c101 100644 --- a/third_party/2and3/pymysql/cursors.pyi +++ b/third_party/2and3/pymysql/cursors.pyi @@ -1,4 +1,4 @@ -from typing import Union, Tuple, Any, Dict, Optional, Text +from typing import Union, Tuple, Any, Dict, Optional, Text, Iterator, List from .connections import Connection Gen = Union[Tuple[Any, ...], Dict[str, Any]] @@ -22,12 +22,25 @@ class Cursor: def executemany(self, query: str, args) -> int: ... def callproc(self, procname, args=...): ... def fetchone(self) -> Optional[Gen]: ... - def fetchmany(self, size: Optional[int] = ...) -> Optional[Gen]: ... + def fetchmany(self, size: Optional[int] = ...) -> Union[Optional[Gen], List[Gen]]: ... def fetchall(self) -> Optional[Tuple[Gen, ...]]: ... - def scroll(self, value, mode=''): ... + def scroll(self, value: int, mode: str = ...): ... def __iter__(self): ... class DictCursor(Cursor): def fetchone(self) -> Optional[Dict[str, Any]]: ... - def fetchmany(self, size=None) -> Optional[Tuple[Dict[str, Any], ...]]: ... + def fetchmany(self, size: Optional[int] = ...) -> Optional[Tuple[Dict[str, Any], ...]]: ... def fetchall(self) -> Optional[Tuple[Dict[str, Any], ...]]: ... + +class DictCursorMixin: + dict_type = ... # type: Any + +class SSCursor(Cursor): + # fetchall return type is incompatible with the supertype. + def fetchall(self) -> List[Gen]: ... # type: ignore + def fetchall_unbuffered(self) -> Iterator[Tuple[Gen, ...]]: ... + def __iter__(self) -> Iterator[Tuple[Gen, ...]]: ... + def fetchmany(self, size: Optional[int] = ...) -> List[Gen]: ... + def scroll(self, value: int, mode: str = ...) -> None: ... + +class SSDictCursor(DictCursorMixin, SSCursor): ...