Closed
Description
Describe the issue:
np.einsum
appears to be missing type information for the case where it is used without a string as the first parameter (i.e. when you pass in something like an array and a list of indices). My understanding is that these overrides appear here https://github.com/numpy/numpy/blob/v1.23.0/numpy/core/einsumfunc.pyi where one can see the missing case.
Reproduce the code example:
import numpy as np
s = np.array([[1, 1], [1, 1]])
t = np.einsum(s, [0, 0])
Error message:
Running this through mypy 0.782 yields:
main.py:5: error: No overload variant of "einsum" matches argument types "ndarray[Any, dtype[Any]]", "List[int]"
np.einsum(s, [0, 0])
^
main.py:5: note: Possible overload variants:
main.py:5: note: def einsum(str, *operands: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]], out: None = ..., dtype: Union[Type[bool], Type[bool_], dtype[bool_], _SupportsDType[dtype[bool_]], Literal['?'], Literal['=?'], Literal['<?'], Literal['>?'], Literal['bool'], Literal['bool_'], Literal['bool8'], None] = ..., order: Union[Literal['K'], Literal['A'], Literal['C'], Literal['F'], None] = ..., casting: Union[Literal['no'], Literal['equiv'], Literal['safe'], Literal['same_kind']] = ..., optimize: Union[None, bool, Literal['greedy'], Literal['optimal'], Sequence[Any]] = ...) -> Any
main.py:5: note: def einsum(str, *operands: Union[_SupportsArray[dtype[Union[bool_, unsignedinteger[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, unsignedinteger[Any]]]]], bool, _NestedSequence[bool]], out: None = ..., dtype: <union: 55 items> = ..., order: Union[Literal['K'], Literal['A'], Literal['C'], Literal['F'], None] = ..., casting: Union[Literal['no'], Literal['equiv'], Literal['safe'], Literal['same_kind']] = ..., optimize: Union[None, bool, Literal['greedy'], Literal['optimal'], Sequence[Any]] = ...) -> Any
main.py:5: note: <3 more similar overloads not shown, out of 8 total overloads>
### NumPy/Python version information:
1.22.4 3.9.12 (main, Jun 7 2022, 13:04:54)
[GCC 11.2.0]