-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
sqlite3: add 3.11 additions #7625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import sys | ||
from _typeshed import Self, StrOrBytesPath | ||
from _typeshed import ReadableBuffer, Self, StrOrBytesPath | ||
from datetime import date, datetime, time | ||
from types import TracebackType | ||
from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, TypeVar | ||
from typing import Any, Callable, Generator, Iterable, Iterator, Protocol, TypeVar, overload | ||
from typing_extensions import Literal, final | ||
|
||
_T = TypeVar("_T") | ||
_SqliteData = str | bytes | int | float | None | ||
|
||
paramstyle: str | ||
threadsafety: int | ||
|
@@ -125,9 +126,27 @@ if sys.version_info < (3, 8): | |
def get(self, *args, **kwargs) -> None: ... | ||
|
||
class _AggregateProtocol(Protocol): | ||
def step(self, value: int) -> None: ... | ||
def step(self, value: int) -> object: ... | ||
def finalize(self) -> int: ... | ||
|
||
class _SingleParamWindowAggregateClass(Protocol): | ||
def step(self, __param: Any) -> object: ... | ||
def inverse(self, __param: Any) -> object: ... | ||
def value(self) -> _SqliteData: ... | ||
def finalize(self) -> _SqliteData: ... | ||
|
||
class _AnyParamWindowAggregateClass(Protocol): | ||
def step(self, *args: Any) -> object: ... | ||
def inverse(self, *args: Any) -> object: ... | ||
def value(self) -> _SqliteData: ... | ||
def finalize(self) -> _SqliteData: ... | ||
|
||
class _WindowAggregateClass(Protocol): | ||
step: Callable[..., object] | ||
inverse: Callable[..., object] | ||
def value(self) -> _SqliteData: ... | ||
def finalize(self) -> _SqliteData: ... | ||
|
||
class Connection: | ||
DataError: Any | ||
DatabaseError: Any | ||
|
@@ -146,8 +165,28 @@ class Connection: | |
total_changes: Any | ||
def __init__(self, *args: Any, **kwargs: Any) -> None: ... | ||
def close(self) -> None: ... | ||
if sys.version_info >= (3, 11): | ||
def blobopen(self, __table: str, __column: str, __row: int, *, readonly: bool = ..., name: str = ...) -> Blob: ... | ||
|
||
def commit(self) -> None: ... | ||
def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ... | ||
if sys.version_info >= (3, 11): | ||
# num_params determines how many params will be passed to the aggregate class. We provide an overload | ||
# for the case where num_params = 1, which is expected to be the common case. | ||
@overload | ||
def create_window_function( | ||
self, __name: str, __num_params: Literal[1], __aggregate_class: Callable[[], _SingleParamWindowAggregateClass] | None | ||
) -> None: ... | ||
# And for num_params = -1, which means the aggregate must accept any number of parameters. | ||
@overload | ||
def create_window_function( | ||
self, __name: str, __num_params: Literal[-1], __aggregate_class: Callable[[], _AnyParamWindowAggregateClass] | None | ||
) -> None: ... | ||
@overload | ||
def create_window_function( | ||
self, __name: str, __num_params: int, __aggregate_class: Callable[[], _WindowAggregateClass] | None | ||
) -> None: ... | ||
JelleZijlstra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def create_collation(self, __name: str, __callback: Any) -> None: ... | ||
if sys.version_info >= (3, 8): | ||
def create_function(self, name: str, narg: int, func: Any, *, deterministic: bool = ...) -> None: ... | ||
|
@@ -181,6 +220,11 @@ class Connection: | |
name: str = ..., | ||
sleep: float = ..., | ||
) -> None: ... | ||
if sys.version_info >= (3, 11): | ||
def setlimit(self, __category: int, __limit: int) -> int: ... | ||
def getlimit(self, __category: int) -> int: ... | ||
def serialize(self, *, name: str = ...) -> bytes: ... | ||
def deserialize(self, __data: ReadableBuffer, *, name: str = ...) -> None: ... | ||
|
||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ... | ||
def __enter__(self: Self) -> Self: ... | ||
|
@@ -253,3 +297,15 @@ if sys.version_info < (3, 8): | |
def __init__(self, *args, **kwargs): ... | ||
|
||
class Warning(Exception): ... | ||
|
||
if sys.version_info >= (3, 11): | ||
class Blob: | ||
def close(self) -> None: ... | ||
def read(self, __length: int = ...) -> bytes: ... | ||
def write(self, __data: bytes) -> None: ... | ||
def tell(self) -> int: ... | ||
# whence must be one of os.SEEK_SET, os.SEEK_CUR, os.SEEK_END | ||
def seek(self, __offset: int, __whence: int = ...) -> None: ... | ||
def __len__(self) -> int: ... | ||
def __enter__(self: Self) -> Self: ... | ||
def __exit__(self, __typ: object, __val: object, __tb: object) -> Literal[False]: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is going to anger my unreleased Y036 check over at flake8-pyi :/ PyCQA/flake8-pyi@b7f7e9a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm, do you think we should change it? This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'Kay, I'll work up a patch for flake8-pyi. It should be fine to merge this before flake8-pyi is fixed. |
Uh oh!
There was an error while loading. Please reload this page.