Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -1,5 +1,5 @@
from datetime import date, datetime, time
from typing import Any, Callable, Generator, Iterable, Iterator, List, Optional, Protocol, Text, Tuple, Type, TypeVar, Union
from typing import Any, Callable, Generator, Iterable, Iterator, List, Protocol, Text, Tuple, Type, TypeVar
_T = TypeVar("_T")
@@ -62,17 +62,17 @@ version: str
def adapt(obj, protocol, alternate): ...
def complete_statement(sql: str) -> bool: ...
def connect(
database: Union[bytes, Text],
database: bytes | Text,
timeout: float = ...,
detect_types: int = ...,
isolation_level: Optional[str] = ...,
isolation_level: str | None = ...,
check_same_thread: bool = ...,
factory: Optional[Type[Connection]] = ...,
factory: Type[Connection] | None = ...,
cached_statements: int = ...,
) -> Connection: ...
def enable_callback_tracebacks(__enable: bool) -> None: ...
def enable_shared_cache(enable: int) -> None: ...
def register_adapter(__type: Type[_T], __caster: Callable[[_T], Union[int, float, str, bytes]]) -> None: ...
def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | str | bytes]) -> None: ...
def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ...
class Cache(object):
@@ -106,11 +106,11 @@ class Connection(object):
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ...
def create_collation(self, __name: str, __callback: Any) -> None: ...
def create_function(self, name: str, num_params: int, func: Any) -> None: ...
def cursor(self, cursorClass: Optional[type] = ...) -> Cursor: ...
def cursor(self, cursorClass: type | None = ...) -> Cursor: ...
def execute(self, sql: str, parameters: Iterable[Any] = ...) -> Cursor: ...
# TODO: please check in executemany() if seq_of_parameters type is possible like this
def executemany(self, __sql: str, __parameters: Iterable[Iterable[Any]]) -> Cursor: ...
def executescript(self, __sql_script: Union[bytes, Text]) -> Cursor: ...
def executescript(self, __sql_script: bytes | Text) -> Cursor: ...
def interrupt(self, *args: Any, **kwargs: Any) -> None: ...
def iterdump(self, *args: Any, **kwargs: Any) -> Generator[str, None, None]: ...
def rollback(self, *args: Any, **kwargs: Any) -> None: ...
@@ -127,7 +127,7 @@ class Connection(object):
def load_extension(self, path: str) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __enter__(self) -> Connection: ...
def __exit__(self, t: Optional[type], exc: Optional[BaseException], tb: Optional[Any]) -> None: ...
def __exit__(self, t: type | None, exc: BaseException | None, tb: Any | None) -> None: ...
class Cursor(Iterator[Any]):
arraysize: Any
@@ -143,9 +143,9 @@ class Cursor(Iterator[Any]):
def close(self, *args: Any, **kwargs: Any) -> None: ...
def execute(self, __sql: str, __parameters: Iterable[Any] = ...) -> Cursor: ...
def executemany(self, __sql: str, __seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ...
def executescript(self, __sql_script: Union[bytes, Text]) -> Cursor: ...
def executescript(self, __sql_script: bytes | Text) -> Cursor: ...
def fetchall(self) -> List[Any]: ...
def fetchmany(self, size: Optional[int] = ...) -> List[Any]: ...
def fetchmany(self, size: int | None = ...) -> List[Any]: ...
def fetchone(self) -> Any: ...
def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ...
def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ...