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

numpy.logical_or gives false error assignment-from-no-return #2694

Closed
mhooreman opened this issue Jan 15, 2019 · 16 comments · Fixed by pythoninja/adarklib#29, thermondo/stanley#208 or ChrisRBe/PP-P2P-Parser#85
Assignees
Labels
Bug 🪲 Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade)

Comments

@mhooreman
Copy link

mhooreman commented Jan 15, 2019

Steps to reproduce

Execute pylint on the following code:

"""Demo of the assignment-from-no-return pylint false positive"""

import numpy as np


def demo():
    """Demo of the false positive, at line z = ..."""
    x = np.array([0, 1, 0, 1], dtype=np.bool)
    y = np.array([0, 0, 1, 1], dtype=np.bool)
    z = np.logical_or(x, y)
    print(np.array([x, y, z]))


if __name__ == "__main__":
    demo()

Current behavior

assignment-from-no-return(E1111): test.py:10:4: demo: Assigning result of a function call, where the function has no return

Expected behavior

No issue

pylint --version output

pylint 2.2.2
astroid 2.1.0
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0]
@PCManticore PCManticore added Bug 🪲 Needs astroid Brain 🧠 Needs a brain tip in astroid (then an astroid upgrade) labels Jan 15, 2019
@PCManticore
Copy link
Contributor

Thanks for the report!

@arekfu
Copy link

arekfu commented Jan 15, 2019

For the record, this affects other functions too, such as numpy.equal.

@sroet
Copy link

sroet commented Jan 16, 2019

and numpy.divide

@pxl-th
Copy link

pxl-th commented Jan 18, 2019

numpy.log as well

@jordyjwilliams
Copy link

Any update as to the cause of this? or what versions this didn't occur on? could be a numpy issue?

@sroet
Copy link

sroet commented Jan 22, 2019

@jordyjwilliams It has to do with the release of numpy==1.16 pinning numpy<1.16 has fixed CI linting for me for now, but I like this to be fixed for the newer numpy

@janosh
Copy link

janosh commented Jan 23, 2019

Does anyone know if this needs fixing on pylint's or numpy's part?

@PCManticore
Copy link
Contributor

This is on pylint's side.

@jordyjwilliams
Copy link

@PCManticore any idea on when this will be fixed?

@raaaaaymond
Copy link

Can confirm same problem for a lot more Numpy functions, for example deg2rad(), arctan(), and more presumably. Moreover, array item assignment (such as arr[i] = x) suffers from unsupported-assignment-operation.

@jordyjwilliams
Copy link

+1 to all these issues

@PCManticore
Copy link
Contributor

Should be fixed with the latest master of astroid.

@janosh
Copy link

janosh commented Jan 25, 2019

@PCManticore That was quick! The commit says release date tba. Are we talking days or weeks?

@PCManticore
Copy link
Contributor

Weeks most likely, I'll do a dev release in a bit, but the final one might be somewhere in February.

leezu added a commit to dmlc/gluon-nlp that referenced this issue Jul 19, 2019
* Drop Python2 on CI

* Upgrade pylint and astroid to avoide false positive E1111

See pylint-dev/pylint#2694 for details.
http://ci.mxnet.io/blue/organizations/jenkins/GluonNLP-py3-master-gpu-integration/detail/PR-836/1/
for an example how the bug affects us.

* Fix pylint "useless-object-inheritance"

* Fix pylint "consider-using-in"

* Fix pylint "unnecessary-pass"

* Fix pylint "useless-return"

* Fix pylint "chained-comparison"

* Fix pytest "simplifiable-if-expression"

* Fix pylint "duplicate-string-formatting-argument"

* Fix pylint "no-else-raise"

* Fix object serialization in bert scripts
@IonyM-BWR
Copy link

Hi!

I'm facing the same issue in python2 within vscode.
tried updating both pylint and astroid but got already up-to-date, while there is a newer version available. Are this just foir Py3?
How can I solve the problem for Py2?

thanks a lot!

@Pierre-Sassoulas
Copy link
Member

Sorry, the last minor versions supporting Python 2 are 1.9.x. We're currentely only supporting Python 3.6 and up (we're following what Python itself is doing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment