The following issues were found

numpy/random/tests/test_smoke.py
273 issues
Unable to import 'pytest'
Error

Line: 5 Column: 1

              from functools import partial

import numpy as np
import pytest
from numpy.testing import assert_equal, assert_, assert_array_equal
from numpy.random import (Generator, MT19937, PCG64, PCG64DXSM, Philox, SFC64)

@pytest.fixture(scope='module',
                params=(np.bool_, np.int8, np.int16, np.int32, np.int64,

            

Reported by Pylint.

Module 'numpy.random' has no 'randint' member
Error

Line: 81 Column: 18

              
def warmup(rg, n=None):
    if n is None:
        n = 11 + np.random.randint(0, 20)
    rg.standard_normal(n)
    rg.standard_normal(n)
    rg.standard_normal(n, dtype=np.float32)
    rg.standard_normal(n, dtype=np.float32)
    rg.integers(0, 2 ** 24, n, dtype=np.uint64)

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 732 Column: 16

                      cls.seed_error = ValueError

    def test_numpy_state(self):
        nprg = np.random.RandomState()
        nprg.standard_normal(99)
        state = nprg.get_state()
        self.rg.bit_generator.state = state
        state2 = self.rg.bit_generator.state
        assert_((state[1] == state2['state']['key']).all())

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 18 Column: 5

              
def params_0(f):
    val = f()
    assert_(np.isscalar(val))
    val = f(10)
    assert_(val.shape == (10,))
    val = f((10, 10))
    assert_(val.shape == (10, 10))
    val = f((10, 10, 10))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 20 Column: 5

                  val = f()
    assert_(np.isscalar(val))
    val = f(10)
    assert_(val.shape == (10,))
    val = f((10, 10))
    assert_(val.shape == (10, 10))
    val = f((10, 10, 10))
    assert_(val.shape == (10, 10, 10))
    val = f(size=(5, 5))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 22 Column: 5

                  val = f(10)
    assert_(val.shape == (10,))
    val = f((10, 10))
    assert_(val.shape == (10, 10))
    val = f((10, 10, 10))
    assert_(val.shape == (10, 10, 10))
    val = f(size=(5, 5))
    assert_(val.shape == (5, 5))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 24 Column: 5

                  val = f((10, 10))
    assert_(val.shape == (10, 10))
    val = f((10, 10, 10))
    assert_(val.shape == (10, 10, 10))
    val = f(size=(5, 5))
    assert_(val.shape == (5, 5))


def params_1(f, bounded=False):

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 26 Column: 5

                  val = f((10, 10, 10))
    assert_(val.shape == (10, 10, 10))
    val = f(size=(5, 5))
    assert_(val.shape == (5, 5))


def params_1(f, bounded=False):
    a = 5.0
    b = np.arange(2.0, 12.0)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 123 Column: 9

                      rg.standard_normal(1)
        rg.bit_generator.state = state
        new_state = rg.bit_generator.state
        assert_(comp_state(state, new_state))

    def test_advance(self):
        state = self.rg.bit_generator.state
        if hasattr(self.rg.bit_generator, 'advance'):
            self.rg.bit_generator.advance(self.advance)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 129 Column: 13

                      state = self.rg.bit_generator.state
        if hasattr(self.rg.bit_generator, 'advance'):
            self.rg.bit_generator.advance(self.advance)
            assert_(not comp_state(state, self.rg.bit_generator.state))
        else:
            bitgen_name = self.rg.bit_generator.__class__.__name__
            pytest.skip(f'Advance is not supported by {bitgen_name}')

    def test_jump(self):

            

Reported by Pylint.

numpy/core/tests/test_deprecations.py
272 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

              import datetime
import operator
import warnings
import pytest
import tempfile
import re
import sys

import numpy as np

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 19 Column: 1

                  assert_raises, assert_warns, assert_, assert_array_equal, SkipTest, KnownFailureException
    )

from numpy.core._multiarray_tests import fromstring_null_term_c_api

try:
    import pytz
    _has_pytz = True
except ImportError:

            

Reported by Pylint.

Catching an exception which doesn't inherit from Exception: exceptions
Error

Line: 119 Column: 20

                              if exceptions != tuple():
                    raise AssertionError(
                            "No error raised during function call")
            except exceptions:
                if exceptions == tuple():
                    raise AssertionError(
                            "Error raised during function call")

    def assert_not_deprecated(self, function, args=(), kwargs={}):

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 365 Column: 9

              class TestNPY_CHAR(_DeprecationTestCase):
    # 2017-05-03, 1.13.0
    def test_npy_char_deprecation(self):
        from numpy.core._multiarray_tests import npy_char_deprecation
        self.assert_deprecated(npy_char_deprecation)
        assert_(npy_char_deprecation() == 'S1')


class TestPyArray_AS1D(_DeprecationTestCase):

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 372 Column: 9

              
class TestPyArray_AS1D(_DeprecationTestCase):
    def test_npy_pyarrayas1d_deprecation(self):
        from numpy.core._multiarray_tests import npy_pyarrayas1d_deprecation
        assert_raises(NotImplementedError, npy_pyarrayas1d_deprecation)


class TestPyArray_AS2D(_DeprecationTestCase):
    def test_npy_pyarrayas2d_deprecation(self):

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 378 Column: 9

              
class TestPyArray_AS2D(_DeprecationTestCase):
    def test_npy_pyarrayas2d_deprecation(self):
        from numpy.core._multiarray_tests import npy_pyarrayas2d_deprecation
        assert_raises(NotImplementedError, npy_pyarrayas2d_deprecation)


class Test_UPDATEIFCOPY(_DeprecationTestCase):
    """

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 388 Column: 9

                  WRITEBACKIFCOPY instead
    """
    def test_npy_updateifcopy_deprecation(self):
        from numpy.core._multiarray_tests import npy_updateifcopy_deprecation
        arr = np.arange(9).reshape(3, 3)
        v = arr.T
        self.assert_deprecated(npy_updateifcopy_deprecation, args=(v,))



            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 508 Column: 9

              class Test_GetSet_NumericOps(_DeprecationTestCase):
    # 2018-09-20, 1.16.0
    def test_get_numeric_ops(self):
        from numpy.core._multiarray_tests import getset_numericops
        self.assert_deprecated(getset_numericops, num=2)

        # empty kwargs prevents any state actually changing which would break
        # other tests.
        self.assert_deprecated(np.set_numeric_ops, kwargs={})

            

Reported by Pylint.

Unexpected keyword argument 'casting' in function call
Error

Line: 735 Column: 13

              
        with assert_raises(TypeError):
            # Tests should notice if the deprecation warning is given first...
            np.concatenate(([0.], [1.]), out=np.empty(2, dtype=np.int64),
                           casting="same_kind")


class TestDeprecateSubarrayDTypeDuringArrayCoercion(_DeprecationTestCase):
    warning_cls = FutureWarning

            

Reported by Pylint.

function already defined line 768
Error

Line: 774 Column: 9

              
        self.assert_deprecated(check)

        def check():
            with pytest.raises(ValueError):
                np.array(arr, dtype="(2,2)f")

        self.assert_deprecated(check)


            

Reported by Pylint.

numpy/core/tests/test_numerictypes.py
272 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import sys
import itertools

import pytest
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises, IS_PYPY

# This is the structure of the table used for plain objects:
#

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 106 Column: 32

              
    def test_zeros0D(self):
        """Check creation of 0-dimensional objects"""
        h = np.zeros((), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype.fields['x'][0].name[:4] == 'void')
        assert_(h.dtype.fields['x'][0].char == 'V')
        assert_(h.dtype.fields['x'][0].type == np.void)
        # A small check that data is ok

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 107 Column: 33

                  def test_zeros0D(self):
        """Check creation of 0-dimensional objects"""
        h = np.zeros((), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype.fields['x'][0].name[:4] == 'void')
        assert_(h.dtype.fields['x'][0].char == 'V')
        assert_(h.dtype.fields['x'][0].type == np.void)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((), dtype='u1'))

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 116 Column: 34

              
    def test_zerosSD(self):
        """Check creation of single-dimensional objects"""
        h = np.zeros((2,), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['y'].name[:4] == 'void')
        assert_(h.dtype['y'].char == 'V')
        assert_(h.dtype['y'].type == np.void)
        # A small check that data is ok

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 117 Column: 33

                  def test_zerosSD(self):
        """Check creation of single-dimensional objects"""
        h = np.zeros((2,), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['y'].name[:4] == 'void')
        assert_(h.dtype['y'].char == 'V')
        assert_(h.dtype['y'].type == np.void)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((2,), dtype='u1'))

            

Reported by Pylint.

Value 'h.dtype' is unsubscriptable
Error

Line: 118 Column: 17

                      """Check creation of single-dimensional objects"""
        h = np.zeros((2,), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['y'].name[:4] == 'void')
        assert_(h.dtype['y'].char == 'V')
        assert_(h.dtype['y'].type == np.void)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((2,), dtype='u1'))


            

Reported by Pylint.

Value 'h.dtype' is unsubscriptable
Error

Line: 119 Column: 17

                      h = np.zeros((2,), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['y'].name[:4] == 'void')
        assert_(h.dtype['y'].char == 'V')
        assert_(h.dtype['y'].type == np.void)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((2,), dtype='u1'))

    def test_zerosMD(self):

            

Reported by Pylint.

Value 'h.dtype' is unsubscriptable
Error

Line: 120 Column: 17

                      assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['y'].name[:4] == 'void')
        assert_(h.dtype['y'].char == 'V')
        assert_(h.dtype['y'].type == np.void)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((2,), dtype='u1'))

    def test_zerosMD(self):
        """Check creation of multi-dimensional objects"""

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 126 Column: 36

              
    def test_zerosMD(self):
        """Check creation of multi-dimensional objects"""
        h = np.zeros((2, 3), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['z'].name == 'uint8')
        assert_(h.dtype['z'].char == 'B')
        assert_(h.dtype['z'].type == np.uint8)
        # A small check that data is ok

            

Reported by Pylint.

Instance of 'CreateZeros' has no '_descr' member
Error

Line: 127 Column: 33

                  def test_zerosMD(self):
        """Check creation of multi-dimensional objects"""
        h = np.zeros((2, 3), dtype=self._descr)
        assert_(normalize_descr(self._descr) == h.dtype.descr)
        assert_(h.dtype['z'].name == 'uint8')
        assert_(h.dtype['z'].char == 'B')
        assert_(h.dtype['z'].type == np.uint8)
        # A small check that data is ok
        assert_equal(h['z'], np.zeros((2, 3), dtype='u1'))

            

Reported by Pylint.

numpy/typing/tests/data/pass/comparisons.py
271 issues
No value for argument 'value' in constructor call
Error

Line: 6 Column: 7

              from typing import Any
import numpy as np

c16 = np.complex128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()

c8 = np.complex64()

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 7 Column: 6

              import numpy as np

c16 = np.complex128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()

c8 = np.complex64()
f4 = np.float32()

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 9 Column: 6

              c16 = np.complex128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()

c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 11 Column: 6

              i8 = np.int64()
u8 = np.uint64()

c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()

dt = np.datetime64(0, "D")

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 12 Column: 6

              u8 = np.uint64()

c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()

dt = np.datetime64(0, "D")
td = np.timedelta64(0, "D")

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 14 Column: 6

              c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()

dt = np.datetime64(0, "D")
td = np.timedelta64(0, "D")

b_ = np.bool_()

            

Reported by Pylint.

No value for argument 'value' in constructor call
Error

Line: 19 Column: 6

              dt = np.datetime64(0, "D")
td = np.timedelta64(0, "D")

b_ = np.bool_()

b = bool()
c = complex()
f = float()
i = int()

            

Reported by Pylint.

Value 'np.ndarray' is unsubscriptable
Error

Line: 28 Column: 7

              
SEQ = (0, 1, 2, 3, 4)

AR_b: np.ndarray[Any, np.dtype[np.bool_]] = np.array([True])
AR_u: np.ndarray[Any, np.dtype[np.uint32]] = np.array([1], dtype=np.uint32)
AR_i: np.ndarray[Any, np.dtype[np.int_]] = np.array([1])
AR_f: np.ndarray[Any, np.dtype[np.float_]] = np.array([1.0])
AR_c: np.ndarray[Any, np.dtype[np.complex_]] = np.array([1.0j])
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] = np.array([np.timedelta64("1")])

            

Reported by Pylint.

Value 'np.ndarray' is unsubscriptable
Error

Line: 29 Column: 7

              SEQ = (0, 1, 2, 3, 4)

AR_b: np.ndarray[Any, np.dtype[np.bool_]] = np.array([True])
AR_u: np.ndarray[Any, np.dtype[np.uint32]] = np.array([1], dtype=np.uint32)
AR_i: np.ndarray[Any, np.dtype[np.int_]] = np.array([1])
AR_f: np.ndarray[Any, np.dtype[np.float_]] = np.array([1.0])
AR_c: np.ndarray[Any, np.dtype[np.complex_]] = np.array([1.0j])
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] = np.array([np.timedelta64("1")])
AR_M: np.ndarray[Any, np.dtype[np.datetime64]] = np.array([np.datetime64("1")])

            

Reported by Pylint.

Value 'np.ndarray' is unsubscriptable
Error

Line: 30 Column: 7

              
AR_b: np.ndarray[Any, np.dtype[np.bool_]] = np.array([True])
AR_u: np.ndarray[Any, np.dtype[np.uint32]] = np.array([1], dtype=np.uint32)
AR_i: np.ndarray[Any, np.dtype[np.int_]] = np.array([1])
AR_f: np.ndarray[Any, np.dtype[np.float_]] = np.array([1.0])
AR_c: np.ndarray[Any, np.dtype[np.complex_]] = np.array([1.0j])
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]] = np.array([np.timedelta64("1")])
AR_M: np.ndarray[Any, np.dtype[np.datetime64]] = np.array([np.datetime64("1")])
AR_O: np.ndarray[Any, np.dtype[np.object_]] = np.array([1], dtype=object)

            

Reported by Pylint.

numpy/matrixlib/tests/test_defmatrix.py
260 issues
Instance of 'tuple' has no 'A' member
Error

Line: 231 Column: 29

              
        assert_(np.allclose((mA * mA).A, np.dot(A, A)))
        assert_(np.allclose((mA + mA).A, (A + A)))
        assert_(np.allclose((3*mA).A, (3*A)))

        mA2 = matrix(A)
        mA2 *= 3
        assert_(np.allclose(mA2.A, 3*A))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 16 Column: 9

                  def test_basic(self):
        A = np.array([[1, 2], [3, 4]])
        mA = matrix(A)
        assert_(np.all(mA.A == A))

        B = bmat("A,A;A,A")
        C = bmat([[A, A], [A, A]])
        D = np.array([[1, 2, 1, 2],
                      [3, 4, 3, 4],

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 24 Column: 9

                                    [3, 4, 3, 4],
                      [1, 2, 1, 2],
                      [3, 4, 3, 4]])
        assert_(np.all(B.A == D))
        assert_(np.all(C.A == D))

        E = np.array([[5, 6], [7, 8]])
        AEresult = matrix([[1, 2, 5, 6], [3, 4, 7, 8]])
        assert_(np.all(bmat([A, E]) == AEresult))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 25 Column: 9

                                    [1, 2, 1, 2],
                      [3, 4, 3, 4]])
        assert_(np.all(B.A == D))
        assert_(np.all(C.A == D))

        E = np.array([[5, 6], [7, 8]])
        AEresult = matrix([[1, 2, 5, 6], [3, 4, 7, 8]])
        assert_(np.all(bmat([A, E]) == AEresult))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 29 Column: 9

              
        E = np.array([[5, 6], [7, 8]])
        AEresult = matrix([[1, 2, 5, 6], [3, 4, 7, 8]])
        assert_(np.all(bmat([A, E]) == AEresult))

        vec = np.arange(5)
        mvec = matrix(vec)
        assert_(mvec.shape == (1, 5))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 33 Column: 9

              
        vec = np.arange(5)
        mvec = matrix(vec)
        assert_(mvec.shape == (1, 5))

    def test_exceptions(self):
        # Check for ValueError when called with invalid string data.
        assert_raises(ValueError, matrix, "invalid")


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 50 Column: 9

                                            [3, 4, 7, 8],
                              [5, 6, 1, 2],
                              [7, 8, 3, 4]])
        assert_(np.all(bmat("A,A;A,A") == Aresult))
        assert_(np.all(bmat("A,A;A,A", ldict={'A':B}) == Aresult))
        assert_raises(TypeError, bmat, "A,A;A,A", gdict={'A':B})
        assert_(
            np.all(bmat("A,A;A,A", ldict={'A':A}, gdict={'A':B}) == Aresult))
        b2 = bmat("A,B;C,D", ldict={'A':A,'B':B}, gdict={'C':B,'D':A})

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 51 Column: 9

                                            [5, 6, 1, 2],
                              [7, 8, 3, 4]])
        assert_(np.all(bmat("A,A;A,A") == Aresult))
        assert_(np.all(bmat("A,A;A,A", ldict={'A':B}) == Aresult))
        assert_raises(TypeError, bmat, "A,A;A,A", gdict={'A':B})
        assert_(
            np.all(bmat("A,A;A,A", ldict={'A':A}, gdict={'A':B}) == Aresult))
        b2 = bmat("A,B;C,D", ldict={'A':A,'B':B}, gdict={'C':B,'D':A})
        assert_(np.all(b2 == mixresult))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 53 Column: 9

                      assert_(np.all(bmat("A,A;A,A") == Aresult))
        assert_(np.all(bmat("A,A;A,A", ldict={'A':B}) == Aresult))
        assert_raises(TypeError, bmat, "A,A;A,A", gdict={'A':B})
        assert_(
            np.all(bmat("A,A;A,A", ldict={'A':A}, gdict={'A':B}) == Aresult))
        b2 = bmat("A,B;C,D", ldict={'A':A,'B':B}, gdict={'C':B,'D':A})
        assert_(np.all(b2 == mixresult))



            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 56 Column: 9

                      assert_(
            np.all(bmat("A,A;A,A", ldict={'A':A}, gdict={'A':B}) == Aresult))
        b2 = bmat("A,B;C,D", ldict={'A':A,'B':B}, gdict={'C':B,'D':A})
        assert_(np.all(b2 == mixresult))


class TestProperties:
    def test_sum(self):
        """Test whether matrix.sum(axis=1) preserves orientation.

            

Reported by Pylint.

numpy/lib/tests/test_arraysetops.py
257 issues
Unable to import 'pytest'
Error

Line: 11 Column: 1

              from numpy.lib.arraysetops import (
    ediff1d, intersect1d, setxor1d, union1d, setdiff1d, unique, in1d, isin
    )
import pytest


class TestSetOps:

    def test_intersect1d(self):

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 710 Column: 13

                      y = np.ma.masked_equal(x, 0)

        v = np.unique(y)
        v2, i, c = np.unique(y, return_index=True, return_counts=True)

        msg = 'Unique returned different results when asked for index'
        assert_array_equal(v.data, v2.data, msg)
        assert_array_equal(v.mask, v2.mask, msg)


            

Reported by Pylint.

Unused variable 'c'
Error

Line: 710 Column: 16

                      y = np.ma.masked_equal(x, 0)

        v = np.unique(y)
        v2, i, c = np.unique(y, return_index=True, return_counts=True)

        msg = 'Unique returned different results when asked for index'
        assert_array_equal(v.data, v2.data, msg)
        assert_array_equal(v.mask, v2.mask, msg)


            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              import pytest


class TestSetOps:

    def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

            

Reported by Pylint.

Too many public methods (22/20)
Error

Line: 14 Column: 1

              import pytest


class TestSetOps:

    def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

              
class TestSetOps:

    def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

        ec = np.array([1, 2, 5])

            

Reported by Pylint.

Method could be a function
Error

Line: 16 Column: 5

              
class TestSetOps:

    def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

        ec = np.array([1, 2, 5])

            

Reported by Pylint.

Variable name "a" doesn't conform to snake_case naming style
Error

Line: 18 Column: 9

              
    def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

        ec = np.array([1, 2, 5])
        c = intersect1d(a, b, assume_unique=True)
        assert_array_equal(c, ec)

            

Reported by Pylint.

Variable name "b" doesn't conform to snake_case naming style
Error

Line: 19 Column: 9

                  def test_intersect1d(self):
        # unique inputs
        a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

        ec = np.array([1, 2, 5])
        c = intersect1d(a, b, assume_unique=True)
        assert_array_equal(c, ec)


            

Reported by Pylint.

Variable name "ec" doesn't conform to snake_case naming style
Error

Line: 21 Column: 9

                      a = np.array([5, 7, 1, 2])
        b = np.array([2, 4, 3, 1, 5])

        ec = np.array([1, 2, 5])
        c = intersect1d(a, b, assume_unique=True)
        assert_array_equal(c, ec)

        # non-unique inputs
        a = np.array([5, 5, 7, 1, 2])

            

Reported by Pylint.

numpy/core/fromnumeric.py
255 issues
Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              import warnings

import numpy as np
from . import multiarray as mu
from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              
import numpy as np
from . import multiarray as mu
from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

              import numpy as np
from . import multiarray as mu
from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

_dt_ = nt.sctype2char

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              from . import multiarray as mu
from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

_dt_ = nt.sctype2char


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 13 Column: 1

              from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

_dt_ = nt.sctype2char

# functions that are methods

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

_dt_ = nt.sctype2char

# functions that are methods
__all__ = [

            

Reported by Pylint.

Unexpected keyword argument 'shape' in function call
Error

Line: 1456 Column: 16

              
    if a.size == 0 or new_size == 0:
        # First case must zero fill. The second would have repeats == 0.
        return np.zeros_like(a, shape=new_shape)

    repeats = -(-new_size // a.size)  # ceil division
    a = concatenate((a,) * repeats)[:new_size]

    return reshape(a, new_shape)

            

Reported by Pylint.

Unused umath imported as um
Error

Line: 11 Column: 1

              import numpy as np
from . import multiarray as mu
from . import overrides
from . import umath as um
from . import numerictypes as nt
from .multiarray import asarray, array, asanyarray, concatenate
from . import _methods

_dt_ = nt.sctype2char

            

Reported by Pylint.

Access to a protected member _NoValue of a client class
Error

Line: 71 Column: 31

              
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
    passkwargs = {k: v for k, v in kwargs.items()
                  if v is not np._NoValue}

    if type(obj) is not mu.ndarray:
        try:
            reduction = getattr(obj, method)
        except AttributeError:

            

Reported by Pylint.

Unused argument 'mode'
Error

Line: 89 Column: 55

                  return ufunc.reduce(obj, axis, dtype, out, **passkwargs)


def _take_dispatcher(a, indices, axis=None, out=None, mode=None):
    return (a, out)


@array_function_dispatch(_take_dispatcher)
def take(a, indices, axis=None, out=None, mode='raise'):

            

Reported by Pylint.

numpy/core/numeric.py
253 issues
Attempted relative import beyond top-level package
Error

Line: 9 Column: 1

              import numbers

import numpy as np
from . import multiarray
from .multiarray import (
    _fastCopyAndTranspose as fastCopyAndTranspose, ALLOW_THREADS,
    BUFSIZE, CLIP, MAXDIMS, MAY_SHARE_BOUNDS, MAY_SHARE_EXACT, RAISE,
    WRAP, arange, array, asarray, asanyarray, ascontiguousarray,
    asfortranarray, broadcast, can_cast, compare_chararrays,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              
import numpy as np
from . import multiarray
from .multiarray import (
    _fastCopyAndTranspose as fastCopyAndTranspose, ALLOW_THREADS,
    BUFSIZE, CLIP, MAXDIMS, MAY_SHARE_BOUNDS, MAY_SHARE_EXACT, RAISE,
    WRAP, arange, array, asarray, asanyarray, ascontiguousarray,
    asfortranarray, broadcast, can_cast, compare_chararrays,
    concatenate, copyto, dot, dtype, empty,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

                  putmask, result_type, set_numeric_ops, shares_memory, vdot, where,
    zeros, normalize_axis_index)

from . import overrides
from . import umath
from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

                  zeros, normalize_axis_index)

from . import overrides
from . import umath
from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              
from . import overrides
from . import umath
from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

              from . import overrides
from . import umath
from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError
from ._ufunc_config import errstate

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 26 Column: 1

              from . import umath
from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError
from ._ufunc_config import errstate


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 27 Column: 1

              from . import shape_base
from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError
from ._ufunc_config import errstate

bitwise_not = invert

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 28 Column: 1

              from .overrides import set_array_function_like_doc, set_module
from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError
from ._ufunc_config import errstate

bitwise_not = invert
ufunc = type(sin)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              from .umath import (multiply, invert, sin, PINF, NAN)
from . import numerictypes
from .numerictypes import longlong, intc, int_, float_, complex_, bool_
from ._exceptions import TooHardError, AxisError
from ._ufunc_config import errstate

bitwise_not = invert
ufunc = type(sin)
newaxis = None

            

Reported by Pylint.

numpy/f2py/capi_maps.py
248 issues
Attempted relative import beyond top-level package
Error

Line: 14 Column: 1

              Pearu Peterson

"""
from . import __version__
f2py_version = __version__.version

import copy
import re
import os

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 20 Column: 1

              import copy
import re
import os
from .crackfortran import markoutercomma
from . import cb_rules

# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 21 Column: 1

              import re
import os
from .crackfortran import markoutercomma
from . import cb_rules

# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.
from .auxfuncs import *

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 26 Column: 1

              # The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.
from .auxfuncs import *

__all__ = [
    'getctype', 'getstrlength', 'getarrdims', 'getpydocsign',
    'getarrdocsign', 'getinit', 'sign2map', 'routsign2map', 'modsign2map',
    'cb_sign2map', 'cb_routsign2map', 'common_sign2map'

            

Reported by Pylint.

Undefined variable 'outmess'
Error

Line: 193 Column: 9

                  # interpreted as C 'float'.  This feature is useful for F90/95 users if
    # they use PARAMETERSs in type specifications.
    try:
        outmess('Reading f2cmap from {!r} ...\n'.format(f2cmap_file))
        with open(f2cmap_file, 'r') as f:
            d = eval(f.read(), {}, {})
        for k, d1 in list(d.items()):
            for k1 in list(d1.keys()):
                d1[k1.lower()] = d1[k1]

            

Reported by Pylint.

Undefined variable 'outmess'
Error

Line: 206 Column: 25

                          for k1 in list(d[k].keys()):
                if d[k][k1] in c2py_map:
                    if k1 in f2cmap_all[k]:
                        outmess(
                            "\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n" % (k, k1, f2cmap_all[k][k1], d[k][k1]))
                    f2cmap_all[k][k1] = d[k][k1]
                    outmess('\tMapping "%s(kind=%s)" to "%s"\n' %
                            (k, k1, d[k][k1]))
                else:

            

Reported by Pylint.

Undefined variable 'outmess'
Error

Line: 209 Column: 21

                                      outmess(
                            "\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n" % (k, k1, f2cmap_all[k][k1], d[k][k1]))
                    f2cmap_all[k][k1] = d[k][k1]
                    outmess('\tMapping "%s(kind=%s)" to "%s"\n' %
                            (k, k1, d[k][k1]))
                else:
                    errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n" % (
                        k, k1, d[k][k1], d[k][k1], list(c2py_map.keys())))
        outmess('Successfully applied user defined f2cmap changes\n')

            

Reported by Pylint.

Undefined variable 'errmess'
Error

Line: 212 Column: 21

                                  outmess('\tMapping "%s(kind=%s)" to "%s"\n' %
                            (k, k1, d[k][k1]))
                else:
                    errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n" % (
                        k, k1, d[k][k1], d[k][k1], list(c2py_map.keys())))
        outmess('Successfully applied user defined f2cmap changes\n')
    except Exception as msg:
        errmess(
            'Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg))

            

Reported by Pylint.

Undefined variable 'outmess'
Error

Line: 214 Column: 9

                              else:
                    errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n" % (
                        k, k1, d[k][k1], d[k][k1], list(c2py_map.keys())))
        outmess('Successfully applied user defined f2cmap changes\n')
    except Exception as msg:
        errmess(
            'Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg))

cformat_map = {'double': '%g',

            

Reported by Pylint.

Undefined variable 'errmess'
Error

Line: 216 Column: 9

                                      k, k1, d[k][k1], d[k][k1], list(c2py_map.keys())))
        outmess('Successfully applied user defined f2cmap changes\n')
    except Exception as msg:
        errmess(
            'Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg))

cformat_map = {'double': '%g',
               'float': '%g',
               'long_double': '%Lg',

            

Reported by Pylint.

numpy/core/tests/test_mem_overlap.py
241 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import itertools
import pytest

import numpy as np
from numpy.core._multiarray_tests import solve_diophantine, internal_overlap
from numpy.core import _umath_tests
from numpy.lib.stride_tricks import as_strided
from numpy.testing import (
    assert_, assert_raises, assert_equal, assert_array_equal

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 5 Column: 1

              import pytest

import numpy as np
from numpy.core._multiarray_tests import solve_diophantine, internal_overlap
from numpy.core import _umath_tests
from numpy.lib.stride_tricks import as_strided
from numpy.testing import (
    assert_, assert_raises, assert_equal, assert_array_equal
    )

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 84 Column: 11

              @pytest.mark.slow
def test_diophantine_fuzz():
    # Fuzz test the diophantine solver
    rng = np.random.RandomState(1234)

    max_int = np.iinfo(np.intp).max

    for ndim in range(10):
        feasible_count = 0

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 235 Column: 11

              

def iter_random_view_pairs(x, same_steps=True, equal_size=False):
    rng = np.random.RandomState(1234)

    if equal_size and same_steps:
        raise ValueError()

    def random_slice(n, step):

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 424 Column: 11

              
    x = np.zeros([17,34,71,97], dtype=np.int16)

    rng = np.random.RandomState(1234)

    def random_slice(n, step):
        start = rng.randint(0, n+1, dtype=np.intp)
        stop = rng.randint(start, n+1, dtype=np.intp)
        if rng.randint(0, 2, dtype=np.intp) == 0:

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 520 Column: 11

                  no_overlap = 0
    min_count = 100

    rng = np.random.RandomState(1234)

    while min(overlap, no_overlap) < min_count:
        ndim = rng.randint(1, 4, dtype=np.intp)

        strides = tuple(rng.randint(-1000, 1000, dtype=np.intp)

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 606 Column: 15

                                           count=5000):
        shapes = [7, 13, 8, 21, 29, 32]

        rng = np.random.RandomState(1234)

        for ndim in range(1, 6):
            x = rng.randint(0, 2**16, size=shapes[:ndim]).astype(dtype)

            it = iter_random_view_pairs(x, same_steps=False, equal_size=True)

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 736 Column: 15

                      shapes = [7, 13, 8, 21, 29, 32]
        gufunc = _umath_tests.euclidean_pdist

        rng = np.random.RandomState(1234)

        for ndim in range(2, 6):
            x = rng.rand(*shapes[:ndim])

            it = iter_random_view_pairs(x, same_steps=False, equal_size=True)

            

Reported by Pylint.

Module 'numpy.random' has no 'RandomState' member
Error

Line: 927 Column: 15

                              check(x, y[-1:].reshape([]), z)

    def test_inplace_op_simple_manual(self):
        rng = np.random.RandomState(1234)
        x = rng.rand(200, 200)  # bigger than bufsize

        x += x.T
        assert_array_equal(x - x.T, 0)

            

Reported by Pylint.

Redefining name 'ndims' from outer scope (line 13)
Error

Line: 48 Column: 14

                  return res


def _indices(ndims):
    """Returns ((axis0_src, axis0_dst), (axis1_src, axis1_dst), ... ) index pairs."""

    ind = _indices_for_axis()
    return itertools.product(ind, repeat=ndims)


            

Reported by Pylint.