Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 11:05:21 +02:00
1 parent b9adb7a874
commit ee487304d7
578 files changed
+8080 -8966

No files matched your search

+13 -13
View File
@@ -1,7 +1,7 @@
import sys
from _typeshed import Self, StrOrBytesPath
from datetime import date, datetime, time
from typing import Any, Callable, Generator, Iterable, Iterator, List, Optional, Protocol, Tuple, Type, TypeVar, Union
from typing import Any, Callable, Generator, Iterable, Iterator, List, Protocol, Tuple, Type, TypeVar
_T = TypeVar("_T")
@@ -69,28 +69,28 @@ if sys.version_info >= (3, 7):
database: StrOrBytesPath,
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 = ...,
uri: bool = ...,
) -> Connection: ...
else:
def connect(
database: Union[bytes, str],
database: bytes | str,
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 = ...,
uri: bool = ...,
) -> 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: ...
if sys.version_info < (3, 8):
@@ -128,11 +128,11 @@ class Connection(object):
def create_function(self, name: str, narg: int, func: Any, *, deterministic: bool = ...) -> None: ...
else:
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, str]) -> Cursor: ...
def executescript(self, __sql_script: bytes | str) -> 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: ...
@@ -153,13 +153,13 @@ class Connection(object):
target: Connection,
*,
pages: int = ...,
progress: Optional[Callable[[int, int, int], object]] = ...,
progress: Callable[[int, int, int], object] | None = ...,
name: str = ...,
sleep: float = ...,
) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def __enter__(self: Self) -> Self: ...
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
@@ -175,9 +175,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, str]) -> Cursor: ...
def executescript(self, __sql_script: bytes | str) -> 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: ...