Skip to content

Commit c0257a2

Browse files
committed
mypy passing
1 parent 236713a commit c0257a2

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

_duckdb-stubs/__init__.pyi

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,21 @@ class DuckDBPyConnection:
412412
def register_filesystem(self, filesystem: fsspec.AbstractFileSystem) -> None: ...
413413
def remove_function(self, name: str) -> DuckDBPyConnection: ...
414414
def rollback(self) -> DuckDBPyConnection: ...
415-
def row_type(self, fields: Expression | list[Expression] | str | list[str]) -> typing.DuckDBPyType: ...
415+
def row_type(self, fields: dict[str, typing.DuckDBPyType] | list[typing.DuckDBPyType]) -> typing.DuckDBPyType: ...
416416
def sql(self, query: Statement | str, *, alias: str = "", params: object = None) -> DuckDBPyRelation: ...
417417
def sqltype(self, type_str: str) -> typing.DuckDBPyType: ...
418418
def string_type(self, collation: str = "") -> typing.DuckDBPyType: ...
419-
def struct_type(self, fields: Expression | list[Expression] | str | list[str]) -> typing.DuckDBPyType: ...
419+
def struct_type(
420+
self, fields: dict[str, typing.DuckDBPyType] | list[typing.DuckDBPyType]
421+
) -> typing.DuckDBPyType: ...
420422
def table(self, table_name: str) -> DuckDBPyRelation: ...
421423
def table_function(self, name: str, parameters: object = None) -> DuckDBPyRelation: ...
422424
def tf(self) -> dict: ...
423425
def torch(self) -> dict: ...
424426
def type(self, type_str: str) -> typing.DuckDBPyType: ...
425-
def union_type(self, members: typing.DuckDBPyType) -> typing.DuckDBPyType: ...
427+
def union_type(
428+
self, members: list[typing.DuckDBPyType] | dict[str, typing.DuckDBPyType]
429+
) -> typing.DuckDBPyType: ...
426430
def unregister(self, view_name: str) -> DuckDBPyConnection: ...
427431
def unregister_filesystem(self, name: str) -> None: ...
428432
def values(self, *args) -> DuckDBPyRelation: ...
@@ -1347,7 +1351,7 @@ def register_filesystem(
13471351
def remove_function(name: str, *, connection: duckdb.DuckDBPyConnection | None = None) -> duckdb.DuckDBPyConnection: ...
13481352
def rollback(*, connection: duckdb.DuckDBPyConnection | None = None) -> duckdb.DuckDBPyConnection: ...
13491353
def row_type(
1350-
fields: Expression | list[Expression] | str | list[str],
1354+
fields: dict[str, typing.DuckDBPyType] | list[typing.DuckDBPyType],
13511355
*,
13521356
connection: duckdb.DuckDBPyConnection | None = None,
13531357
) -> typing.DuckDBPyType: ...
@@ -1363,7 +1367,7 @@ def sql(
13631367
def sqltype(type_str: str, *, connection: duckdb.DuckDBPyConnection | None = None) -> typing.DuckDBPyType: ...
13641368
def string_type(collation: str = "", *, connection: duckdb.DuckDBPyConnection | None = None) -> typing.DuckDBPyType: ...
13651369
def struct_type(
1366-
fields: Expression | list[Expression] | str | list[str],
1370+
fields: dict[str, typing.DuckDBPyType] | list[typing.DuckDBPyType],
13671371
*,
13681372
connection: duckdb.DuckDBPyConnection | None = None,
13691373
) -> typing.DuckDBPyType: ...
@@ -1379,7 +1383,7 @@ def tokenize(query: str) -> list: ...
13791383
def torch(*, connection: duckdb.DuckDBPyConnection | None = None) -> dict: ...
13801384
def type(type_str: str, *, connection: duckdb.DuckDBPyConnection | None = None) -> typing.DuckDBPyType: ...
13811385
def union_type(
1382-
members: typing.DuckDBPyType,
1386+
members: dict[str, typing.DuckDBPyType] | list[typing.DuckDBPyType],
13831387
*,
13841388
connection: duckdb.DuckDBPyConnection | None = None,
13851389
) -> typing.DuckDBPyType: ...

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ warn_unreachable = true
320320
pretty = true
321321
python_version = "3.9"
322322
exclude = [
323-
"duckdb/experimental/",
324-
"duckdb/query_graph/",
323+
"duckdb/experimental/", # not checking the pyspark API
324+
"duckdb/query_graph/", # old and unmaintained (should probably remove)
325325
]
326326

327327
[[tool.mypy.overrides]]

0 commit comments

Comments
 (0)