Python 3 stubs: use str instead of typing.Text (#7638)

This commit is contained in:
Alex Waygood
2022-04-16 15:47:00 +01:00
committed by GitHub
parent d802e65f67
commit 819900fa55
5 changed files with 56 additions and 45 deletions

View File

@@ -1,12 +1,12 @@
from _typeshed import Self
from collections.abc import Iterable, Iterator
from typing import Any, Text
from typing import Any
from .connections import Connection
class Cursor:
connection: Connection[Any]
description: tuple[Text, ...]
description: tuple[str, ...]
rownumber: int
rowcount: int
arraysize: int
@@ -19,11 +19,11 @@ class Cursor:
def setinputsizes(self, *args) -> None: ...
def setoutputsizes(self, *args) -> None: ...
def nextset(self) -> bool | None: ...
def mogrify(self, query: Text, args: object = ...) -> str: ...
def execute(self, query: Text, args: object = ...) -> int: ...
def executemany(self, query: Text, args: Iterable[object]) -> int | None: ...
def callproc(self, procname: Text, args: Iterable[Any] = ...) -> Any: ...
def scroll(self, value: int, mode: Text = ...) -> None: ...
def mogrify(self, query: str, args: object = ...) -> str: ...
def execute(self, query: str, args: object = ...) -> int: ...
def executemany(self, query: str, args: Iterable[object]) -> int | None: ...
def callproc(self, procname: str, args: Iterable[Any] = ...) -> Any: ...
def scroll(self, value: int, mode: str = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *exc_info: object) -> None: ...
# Methods returning result tuples are below.
@@ -34,17 +34,17 @@ class Cursor:
class DictCursorMixin:
dict_type: Any # TODO: add support if someone needs this
def fetchone(self) -> dict[Text, Any] | None: ...
def fetchmany(self, size: int | None = ...) -> tuple[dict[Text, Any], ...]: ...
def fetchall(self) -> tuple[dict[Text, Any], ...]: ...
def __iter__(self) -> Iterator[dict[Text, Any]]: ...
def fetchone(self) -> dict[str, Any] | None: ...
def fetchmany(self, size: int | None = ...) -> tuple[dict[str, Any], ...]: ...
def fetchall(self) -> tuple[dict[str, Any], ...]: ...
def __iter__(self) -> Iterator[dict[str, Any]]: ...
class SSCursor(Cursor):
def fetchall(self) -> list[tuple[Any, ...]]: ... # type: ignore[override]
def fetchall_unbuffered(self) -> Iterator[tuple[Any, ...]]: ...
def scroll(self, value: int, mode: Text = ...) -> None: ...
def scroll(self, value: int, mode: str = ...) -> None: ...
class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc]
class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore[misc]
def fetchall_unbuffered(self) -> Iterator[dict[Text, Any]]: ... # type: ignore[override]
def fetchall_unbuffered(self) -> Iterator[dict[str, Any]]: ... # type: ignore[override]