Added missing type annotations in various stdlib stubs. (#4402)

Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
Eric Traut
2020-08-06 18:27:21 -07:00
committed by GitHub
parent 10a5b070ab
commit baaffed1ac
7 changed files with 43 additions and 42 deletions

View File

@@ -15,9 +15,9 @@ Date = date
Time = time
Timestamp = datetime
def DateFromTicks(ticks): ...
def TimeFromTicks(ticks): ...
def TimestampFromTicks(ticks): ...
def DateFromTicks(ticks: float) -> Date: ...
def TimeFromTicks(ticks: float) -> Time: ...
def TimestampFromTicks(ticks: float) -> Timestamp: ...
version_info: str
sqlite_version_info: Tuple[int, int, int]
@@ -26,8 +26,6 @@ if sys.version_info >= (3,):
else:
Binary = buffer
def register_adapters_and_converters(): ...
# The remaining definitions are imported from _sqlite3.
PARSE_COLNAMES: int
@@ -134,7 +132,7 @@ class Connection(object):
row_factory: Any
text_factory: Any
total_changes: Any
def __init__(self, *args, **kwargs): ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def close(self) -> None: ...
def commit(self) -> None: ...
def create_aggregate(self, name: str, num_params: int, aggregate_class: type) -> None: ...
@@ -148,16 +146,16 @@ class Connection(object):
# TODO: please check in executemany() if seq_of_parameters type is possible like this
def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable[Any]]) -> Cursor: ...
def executescript(self, sql_script: Union[bytes, Text]) -> Cursor: ...
def interrupt(self, *args, **kwargs) -> None: ...
def iterdump(self, *args, **kwargs) -> Generator[str, None, None]: ...
def rollback(self, *args, **kwargs) -> None: ...
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: ...
# TODO: set_authorizer(authorzer_callback)
# see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_authorizer
# returns [SQLITE_OK, SQLITE_DENY, SQLITE_IGNORE] so perhaps int
def set_authorizer(self, *args, **kwargs) -> None: ...
def set_authorizer(self, *args: Any, **kwargs: Any) -> None: ...
# set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler
def set_progress_handler(self, *args, **kwargs) -> None: ...
def set_trace_callback(self, *args, **kwargs): ...
def set_progress_handler(self, *args: Any, **kwargs: Any) -> None: ...
def set_trace_callback(self, *args: Any, **kwargs: Any) -> None: ...
# enable_load_extension and load_extension is not available on python distributions compiled
# without sqlite3 loadable extension support. see footnotes https://docs.python.org/3/library/sqlite3.html#f1
def enable_load_extension(self, enabled: bool) -> None: ...
@@ -172,9 +170,9 @@ class Connection(object):
name: str = ...,
sleep: float = ...,
) -> None: ...
def __call__(self, *args, **kwargs): ...
def __enter__(self, *args, **kwargs) -> Connection: ...
def __exit__(self, *args, **kwargs): ...
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: ...
class Cursor(Iterator[Any]):
arraysize: Any
@@ -186,16 +184,16 @@ class Cursor(Iterator[Any]):
# TODO: Cursor class accepts exactly 1 argument
# required type is sqlite3.Connection (which is imported as _Connection)
# however, the name of the __init__ variable is unknown
def __init__(self, *args, **kwargs) -> None: ...
def close(self, *args, **kwargs) -> None: ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
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 fetchall(self) -> List[Any]: ...
def fetchmany(self, size: Optional[int] = ...) -> List[Any]: ...
def fetchone(self) -> Any: ...
def setinputsizes(self, *args, **kwargs) -> None: ...
def setoutputsize(self, *args, **kwargs) -> None: ...
def setinputsizes(self, *args: Any, **kwargs: Any) -> None: ...
def setoutputsize(self, *args: Any, **kwargs: Any) -> None: ...
def __iter__(self) -> Cursor: ...
if sys.version_info >= (3, 0):
def __next__(self) -> Any: ...
@@ -280,13 +278,13 @@ else:
def __rmul__(self, other): ...
class PrepareProtocol(object):
def __init__(self, *args, **kwargs): ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
class ProgrammingError(DatabaseError): ...
class Row(object):
def __init__(self, *args, **kwargs): ...
def keys(self, *args, **kwargs): ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def keys(self, *args: Any, **kwargs: Any): ...
def __eq__(self, other): ...
def __ge__(self, other): ...
def __getitem__(self, index): ...
@@ -294,7 +292,7 @@ class Row(object):
def __hash__(self): ...
def __iter__(self): ...
def __le__(self, other): ...
def __len__(self, *args, **kwargs): ...
def __len__(self, *args: Any, **kwargs: Any): ...
def __lt__(self, other): ...
def __ne__(self, other): ...