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

"E1101: Module 'numpy' has no 'float_power' member (no-member)" #3319

Closed
texadactyl opened this issue Dec 23, 2019 · 6 comments · Fixed by pylint-dev/astroid#738
Closed

"E1101: Module 'numpy' has no 'float_power' member (no-member)" #3319

texadactyl opened this issue Dec 23, 2019 · 6 comments · Fixed by pylint-dev/astroid#738
Assignees

Comments

@texadactyl
Copy link

Step 1 to reproduce

Create source file essai.py:

"""
power versus float_power
"""
import numpy as np

XX1 = np.power(np.pi, 2)
XX2 = np.float_power(np.pi, 2)
print(XX1, XX2)

Step 2 to reproduce

pylint  essai.py

Current behavior

essai.py:7:6: E1101: Module 'numpy' has no 'float_power' member (no-member)

Expected behavior

No diagnostic messages. I believe that pylint misdiagnoses the XX2 assignment. There is, indeed, a float_power function in numpy.

pylint --version output

pylint 2.4.4
astroid 2.3.3
Python 3.7.3 | packaged by conda-forge | (default, Dec  6 2019, 08:54:18) 
[GCC 7.3.0]
@hippo91
Copy link
Contributor

hippo91 commented Dec 24, 2019

@texadactyl thanks for the report!

@hippo91 hippo91 self-assigned this Dec 24, 2019
@texadactyl
Copy link
Author

If you need anything from me, feel free. E.g. experimental pylint.

@texadactyl
Copy link
Author

texadactyl commented Dec 28, 2019

I found the rest of the ufunc discrepancies in pylint/numpy.

from numpy import divmod # <ufunc 'divmod'>
from numpy import gcd # <ufunc 'gcd'>
from numpy import heaviside # <ufunc 'heaviside'>
from numpy import lcm # <ufunc 'lcm'>
from numpy import positive # <ufunc 'positive'>

pylint report:

essai.py:1:0: W0622: Redefining built-in 'divmod' (redefined-builtin)
essai.py:1:0: C0114: Missing module docstring (missing-module-docstring)
essai.py:1:0: E0611: No name 'divmod' in module 'numpy' (no-name-in-module)
essai.py:2:0: E0611: No name 'gcd' in module 'numpy' (no-name-in-module)
essai.py:3:0: E0611: No name 'heaviside' in module 'numpy' (no-name-in-module)
essai.py:4:0: E0611: No name 'lcm' in module 'numpy' (no-name-in-module)
essai.py:5:0: E0611: No name 'positive' in module 'numpy' (no-name-in-module)
essai.py:1:0: W0611: Unused divmod imported from numpy (unused-import)
essai.py:2:0: W0611: Unused gcd imported from numpy (unused-import)
essai.py:3:0: W0611: Unused heaviside imported from numpy (unused-import)
essai.py:4:0: W0611: Unused lcm imported from numpy (unused-import)
essai.py:5:0: W0611: Unused positive imported from numpy (unused-import)

Only the E0611 messages are relevant.

Pity that I was unable to get back to this until today.

@texadactyl
Copy link
Author

texadactyl commented Dec 28, 2019

I used the attached program to extract the ufunc and function definitions out of a given package (E.g. numpy).
pkgfuncs.py.txt

Caveat: It needs more work to process a multi-level package like astropy.

@hippo91
Copy link
Contributor

hippo91 commented Dec 29, 2019

@texadactyl thank you so much for your investigation. I'll add those missing function into the corresponding brain.
Thanks again.

@hippo91
Copy link
Contributor

hippo91 commented Dec 29, 2019

@texadactyl i added the missing functions. There are now part of the PR pylint-dev/astroid#738.
Thanks again.

PCManticore pushed a commit to pylint-dev/astroid that referenced this issue Dec 30, 2019
The bug pylint-dev/pylint#3319 was caused due to a missing function, named float_power inside the brain_numpy_core_umath module. This brain is used to infer all the numpy's ufunc functions. The problem is that in the website documentation of numpy, in the section that list all those functions, there is not entry dealing with the float_power function.

Also adds 5 missing functions detected by @texadactyl

Closes pylint-dev/pylint#3319
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

Successfully merging a pull request may close this issue.

2 participants