--- /dev/null
+# Filip Hron <filip.hron@gmail.com>\r
+# based heavily on Andrey Vlasovskikh's python-skeletons https://github.com/JetBrains/python-skeletons/blob/master/sqlite3.py\r
+\r
+import sys\r
+from typing import Any, Callable, Iterable, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union\r
+from datetime import date, time, datetime\r
+\r
+_T = TypeVar('_T')\r
+\r
+paramstyle: str\r
+threadsafety: int\r
+apilevel: str\r
+Date = date\r
+Time = time\r
+Timestamp = datetime\r
+\r
+def DateFromTicks(ticks): ...\r
+def TimeFromTicks(ticks): ...\r
+def TimestampFromTicks(ticks): ...\r
+\r
+version_info: str\r
+sqlite_version_info: Tuple[int, int, int]\r
+if sys.version_info >= (3,):\r
+ Binary = memoryview\r
+else:\r
+ Binary = buffer\r
+\r
+def register_adapters_and_converters(): ...\r
+\r
+# The remaining definitions are imported from _sqlite3.\r
+\r
+PARSE_COLNAMES = ... # type: int\r
+PARSE_DECLTYPES = ... # type: int\r
+SQLITE_ALTER_TABLE = ... # type: int\r
+SQLITE_ANALYZE = ... # type: int\r
+SQLITE_ATTACH = ... # type: int\r
+SQLITE_CREATE_INDEX = ... # type: int\r
+SQLITE_CREATE_TABLE = ... # type: int\r
+SQLITE_CREATE_TEMP_INDEX = ... # type: int\r
+SQLITE_CREATE_TEMP_TABLE = ... # type: int\r
+SQLITE_CREATE_TEMP_TRIGGER = ... # type: int\r
+SQLITE_CREATE_TEMP_VIEW = ... # type: int\r
+SQLITE_CREATE_TRIGGER = ... # type: int\r
+SQLITE_CREATE_VIEW = ... # type: int\r
+SQLITE_DELETE = ... # type: int\r
+SQLITE_DENY = ... # type: int\r
+SQLITE_DETACH = ... # type: int\r
+SQLITE_DROP_INDEX = ... # type: int\r
+SQLITE_DROP_TABLE = ... # type: int\r
+SQLITE_DROP_TEMP_INDEX = ... # type: int\r
+SQLITE_DROP_TEMP_TABLE = ... # type: int\r
+SQLITE_DROP_TEMP_TRIGGER = ... # type: int\r
+SQLITE_DROP_TEMP_VIEW = ... # type: int\r
+SQLITE_DROP_TRIGGER = ... # type: int\r
+SQLITE_DROP_VIEW = ... # type: int\r
+SQLITE_IGNORE = ... # type: int\r
+SQLITE_INSERT = ... # type: int\r
+SQLITE_OK = ... # type: int\r
+SQLITE_PRAGMA = ... # type: int\r
+SQLITE_READ = ... # type: int\r
+SQLITE_REINDEX = ... # type: int\r
+SQLITE_SELECT = ... # type: int\r
+SQLITE_TRANSACTION = ... # type: int\r
+SQLITE_UPDATE = ... # type: int\r
+adapters = ... # type: Any\r
+converters = ... # type: Any\r
+sqlite_version = ... # type: str\r
+version = ... # type: str\r
+\r
+# TODO: adapt needs to get probed\r
+def adapt(obj, protocol, alternate): ...\r
+def complete_statement(sql: str) -> bool: ...\r
+if sys.version_info >= (3, 4):\r
+ def connect(database: Union[bytes, Text],\r
+ timeout: float = ...,\r
+ detect_types: int = ...,\r
+ isolation_level: Optional[str] = ...,\r
+ check_same_thread: bool = ...,\r
+ factory: Optional[Type[Connection]] = ...,\r
+ cached_statements: int = ...,\r
+ uri: bool = ...) -> Connection: ...\r
+else:\r
+ def connect(database: Union[bytes, Text],\r
+ timeout: float = ...,\r
+ detect_types: int = ...,\r
+ isolation_level: Optional[str] = ...,\r
+ check_same_thread: bool = ...,\r
+ factory: Optional[Type[Connection]] = ...,\r
+ cached_statements: int = ...) -> Connection: ...\r
+def enable_callback_tracebacks(flag: bool) -> None: ...\r
+def enable_shared_cache(do_enable: int) -> None: ...\r
+def register_adapter(type: Type[_T], callable: Callable[[_T], Union[int, float, str, bytes]]) -> None: ...\r
+def register_converter(typename: str, callable: Callable[[bytes], Any]) -> None: ...\r
+\r
+class Cache(object):\r
+ def __init__(self, *args, **kwargs) -> None: ...\r
+ def display(self, *args, **kwargs) -> None: ...\r
+ def get(self, *args, **kwargs) -> None: ...\r
+\r
+class Connection(object):\r
+ DataError = ... # type: Any\r
+ DatabaseError = ... # type: Any\r
+ Error = ... # type: Any\r
+ IntegrityError = ... # type: Any\r
+ InterfaceError = ... # type: Any\r
+ InternalError = ... # type: Any\r
+ NotSupportedError = ... # type: Any\r
+ OperationalError = ... # type: Any\r
+ ProgrammingError = ... # type: Any\r
+ Warning = ... # type: Any\r
+ in_transaction = ... # type: Any\r
+ isolation_level = ... # type: Any\r
+ row_factory = ... # type: Any\r
+ text_factory = ... # type: Any\r
+ total_changes = ... # type: Any\r
+ def __init__(self, *args, **kwargs): ...\r
+ def close(self) -> None: ...\r
+ def commit(self) -> None: ...\r
+ def create_aggregate(self, name: str, num_params: int, aggregate_class: type) -> None: ...\r
+ def create_collation(self, name: str, callable: Any) -> None: ...\r
+ def create_function(self, name: str, num_params: int, func: Any) -> None: ...\r
+ def cursor(self, cursorClass: Optional[type] = ...) -> Cursor: ...\r
+ def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ...\r
+ # TODO: please check in executemany() if seq_of_parameters type is possible like this\r
+ def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]) -> Cursor: ...\r
+ def executescript(self, sql_script: Union[bytes, Text]) -> Cursor: ...\r
+ def interrupt(self, *args, **kwargs) -> None: ...\r
+ def iterdump(self, *args, **kwargs) -> None: ...\r
+ def rollback(self, *args, **kwargs) -> None: ...\r
+ # TODO: set_authorizer(authorzer_callback)\r
+ # see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_authorizer\r
+ # returns [SQLITE_OK, SQLITE_DENY, SQLITE_IGNORE] so perhaps int\r
+ def set_authorizer(self, *args, **kwargs) -> None: ...\r
+ # set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler\r
+ def set_progress_handler(self, *args, **kwargs) -> None: ...\r
+ def set_trace_callback(self, *args, **kwargs): ...\r
+ if sys.version_info >= (3, 7):\r
+ def backup(self, target: Connection, *, pages: int = ...,\r
+ progress: Optional[Callable[[int, int, int], object]] = ..., name: str = ...,\r
+ sleep: float = ...) -> None: ...\r
+ def __call__(self, *args, **kwargs): ...\r
+ def __enter__(self, *args, **kwargs): ...\r
+ def __exit__(self, *args, **kwargs): ...\r
+\r
+class Cursor(Iterator[Any]):\r
+ arraysize = ... # type: Any\r
+ connection = ... # type: Any\r
+ description = ... # type: Any\r
+ lastrowid = ... # type: Any\r
+ row_factory = ... # type: Any\r
+ rowcount = ... # type: Any\r
+ # TODO: Cursor class accepts exactly 1 argument\r
+ # required type is sqlite3.Connection (which is imported as _Connection)\r
+ # however, the name of the __init__ variable is unknown\r
+ def __init__(self, *args, **kwargs): ...\r
+ def close(self, *args, **kwargs): ...\r
+ def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ...\r
+ def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]): ...\r
+ def executescript(self, sql_script: Union[bytes, Text]) -> Cursor: ...\r
+ def fetchall(self) -> List[Any]: ...\r
+ def fetchmany(self, size: Optional[int] = ...) -> List[Any]: ...\r
+ def fetchone(self) -> Any: ...\r
+ def setinputsizes(self, *args, **kwargs): ...\r
+ def setoutputsize(self, *args, **kwargs): ...\r
+ def __iter__(self) -> Cursor: ...\r
+ if sys.version_info >= (3, 0):\r
+ def __next__(self) -> Any: ...\r
+ else:\r
+ def next(self) -> Any: ...\r
+\r
+\r
+class DataError(DatabaseError): ...\r
+\r
+class DatabaseError(Error): ...\r
+\r
+class Error(Exception): ...\r
+\r
+class IntegrityError(DatabaseError): ...\r
+\r
+class InterfaceError(Error): ...\r
+\r
+class InternalError(DatabaseError): ...\r
+\r
+class NotSupportedError(DatabaseError): ...\r
+\r
+class OperationalError(DatabaseError): ...\r
+\r
+class OptimizedUnicode(object):\r
+ maketrans = ... # type: Any\r
+ def __init__(self, *args, **kwargs): ...\r
+ def capitalize(self, *args, **kwargs): ...\r
+ def casefold(self, *args, **kwargs): ...\r
+ def center(self, *args, **kwargs): ...\r
+ def count(self, *args, **kwargs): ...\r
+ def encode(self, *args, **kwargs): ...\r
+ def endswith(self, *args, **kwargs): ...\r
+ def expandtabs(self, *args, **kwargs): ...\r
+ def find(self, *args, **kwargs): ...\r
+ def format(self, *args, **kwargs): ...\r
+ def format_map(self, *args, **kwargs): ...\r
+ def index(self, *args, **kwargs): ...\r
+ def isalnum(self, *args, **kwargs): ...\r
+ def isalpha(self, *args, **kwargs): ...\r
+ def isdecimal(self, *args, **kwargs): ...\r
+ def isdigit(self, *args, **kwargs): ...\r
+ def isidentifier(self, *args, **kwargs): ...\r
+ def islower(self, *args, **kwargs): ...\r
+ def isnumeric(self, *args, **kwargs): ...\r
+ def isprintable(self, *args, **kwargs): ...\r
+ def isspace(self, *args, **kwargs): ...\r
+ def istitle(self, *args, **kwargs): ...\r
+ def isupper(self, *args, **kwargs): ...\r
+ def join(self, *args, **kwargs): ...\r
+ def ljust(self, *args, **kwargs): ...\r
+ def lower(self, *args, **kwargs): ...\r
+ def lstrip(self, *args, **kwargs): ...\r
+ def partition(self, *args, **kwargs): ...\r
+ def replace(self, *args, **kwargs): ...\r
+ def rfind(self, *args, **kwargs): ...\r
+ def rindex(self, *args, **kwargs): ...\r
+ def rjust(self, *args, **kwargs): ...\r
+ def rpartition(self, *args, **kwargs): ...\r
+ def rsplit(self, *args, **kwargs): ...\r
+ def rstrip(self, *args, **kwargs): ...\r
+ def split(self, *args, **kwargs): ...\r
+ def splitlines(self, *args, **kwargs): ...\r
+ def startswith(self, *args, **kwargs): ...\r
+ def strip(self, *args, **kwargs): ...\r
+ def swapcase(self, *args, **kwargs): ...\r
+ def title(self, *args, **kwargs): ...\r
+ def translate(self, *args, **kwargs): ...\r
+ def upper(self, *args, **kwargs): ...\r
+ def zfill(self, *args, **kwargs): ...\r
+ def __add__(self, other): ...\r
+ def __contains__(self, *args, **kwargs): ...\r
+ def __eq__(self, other): ...\r
+ def __format__(self, *args, **kwargs): ...\r
+ def __ge__(self, other): ...\r
+ def __getitem__(self, index): ...\r
+ def __getnewargs__(self, *args, **kwargs): ...\r
+ def __gt__(self, other): ...\r
+ def __hash__(self): ...\r
+ def __iter__(self): ...\r
+ def __le__(self, other): ...\r
+ def __len__(self, *args, **kwargs): ...\r
+ def __lt__(self, other): ...\r
+ def __mod__(self, other): ...\r
+ def __mul__(self, other): ...\r
+ def __ne__(self, other): ...\r
+ def __rmod__(self, other): ...\r
+ def __rmul__(self, other): ...\r
+\r
+class PrepareProtocol(object):\r
+ def __init__(self, *args, **kwargs): ...\r
+\r
+class ProgrammingError(DatabaseError): ...\r
+\r
+class Row(object):\r
+ def __init__(self, *args, **kwargs): ...\r
+ def keys(self, *args, **kwargs): ...\r
+ def __eq__(self, other): ...\r
+ def __ge__(self, other): ...\r
+ def __getitem__(self, index): ...\r
+ def __gt__(self, other): ...\r
+ def __hash__(self): ...\r
+ def __iter__(self): ...\r
+ def __le__(self, other): ...\r
+ def __len__(self, *args, **kwargs): ...\r
+ def __lt__(self, other): ...\r
+ def __ne__(self, other): ...\r
+\r
+class Statement(object):\r
+ def __init__(self, *args, **kwargs): ...\r
+\r
+class Warning(Exception): ...\r