mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Use PEP 585 syntax wherever possible (#6717)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import sys
|
||||
from typing import FrozenSet
|
||||
|
||||
from .connections import Connection as Connection
|
||||
from .constants import FIELD_TYPE as FIELD_TYPE
|
||||
@@ -30,7 +29,7 @@ threadsafety: int
|
||||
apilevel: str
|
||||
paramstyle: str
|
||||
|
||||
class DBAPISet(FrozenSet[int]):
|
||||
class DBAPISet(frozenset[int]):
|
||||
def __ne__(self, other) -> bool: ...
|
||||
def __eq__(self, other) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from socket import socket as _socket
|
||||
from typing import Any, AnyStr, Generic, Mapping, Tuple, Type, TypeVar, overload
|
||||
from typing import Any, AnyStr, Generic, Mapping, Type, TypeVar, overload
|
||||
|
||||
from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name
|
||||
from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS
|
||||
@@ -35,7 +35,7 @@ class MysqlPacket:
|
||||
def read_uint64(self) -> Any: ...
|
||||
def read_length_encoded_integer(self) -> int: ...
|
||||
def read_length_coded_string(self) -> bytes: ...
|
||||
def read_struct(self, fmt: str) -> Tuple[Any, ...]: ...
|
||||
def read_struct(self, fmt: str) -> tuple[Any, ...]: ...
|
||||
def is_ok_packet(self) -> bool: ...
|
||||
def is_eof_packet(self) -> bool: ...
|
||||
def is_auth_switch_request(self) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterable, Iterator, Text, Tuple, TypeVar
|
||||
from typing import Any, Iterable, Iterator, Text, TypeVar
|
||||
|
||||
from .connections import Connection
|
||||
|
||||
@@ -6,7 +6,7 @@ _SelfT = TypeVar("_SelfT")
|
||||
|
||||
class Cursor:
|
||||
connection: Connection[Any]
|
||||
description: Tuple[Text, ...]
|
||||
description: tuple[Text, ...]
|
||||
rownumber: int
|
||||
rowcount: int
|
||||
arraysize: int
|
||||
@@ -27,21 +27,21 @@ class Cursor:
|
||||
def __enter__(self: _SelfT) -> _SelfT: ...
|
||||
def __exit__(self, *exc_info: Any) -> None: ...
|
||||
# Methods returning result tuples are below.
|
||||
def fetchone(self) -> Tuple[Any, ...] | None: ...
|
||||
def fetchmany(self, size: int | None = ...) -> Tuple[Tuple[Any, ...], ...]: ...
|
||||
def fetchall(self) -> Tuple[Tuple[Any, ...], ...]: ...
|
||||
def __iter__(self) -> Iterator[Tuple[Any, ...]]: ...
|
||||
def fetchone(self) -> tuple[Any, ...] | None: ...
|
||||
def fetchmany(self, size: int | None = ...) -> tuple[tuple[Any, ...], ...]: ...
|
||||
def fetchall(self) -> tuple[tuple[Any, ...], ...]: ...
|
||||
def __iter__(self) -> Iterator[tuple[Any, ...]]: ...
|
||||
|
||||
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 fetchmany(self, size: int | None = ...) -> tuple[dict[Text, Any], ...]: ...
|
||||
def fetchall(self) -> tuple[dict[Text, Any], ...]: ...
|
||||
def __iter__(self) -> Iterator[dict[Text, Any]]: ...
|
||||
|
||||
class SSCursor(Cursor):
|
||||
def fetchall(self) -> list[Tuple[Any, ...]]: ... # type: ignore[override]
|
||||
def fetchall_unbuffered(self) -> Iterator[Tuple[Any, ...]]: ...
|
||||
def fetchall(self) -> list[tuple[Any, ...]]: ... # type: ignore[override]
|
||||
def fetchall_unbuffered(self) -> Iterator[tuple[Any, ...]]: ...
|
||||
def scroll(self, value: int, mode: Text = ...) -> None: ...
|
||||
|
||||
class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc]
|
||||
|
||||
Reference in New Issue
Block a user