mypy fails for numpy sum

Viewed 107

This code snippet works:

py -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)"
[1 1 1]

But mypy gives an error:

py -m mypy -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)"
<string>:1: error: Unsupported operand types for % ("number[Any]" and "int")
<string>:1: note: Left operand is of type "Union[number[Any], ndarray]"
Found 1 error in 1 file (checked 1 source file)

Is this a mypy bug or a numpy bug or a bug in my code snippet?

1 Answers
Related