Skip to content

Commit

Permalink
simplify representation of ScalarLike when generating documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Haffner committed Feb 8, 2025
1 parent 6d2021f commit 3e5f1fc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jaxtyping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,18 @@ class PRNGKeyArray:

return Shaped[jax.Array, ""]
elif item == "ScalarLike":
import jax.typing
if getattr(typing, "GENERATING_DOCUMENTATION", False):

class ScalarLike:
pass

return Shaped[jax.typing.ArrayLike, ""]
ScalarLike.__module__ = "builtins"
ScalarLike.__qualname__ = "ScalarLike"
return ScalarLike
else:
import jax.typing

return jax.typing.ArrayLike
elif item == "PyTree":
from ._pytree_type import PyTree

Expand Down

0 comments on commit 3e5f1fc

Please # to comment.