diff options
| author | hippo91 <guillaume.peillex@gmail.com> | 2020-12-30 11:23:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-30 11:23:41 +0100 |
| commit | 98fd2173be45a04df49735862b994e1c6c7028d2 (patch) | |
| tree | 0c4d90183831b6245187a8ef68dd5fd845c7a395 | |
| parent | a8bde99124c4213c26fd92a4b287786e5f4829ed (diff) | |
| parent | da2f454a0910360cadbab26a8fb660e2a9134122 (diff) | |
| download | astroid-git-98fd2173be45a04df49735862b994e1c6c7028d2.tar.gz | |
Merge pull request #873 from hippo91/bug_pylint_3856
Bug pylint 3856
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | astroid/brain/brain_numpy_core_umath.py | 5 | ||||
| -rw-r--r-- | astroid/brain/brain_numpy_random_mtrand.py | 1 | ||||
| -rw-r--r-- | tests/unittest_brain_numpy_core_umath.py | 2 | ||||
| -rw-r--r-- | tests/unittest_brain_numpy_random_mtrand.py | 1 |
5 files changed, 12 insertions, 1 deletions
@@ -7,6 +7,10 @@ What's New in astroid 2.5.0? ============================ Release Date: TBA +* Adds `degrees`, `radians`, which are `numpy ufunc` functions, in the `numpy` brain. Adds `random` function in the `numpy.random` brain. + + Fixes PyCQA/pylint#3856 + * Fix deprecated importlib methods Closes #703 diff --git a/astroid/brain/brain_numpy_core_umath.py b/astroid/brain/brain_numpy_core_umath.py index e878a313..1955e80e 100644 --- a/astroid/brain/brain_numpy_core_umath.py +++ b/astroid/brain/brain_numpy_core_umath.py @@ -4,7 +4,8 @@ # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER - +# Note: starting with version 1.18 numpy module has `__getattr__` method which prevent `pylint` to emit `no-member` message for +# all numpy's attributes. (see pylint's module typecheck in `_emit_no_member` function) """Astroid hooks for numpy.core.umath module.""" import astroid @@ -77,6 +78,7 @@ def numpy_core_umath_transform(): conjugate = FakeUfuncOneArg() cosh = FakeUfuncOneArg() deg2rad = FakeUfuncOneArg() + degrees = FakeUfuncOneArg() exp2 = FakeUfuncOneArg() expm1 = FakeUfuncOneArg() fabs = FakeUfuncOneArg() @@ -91,6 +93,7 @@ def numpy_core_umath_transform(): negative = FakeUfuncOneArg() positive = FakeUfuncOneArg() rad2deg = FakeUfuncOneArg() + radians = FakeUfuncOneArg() reciprocal = FakeUfuncOneArg() rint = FakeUfuncOneArg() sign = FakeUfuncOneArg() diff --git a/astroid/brain/brain_numpy_random_mtrand.py b/astroid/brain/brain_numpy_random_mtrand.py index 372cb73d..70d11ea4 100644 --- a/astroid/brain/brain_numpy_random_mtrand.py +++ b/astroid/brain/brain_numpy_random_mtrand.py @@ -45,6 +45,7 @@ def numpy_random_mtrand_transform(): import numpy return numpy.ndarray((1,1)) def randn(*args): return uninferable + def random(size=None): return uninferable def random_integers(low, high=None, size=None): return uninferable def random_sample(size=None): return uninferable def rayleigh(scale=1.0, size=None): return uninferable diff --git a/tests/unittest_brain_numpy_core_umath.py b/tests/unittest_brain_numpy_core_umath.py index f939bc83..2d2abdbe 100644 --- a/tests/unittest_brain_numpy_core_umath.py +++ b/tests/unittest_brain_numpy_core_umath.py @@ -37,6 +37,7 @@ class NumpyBrainCoreUmathTest(unittest.TestCase): "conjugate", "cosh", "deg2rad", + "degrees", "exp2", "expm1", "fabs", @@ -51,6 +52,7 @@ class NumpyBrainCoreUmathTest(unittest.TestCase): "negative", "positive", "rad2deg", + "radians", "reciprocal", "rint", "sign", diff --git a/tests/unittest_brain_numpy_random_mtrand.py b/tests/unittest_brain_numpy_random_mtrand.py index 05b10a82..ec2bfcf7 100644 --- a/tests/unittest_brain_numpy_random_mtrand.py +++ b/tests/unittest_brain_numpy_random_mtrand.py @@ -56,6 +56,7 @@ class NumpyBrainRandomMtrandTest(unittest.TestCase): "rand": (["args"], []), "randint": (["low", "high", "size", "dtype"], [None, None, "l"]), "randn": (["args"], []), + "random": (["size"], [None]), "random_integers": (["low", "high", "size"], [None, None]), "random_sample": (["size"], [None]), "rayleigh": (["scale", "size"], [1.0, None]), |
