Skip to content

Commit fc8e72e

Browse files
committed
mypy file selection in pre-commit
1 parent c1a7eb6 commit fc8e72e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ repos:
2323
rev: v1.17.1
2424
hooks:
2525
- id: mypy
26+
# Match all files under duckdb/ or _duckdb-stubs/,
27+
# but not under duckdb/experimental/ or duckdb/query_graph/
28+
files: ^(duckdb/(?!experimental/|query_graph/)|_duckdb-stubs/)
29+
args: ["--config-file", "pyproject.toml"]
2630

2731
- repo: local
2832
hooks:

duckdb/polars_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ def source_generator(
277277
for record_batch in iter(results.read_next_batch, None):
278278
if predicate is not None and duck_predicate is None:
279279
# We have a predicate, but did not manage to push it down, we fallback here
280-
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc]
280+
yield pl.from_arrow(record_batch).filter(predicate) # type: ignore[arg-type,misc,unused-ignore]
281281
else:
282-
yield pl.from_arrow(record_batch) # type: ignore[misc]
282+
yield pl.from_arrow(record_batch) # type: ignore[misc,unused-ignore]
283283

284284
return register_io_source(source_generator, schema=schema)

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,20 +316,26 @@ filterwarnings = [
316316

317317
[tool.mypy]
318318
packages = ["duckdb", "_duckdb"]
319+
mypy_path = ["_duckdb-stubs"]
319320
strict = true
320321
warn_unreachable = true
321322
pretty = true
322323
python_version = "3.9"
323324
exclude = [
324325
"duckdb/experimental/", # not checking the pyspark API
325326
"duckdb/query_graph/", # old and unmaintained (should probably remove)
327+
"tests",
328+
"scripts",
329+
"sqlogic",
326330
]
327331

328332
[[tool.mypy.overrides]]
329333
module = [
330334
"fsspec.*",
335+
"numpy",
331336
"pandas",
332337
"polars",
338+
"polars.io.plugins",
333339
"pyarrow.*",
334340
"torch",
335341
"tensorflow",

0 commit comments

Comments
 (0)