🏷️ Annotate einsum_path return type (Issue #724)#746
Conversation
einsum_path return type (Issue #724)
|
@jorenham sir I tried running this locally and got results with different lengths like (0,) for size 1 and others for size 2). I used ... to be safe since it seems variable, but please let me know if there's a better way to handle that. Also, I noticed the CLI checks failed on the existing tests—should I just update those files to match this new type? |
Ah I see... It's a bit unfortunate, but nothing to lose sleep over 🤷. Anyway,
Yea it's better to update those instead of writing new ones then. |
Refactor assertion for np.einsum_path to improve readability.
|
@jorenham sir Expert advice needed! 🏳️ The Linter and Formatter seem to be at war over these long lines. Every time I appease one, the other gets angry. 🤯 |
Running |
Done |
einsum_path return type (Issue #724)einsum_path return type (Issue #724)
|
Thanks @pareshjoshij |
Closes #724
Summary
This PR adds precise type annotations for the return value of
np.einsum_path.Changes
_OptimizeKindto includeSequence[str | tuple[int, ...]].einsum_pathreturn type totuple[list[str | tuple[int, ...]], str].src/numpy-stubs/@test/static/accept/test_einsum_path.py.Verification
I verified the changes statically with
mypyand confirmed the runtime behavior matches the new annotation.1. Static Check (Mypy)