Skip to content

Commit 67491fa

Browse files
committed
add allowlist and ensure stubtest passes
1 parent c8da5d6 commit 67491fa

3 files changed

Lines changed: 25 additions & 13 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cysqlite._cysqlite.__test__
2+
cysqlite.Connection
3+
cysqlite.Connection.commit
4+
cysqlite.Connection.execute_simple
5+
cysqlite.Connection.executemany
6+
cysqlite.Connection.get_columns
7+
cysqlite.Connection.pragma
8+
cysqlite._cysqlite.Connection
9+
cysqlite._cysqlite.Connection.commit
10+
cysqlite._cysqlite.Connection.execute_simple
11+
cysqlite._cysqlite.Connection.executemany
12+
cysqlite._cysqlite.Connection.get_columns
13+
cysqlite._cysqlite.Connection.pragma
14+
cysqlite._cysqlite.Cursor
15+
cysqlite._cysqlite.Cursor.executemany
16+
cysqlite._cysqlite.__reduce_cython__
17+
cysqlite._cysqlite.__setstate_cython__

stubs/cysqlite/cysqlite/_cysqlite.pyi

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class Connection(_callable_context_manager):
231231
def status(self, flag: int) -> tuple[int, int]: ...
232232
def table_column_metadata(self, table: str | bytes, column: str | bytes, database: str | None = None) -> ColumnMetadata: ...
233233
def total_changes(self) -> int: ...
234-
def trace(self, fn: Callable[[int, int, str, int], Any], mask: int = 2) -> None: ...
234+
def trace(self, fn: Callable[[int, int, str, int], Any], mask: int = 2, expand_sql: bool = True) -> None: ...
235235
def transaction(self, lock: _IsolationLevel = None) -> Transaction: ...
236236
def unregister_adapter(self, python_type: type[Any]) -> bool: ...
237237
def unregister_converter(self, data_type: str) -> bool: ...
@@ -249,7 +249,7 @@ class Cursor:
249249
row_factory: Callable[..., Row] | Callable[..., Any]
250250
rowcount: int
251251

252-
def __init__(self, conn: Connection) -> None: ...
252+
def __new__(cls, conn: Connection) -> Self: ...
253253
def close(self) -> None: ...
254254
def columns(self) -> list[str]: ...
255255
def execute(self, sql: str, params: _Parameters | None = None) -> Self: ...
@@ -294,7 +294,6 @@ class Savepoint(_callable_context_manager):
294294
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None): ...
295295
def __reduce__(self): ...
296296

297-
@disjoint_base
298297
class TableFunction:
299298
_ncols: ClassVar[int] = ...
300299
_nparams: ClassVar[int] = ...
@@ -321,16 +320,19 @@ class Transaction(_callable_context_manager):
321320
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None): ...
322321
def __reduce__(self): ...
323322

324-
@disjoint_base
325323
class _callable_context_manager:
326324
def __call__(self, fn: Callable[_P, _T]) -> Callable[_P, _T]: ...
327325
def __reduce__(self): ...
326+
def __reduce_cython__(self): ...
327+
def __setstate_cython__(self, __pyx_state: Any, /): ...
328328

329329
@disjoint_base
330330
class median:
331-
def __init__(self) -> None: ...
331+
def __init__(self, *args) -> None: ...
332332
def finalize(self) -> float: ...
333333
def inverse(self, item: float) -> None: ...
334334
def step(self, item: float) -> None: ...
335335
def value(self) -> float: ...
336336
def __reduce__(self): ...
337+
def __reduce_cython__(self): ...
338+
def __setstate_cython__(self, __pyx_state: Any, /): ...

stubs/cysqlite/cysqlite/aio.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ import types
55
from collections.abc import Callable, Mapping, Sequence
66
from typing import Any, Literal, TypeAlias, TypedDict
77

8-
from cysqlite._cysqlite import (
9-
Atomic as Atomic,
10-
Connection as Connection,
11-
Cursor as Cursor,
12-
Row as Row,
13-
Savepoint as Savepoint,
14-
Transaction as Transaction,
15-
)
8+
from ._cysqlite import Atomic, Connection, Cursor, Row, Savepoint, Transaction
169

1710
if sys.version_info >= (3, 13):
1811
from typing import Unpack

0 commit comments

Comments
 (0)