mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Fix stubs for pymysql (#3781)
This commit is contained in:
44
third_party/2and3/pymysql/cursors.pyi
vendored
44
third_party/2and3/pymysql/cursors.pyi
vendored
@@ -1,8 +1,9 @@
|
||||
from typing import Any, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union
|
||||
from typing import Any, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union, Iterable
|
||||
|
||||
from .connections import Connection
|
||||
|
||||
Gen = Union[Tuple[Any, ...], Dict[str, Any]]
|
||||
_Gen = Union[Tuple[Any, ...], Dict[Text, Any]]
|
||||
_QueryArgs = Union[Tuple[Any, ...], List[Any], Dict[Text, Any], None]
|
||||
_SelfT = TypeVar("_SelfT")
|
||||
|
||||
class Cursor:
|
||||
@@ -17,34 +18,35 @@ class Cursor:
|
||||
def __init__(self, connection: Connection) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def setinputsizes(self, *args): ...
|
||||
def setoutputsizes(self, *args): ...
|
||||
def nextset(self): ...
|
||||
def execute(self, query: str, args: Optional[Any] = ...) -> int: ...
|
||||
def executemany(self, query: str, args) -> int: ...
|
||||
def callproc(self, procname, args=...): ...
|
||||
def fetchone(self) -> Optional[Gen]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> Union[Optional[Gen], List[Gen]]: ...
|
||||
def fetchall(self) -> Optional[Tuple[Gen, ...]]: ...
|
||||
def scroll(self, value: int, mode: str = ...): ...
|
||||
def __iter__(self): ...
|
||||
def setinputsizes(self, *args) -> None: ...
|
||||
def setoutputsizes(self, *args) -> None: ...
|
||||
def nextset(self) -> Optional[bool]: ...
|
||||
def mogrify(self, query: Text, args: _QueryArgs = ...) -> str: ...
|
||||
def execute(self, query: Text, args: _QueryArgs = ...) -> int: ...
|
||||
def executemany(self, query: Text, args: Iterable[_QueryArgs]) -> Optional[int]: ...
|
||||
def callproc(self, procname: Text, args: Iterable[Any] = ...) -> Any: ...
|
||||
def fetchone(self) -> Optional[_Gen]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> Union[Optional[_Gen], List[_Gen]]: ...
|
||||
def fetchall(self) -> Optional[Tuple[_Gen, ...]]: ...
|
||||
def scroll(self, value: int, mode: Text = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[_Gen]: ...
|
||||
def __enter__(self: _SelfT) -> _SelfT: ...
|
||||
def __exit__(self, *exc_info: Any) -> None: ...
|
||||
|
||||
class DictCursor(Cursor):
|
||||
def fetchone(self) -> Optional[Dict[str, Any]]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> Optional[Tuple[Dict[str, Any], ...]]: ...
|
||||
def fetchall(self) -> Optional[Tuple[Dict[str, Any], ...]]: ...
|
||||
def fetchone(self) -> Optional[Dict[Text, Any]]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> Optional[Tuple[Dict[Text, Any], ...]]: ...
|
||||
def fetchall(self) -> Optional[Tuple[Dict[Text, Any], ...]]: ...
|
||||
|
||||
class DictCursorMixin:
|
||||
dict_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: ...
|
||||
def fetchall(self) -> List[_Gen]: ... # type: ignore
|
||||
def fetchall_unbuffered(self) -> Iterator[_Gen]: ...
|
||||
def __iter__(self) -> Iterator[_Gen]: ...
|
||||
def fetchmany(self, size: Optional[int] = ...) -> List[_Gen]: ...
|
||||
def scroll(self, value: int, mode: Text = ...) -> None: ...
|
||||
|
||||
class SSDictCursor(DictCursorMixin, SSCursor): ...
|
||||
|
||||
Reference in New Issue
Block a user