Use lowercase type everywhere (#6853)

This commit is contained in:
Alex Waygood
2022-01-08 15:09:29 +00:00
committed by GitHub
parent f8501d33c7
commit a40d79a4e6
172 changed files with 728 additions and 761 deletions

View File

@@ -1,5 +1,5 @@
from socket import socket as _socket
from typing import Any, AnyStr, Generic, Mapping, Type, TypeVar, overload
from typing import Any, AnyStr, Generic, Mapping, 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
@@ -133,7 +133,7 @@ class Connection(Generic[_C]):
conv=...,
use_unicode: bool | None = ...,
client_flag: int = ...,
cursorclass: Type[_C] = ..., # different between overloads
cursorclass: type[_C] = ..., # different between overloads
init_command: Any | None = ...,
connect_timeout: int | None = ...,
ssl: Mapping[Any, Any] | None = ...,
@@ -178,7 +178,7 @@ class Connection(Generic[_C]):
@overload
def cursor(self, cursor: None = ...) -> _C: ...
@overload
def cursor(self, cursor: Type[_C2]) -> _C2: ...
def cursor(self, cursor: type[_C2]) -> _C2: ...
def query(self, sql, unbuffered: bool = ...) -> int: ...
def next_result(self, unbuffered: bool = ...) -> int: ...
def affected_rows(self): ...

View File

@@ -2,9 +2,9 @@ import datetime
import time
from collections.abc import Callable, Mapping, Sequence
from decimal import Decimal
from typing import Any, Optional, Type, TypeVar
from typing import Any, Optional, TypeVar
_EscaperMapping = Optional[Mapping[Type[object], Callable[..., str]]]
_EscaperMapping = Optional[Mapping[type[object], Callable[..., str]]]
_T = TypeVar("_T")
def escape_item(val: object, charset: object, mapping: _EscaperMapping = ...) -> str: ...
@@ -33,7 +33,7 @@ def through(x: _T) -> _T: ...
convert_bit = through
encoders: dict[Type[object], Callable[..., str]]
encoders: dict[type[object], Callable[..., str]]
decoders: dict[int, Callable[[str | bytes], Any]]
conversions: dict[Type[object] | int, Callable[..., Any]]
conversions: dict[type[object] | int, Callable[..., Any]]
Thing2Literal = escape_str

View File

@@ -1,5 +1,5 @@
import builtins
from typing import NoReturn, Type
from typing import NoReturn
from .constants import ER as ER
@@ -15,6 +15,6 @@ class InternalError(DatabaseError): ...
class ProgrammingError(DatabaseError): ...
class NotSupportedError(DatabaseError): ...
error_map: dict[int, Type[DatabaseError]]
error_map: dict[int, type[DatabaseError]]
def raise_mysql_exception(data) -> NoReturn: ...