From bc2716ff332793c4241cebe09dc0561aaf800f42 Mon Sep 17 00:00:00 2001 From: Isaac Goldberg Date: Wed, 23 Mar 2016 11:47:52 -0700 Subject: [PATCH 1/2] Update dbapi2.pyi to allow `execute` without binding params According to https://docs.python.org/2/library/sqlite3.html this is totally allowed! --- stdlib/2.7/sqlite3/dbapi2.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2.7/sqlite3/dbapi2.pyi b/stdlib/2.7/sqlite3/dbapi2.pyi index 593838049..42a7f3045 100644 --- a/stdlib/2.7/sqlite3/dbapi2.pyi +++ b/stdlib/2.7/sqlite3/dbapi2.pyi @@ -107,7 +107,7 @@ class Connection: def create_collation(self, name: str, callable: Any) -> None: ... def create_function(self, name: str, num_params: int, func: Any) -> None: ... def cursor(self, cursorClass= Union[type, None]) -> Cursor: ... - def execute(self, sql: str, parameters: Iterable) -> Cursor: ... + def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ... # TODO: please check in executemany() if seq_of_parameters type is possible like this def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]) -> Cursor: ... def executescript(self, sql_script: Union[bytes, unicode]) -> Cursor: ... @@ -137,7 +137,7 @@ class Cursor: # however, the name of the __init__ variable is unknown def __init__(self, *args, **kwargs): ... def close(self, *args, **kwargs): ... - def execute(self, sql: str, parameters: Iterable) -> Cursor: ... + def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ... def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]): ... def executescript(self, sql_script: Union[bytes, unicode]) -> Cursor: ... def fetchall(self) -> List[tuple]: ... From f2c309b363c4fa266d30e21877bab1976ef321ca Mon Sep 17 00:00:00 2001 From: Isaac Goldberg Date: Wed, 23 Mar 2016 13:12:13 -0700 Subject: [PATCH 2/2] Also updates python3's sqlite execute() --- stdlib/3/sqlite3/dbapi2.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/sqlite3/dbapi2.pyi b/stdlib/3/sqlite3/dbapi2.pyi index 1a84dd1de..b75a0f860 100644 --- a/stdlib/3/sqlite3/dbapi2.pyi +++ b/stdlib/3/sqlite3/dbapi2.pyi @@ -107,7 +107,7 @@ class Connection: def create_collation(self, name: str, callable: Any) -> None: ... def create_function(self, name: str, num_params: int, func: Any) -> None: ... def cursor(self, cursorClass= Union[type, None]) -> Cursor: ... - def execute(self, sql: str, parameters: Iterable) -> Cursor: ... + def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ... # TODO: please check in executemany() if seq_of_parameters type is possible like this def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]) -> Cursor: ... def executescript(self, sql_script: Union[bytes, AnyStr]) -> Cursor: ... @@ -137,7 +137,7 @@ class Cursor: # however, the name of the __init__ variable is unknown def __init__(self, *args, **kwargs): ... def close(self, *args, **kwargs): ... - def execute(self, sql: str, parameters: Iterable) -> Cursor: ... + def execute(self, sql: str, parameters: Iterable = ...) -> Cursor: ... def executemany(self, sql: str, seq_of_parameters: Iterable[Iterable]): ... def executescript(self, sql_script: Union[bytes, AnyStr]) -> Cursor: ... def fetchall(self) -> List[tuple]: ...