Skip to content

False positive E1126 when using np.newaxis with np.where #10312

Open
@SentinelCLS

Description

@SentinelCLS

Bug description

from numpy import zeros, where, newaxis

omega = zeros(10)

w_1 = zeros((10, 5))
w_2 = where(omega < 1., 0., 1.)

result = w_1 * w_2[:, newaxis]

Command used

python -m pylint test.py

Pylint output

E1126: Sequence index is not an int, slice, or instance with __index__ (invalid-sequence-index)

Expected behavior

No error reported

Pylint version

pylint 3.3.1
astroid 3.3.5
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]

Additional dependencies

numpy==1.24.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeLib specific 💅This affect the code from a particular libraryNeeds astroid Brain 🧠Needs a brain tip in astroid (then an astroid upgrade)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions