Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive E1126 when using np.newaxis #2759

Closed
NeilGirdhar opened this issue Feb 19, 2019 · 1 comment
Closed

False positive E1126 when using np.newaxis #2759

NeilGirdhar opened this issue Feb 19, 2019 · 1 comment

Comments

@NeilGirdhar
Copy link

Steps to reproduce

import numpy as np

solution = np.array([2.1, 1.3], dtype=np.float32)
input_size = solution.shape[0]

times = [1, 2, 3]
inputs = [(time, np.random.normal(size=input_size))
          for time in times]
targets = [(time, np.dot(solution, input_)[np.newaxis])
           for time, input_ in inputs]

Current behavior

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

pylint --version output

pylint 2.2.2
astroid 2.1.0
Python 3.7.0 (default, Sep 6 2018, 18:40:31)
[GCC 7.3.0]

@PCManticore
Copy link
Contributor

Hey @NeilGirdhar Thanks for reporting the issue! Just tried out with the dev release and this seems to be working now:

~/p/p/playground python -m pylint a.py --enable=all                                       17:26:13
************* Module a
a.py:1:0: C0111: Missing module docstring (missing-docstring)
a.py:3:0: C0103: Constant name "solution" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:4:0: C0103: Constant name "input_size" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:6:0: C0103: Constant name "times" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:7:0: C0103: Constant name "inputs" doesn't conform to UPPER_CASE naming style (invalid-name)
a.py:9:0: C0103: Constant name "targets" doesn't conform to UPPER_CASE naming style (invalid-name)

-------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: -8.33/10, +8.33)

~/p/p/playground python -m pylint --version                                               17:26:19
__main__.py 2.3.0-dev2
astroid 2.2.0-dev1
Python 3.7.0 (default, Jul  4 2018, 10:51:54)
[Clang 8.1.0 (clang-802.0.42)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants