Skip to content

Commit b1caf8b

Browse files
committed
linters merge from main
1 parent 70ddac8 commit b1caf8b

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

pixi.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ basedpyright = "*"
6161
numpydoc = ">=1.8.0,<2"
6262
# import dependencies for mypy:
6363
array-api-strict = "*"
64-
numpy = "*"
6564
pytest = "*"
6665

6766
[tool.pixi.feature.lint.tasks]

src/array_api_extra/_lib/_lazy.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,12 @@ def lazy_apply( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
223223

224224
# Backend-specific branches
225225
if is_dask_namespace(xp):
226-
import dask # type: ignore[import-not-found] # pylint: disable=import-outside-toplevel,import-error # pyright: ignore[reportMissingImports]
226+
import dask # pylint: disable=import-outside-toplevel
227227

228228
metas = [arg._meta for arg in args if hasattr(arg, "_meta")] # pylint: disable=protected-access
229229
meta_xp = array_namespace(*metas)
230230

231-
wrapped = dask.delayed(
231+
wrapped = dask.delayed( # type: ignore[attr-defined] # pyright: ignore[reportPrivateImportUsage]
232232
_lazy_apply_wrapper(func, as_numpy, multi_output, meta_xp),
233233
pure=True,
234234
)
@@ -239,7 +239,7 @@ def lazy_apply( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
239239

240240
out = tuple(
241241
xp.from_delayed(
242-
delayed_out[i],
242+
delayed_out[i], # pyright: ignore[reportIndexIssue]
243243
# Dask's unknown shapes diverge from the Array API specification
244244
shape=tuple(math.nan if s is None else s for s in shape),
245245
dtype=dtype,
@@ -254,7 +254,7 @@ def lazy_apply( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
254254
# Instead, we delay calling wrapped, which will receive
255255
# as arguments and will return JAX eager arrays.
256256

257-
import jax # type: ignore[import-not-found] # pylint: disable=import-outside-toplevel,import-error # pyright: ignore[reportMissingImports]
257+
import jax # pylint: disable=import-outside-toplevel
258258

259259
wrapped = _lazy_apply_wrapper(func, as_numpy, multi_output, xp)
260260

@@ -265,18 +265,17 @@ def lazy_apply( # type: ignore[valid-type] # numpydoc ignore=GL07,SA04
265265
out = wrapped(*args, **kwargs)
266266

267267
else:
268-
out = cast(
269-
tuple[Array, ...],
270-
jax.pure_callback(
271-
wrapped,
272-
tuple(
273-
jax.ShapeDtypeStruct(shape, dtype) # pyright: ignore[reportUnknownArgumentType]
274-
for shape, dtype in zip(shapes, dtypes, strict=True)
275-
),
276-
*args,
277-
**kwargs,
268+
# FIXME jax typing bug
269+
out_jax = jax.pure_callback( # type: ignore[func-returns-value]
270+
wrapped,
271+
tuple(
272+
jax.ShapeDtypeStruct(shape, dtype)
273+
for shape, dtype in zip(shapes, dtypes, strict=True)
278274
),
275+
*args,
276+
**kwargs,
279277
)
278+
out = cast(tuple[Array, ...], cast(object, out_jax))
280279

281280
else:
282281
# Eager backends

src/array_api_extra/_lib/_utils/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
size,
1919
)
2020
except ImportError:
21-
from array_api_compat import ( # pyright: ignore[reportMissingTypeStubs]
21+
from array_api_compat import ( # pyright: ignore[reportMissingImports]
2222
array_namespace,
2323
device,
2424
is_array_api_strict_namespace,

tests/test_at.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import numpy as np
77
import pytest
8-
from array_api_compat import ( # type: ignore[import-untyped] # pyright: ignore[reportMissingTypeStubs]
8+
from array_api_compat import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
99
array_namespace,
1010
is_writeable_array,
1111
)

0 commit comments

Comments
 (0)