From 29522f87c3e55de384495853fea68b3929a659c2 Mon Sep 17 00:00:00 2001 From: Yusuke Miyazaki Date: Sun, 12 Aug 2018 14:49:49 +0900 Subject: [PATCH] Allow sqlite3.connect to take PathLike object on Python 3.7+ (#2380) --- stdlib/2and3/sqlite3/dbapi2.pyi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stdlib/2and3/sqlite3/dbapi2.pyi b/stdlib/2and3/sqlite3/dbapi2.pyi index bc035d707..55402968c 100644 --- a/stdlib/2and3/sqlite3/dbapi2.pyi +++ b/stdlib/2and3/sqlite3/dbapi2.pyi @@ -1,6 +1,7 @@ # Filip Hron # based heavily on Andrey Vlasovskikh's python-skeletons https://github.com/JetBrains/python-skeletons/blob/master/sqlite3.py +import os import sys from typing import Any, Callable, Iterable, Iterator, List, Optional, Text, Tuple, Type, TypeVar, Union from datetime import date, time, datetime @@ -70,7 +71,16 @@ version = ... # type: str # TODO: adapt needs to get probed def adapt(obj, protocol, alternate): ... def complete_statement(sql: str) -> bool: ... -if sys.version_info >= (3, 4): +if sys.version_info >= (3, 7): + def connect(database: Union[bytes, Text, os.PathLike[Text]], + timeout: float = ..., + detect_types: int = ..., + isolation_level: Optional[str] = ..., + check_same_thread: bool = ..., + factory: Optional[Type[Connection]] = ..., + cached_statements: int = ..., + uri: bool = ...) -> Connection: ... +elif sys.version_info >= (3, 4): def connect(database: Union[bytes, Text], timeout: float = ..., detect_types: int = ...,