|
1 | 1 | # Filip Hron <filip.hron@gmail.com> |
2 | 2 | # based heavily on Andrey Vlasovskikh's python-skeletons https://github.com/JetBrains/python-skeletons/blob/master/sqlite3.py |
3 | 3 |
|
4 | | -from typing import Any, Union, List, Iterator, Optional |
| 4 | +import sys |
| 5 | +from typing import Any, Union, List, Iterator, Optional, TypeVar, Callable |
5 | 6 | from numbers import Integral |
6 | 7 | from datetime import time, datetime |
7 | 8 | from collections import Iterable |
8 | 9 |
|
9 | | -import sys |
| 10 | +_T = TypeVar('_T') |
10 | 11 |
|
11 | 12 | paramstyle = ... # type: str |
12 | 13 | threadsafety = ... # type: int |
|
74 | 75 | def connect(database: Union[bytes, str], timeout: float = ..., detect_types: int = ..., isolation_level: Union[str, None] = ..., check_same_thread: bool = ..., factory: Union[Connection, None] = ..., cached_statements: int = ...) -> Connection: ... |
75 | 76 | def enable_callback_tracebacks(flag: bool) -> None: ... |
76 | 77 | def enable_shared_cache(do_enable: int) -> None: ... |
77 | | -def register_adapter(type: type, callable: Any) -> None: ... |
| 78 | +def register_adapter(type: _T, callable: Callable[[_T], Union[int, float, str, bytes]]) -> None: ... |
78 | 79 | # TODO: sqlite3.register_converter.__doc__ specifies callable as unknown |
79 | | -def register_converter(typename: str, callable: bytes) -> None: ... |
| 80 | +def register_converter(typename: str, callable: Callable[[bytes], Any]) -> None: ... |
80 | 81 |
|
81 | 82 | class Cache: |
82 | 83 | def __init__(self, *args, **kwargs) -> None: ... |
|
0 commit comments