Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the requirement for a particular version of Python in pre-commit #925

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ repos:
rev: v1.1.379
hooks:
- id: pyright
# must match the Python version used in CI
language_version: python3.11
additional_dependencies:
[
beartype,
Expand All @@ -21,7 +19,5 @@ repos:
jaxtyping,
optax,
pytest,
tensorflow,
tf2onnx,
typing_extensions,
]
2 changes: 1 addition & 1 deletion equinox/_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __instancecheck__(cls, value):


class EnumerationItem(Module):
_value: Int[Union[Array, np.ndarray], ""]
_value: Int[Union[Array, np.ndarray[Any, np.dtype[np.signedinteger]]], ""]
# Should have annotation `"type[Enumeration]"`, but this fails due to beartype bug
# #289.
_enumeration: Any = field(static=True)
Expand Down
4 changes: 2 additions & 2 deletions equinox/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def is_inexact_array(element: Any) -> bool:
array.
"""
if isinstance(element, (np.ndarray, np.generic)):
return np.issubdtype(element.dtype, np.inexact)
return bool(np.issubdtype(element.dtype, np.inexact))
elif isinstance(element, jax.Array):
return jnp.issubdtype(element.dtype, jnp.inexact)
else:
Expand All @@ -51,7 +51,7 @@ def is_inexact_array_like(element: Any) -> bool:
if hasattr(element, "__jax_array__"):
element = element.__jax_array__()
if isinstance(element, (np.ndarray, np.generic)):
return np.issubdtype(element.dtype, np.inexact)
return bool(np.issubdtype(element.dtype, np.inexact))
elif isinstance(element, jax.Array):
return jnp.issubdtype(element.dtype, jnp.inexact)
else:
Expand Down
4 changes: 2 additions & 2 deletions equinox/internal/_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def f(x, y):
```
"""
import jax.experimental.jax2tf as jax2tf
import tensorflow as tf
import tf2onnx
import tensorflow as tf # pyright: ignore[reportMissingImports]
import tf2onnx # pyright: ignore[reportMissingImports]

def _to_onnx(*args):
finalised_fn = finalise_fn(fn)
Expand Down
Loading