The following issues were found

numpy/distutils/command/config_compiler.py
37 issues
XXX: Linker flags
Error

Line: 4 Column: 2

              from distutils.core import Command
from numpy.distutils import log

#XXX: Linker flags

def show_fortran_compilers(_cache=None):
    # Using cache to prevent infinite recursion.
    if _cache:
        return

            

Reported by Pylint.

Access to a protected member _setup_distribution of a client class
Error

Line: 15 Column: 12

                  _cache.append(1)
    from numpy.distutils.fcompiler import show_fcompilers
    import distutils.core
    dist = distutils.core._setup_distribution
    show_fcompilers(dist)

class config_fc(Command):
    """ Distutils command to hold user specified options
    to Fortran compilers.

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from distutils.core import Command
from numpy.distutils import log

#XXX: Linker flags

def show_fortran_compilers(_cache=None):
    # Using cache to prevent infinite recursion.
    if _cache:
        return

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              
#XXX: Linker flags

def show_fortran_compilers(_cache=None):
    # Using cache to prevent infinite recursion.
    if _cache:
        return
    elif _cache is None:
        _cache = []

            

Reported by Pylint.

Unnecessary "elif" after "return"
Error

Line: 8 Column: 5

              
def show_fortran_compilers(_cache=None):
    # Using cache to prevent infinite recursion.
    if _cache:
        return
    elif _cache is None:
        _cache = []
    _cache.append(1)
    from numpy.distutils.fcompiler import show_fcompilers

            

Reported by Pylint.

Import outside toplevel (numpy.distutils.fcompiler.show_fcompilers)
Error

Line: 13 Column: 5

                  elif _cache is None:
        _cache = []
    _cache.append(1)
    from numpy.distutils.fcompiler import show_fcompilers
    import distutils.core
    dist = distutils.core._setup_distribution
    show_fcompilers(dist)

class config_fc(Command):

            

Reported by Pylint.

Import outside toplevel (distutils.core)
Error

Line: 14 Column: 5

                      _cache = []
    _cache.append(1)
    from numpy.distutils.fcompiler import show_fcompilers
    import distutils.core
    dist = distutils.core._setup_distribution
    show_fcompilers(dist)

class config_fc(Command):
    """ Distutils command to hold user specified options

            

Reported by Pylint.

Class name "config_fc" doesn't conform to PascalCase naming style
Error

Line: 18 Column: 1

                  dist = distutils.core._setup_distribution
    show_fcompilers(dist)

class config_fc(Command):
    """ Distutils command to hold user specified options
    to Fortran compilers.

    config_fc command is used by the FCompiler.customize() method.
    """

            

Reported by Pylint.

Too many instance attributes (10/7)
Error

Line: 18 Column: 1

                  dist = distutils.core._setup_distribution
    show_fcompilers(dist)

class config_fc(Command):
    """ Distutils command to hold user specified options
    to Fortran compilers.

    config_fc command is used by the FCompiler.customize() method.
    """

            

Reported by Pylint.

Line too long (104/100)
Error

Line: 60 Column: 1

                      self.noarch = None

    def finalize_options(self):
        log.info('unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options')
        build_clib = self.get_finalized_command('build_clib')
        build_ext = self.get_finalized_command('build_ext')
        config = self.get_finalized_command('config')
        build = self.get_finalized_command('build')
        cmd_list = [self, config, build_clib, build_ext, build]

            

Reported by Pylint.

numpy/f2py/common_rules.py
37 issues
Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              Pearu Peterson

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

from .auxfuncs import (
    hasbody, hascommon, hasnote, isintent_hide, outmess
)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 19 Column: 1

              from . import __version__
f2py_version = __version__.version

from .auxfuncs import (
    hasbody, hascommon, hasnote, isintent_hide, outmess
)
from . import capi_maps
from . import func2subr
from .crackfortran import rmbadname

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              from .auxfuncs import (
    hasbody, hascommon, hasnote, isintent_hide, outmess
)
from . import capi_maps
from . import func2subr
from .crackfortran import rmbadname


def findcommonblocks(block, top=1):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

                  hasbody, hascommon, hasnote, isintent_hide, outmess
)
from . import capi_maps
from . import func2subr
from .crackfortran import rmbadname


def findcommonblocks(block, top=1):
    ret = []

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              )
from . import capi_maps
from . import func2subr
from .crackfortran import rmbadname


def findcommonblocks(block, top=1):
    ret = []
    if hascommon(block):

            

Reported by Pylint.

Dangerous default value fwrap (builtins.list) as argument
Error

Line: 52 Column: 5

                         'docs': ['"COMMON blocks:\\n"']}
    fwrap = ['']

    def fadd(line, s=fwrap):
        s[0] = '%s\n      %s' % (s[0], line)
    chooks = ['']

    def cadd(line, s=chooks):
        s[0] = '%s\n%s' % (s[0], line)

            

Reported by Pylint.

Dangerous default value chooks (builtins.list) as argument
Error

Line: 56 Column: 5

                      s[0] = '%s\n      %s' % (s[0], line)
    chooks = ['']

    def cadd(line, s=chooks):
        s[0] = '%s\n%s' % (s[0], line)
    ihooks = ['']

    def iadd(line, s=ihooks):
        s[0] = '%s\n%s' % (s[0], line)

            

Reported by Pylint.

Dangerous default value ihooks (builtins.list) as argument
Error

Line: 60 Column: 5

                      s[0] = '%s\n%s' % (s[0], line)
    ihooks = ['']

    def iadd(line, s=ihooks):
        s[0] = '%s\n%s' % (s[0], line)
    doc = ['']

    def dadd(line, s=doc):
        s[0] = '%s\n%s' % (s[0], line)

            

Reported by Pylint.

Dangerous default value doc (builtins.list) as argument
Error

Line: 64 Column: 5

                      s[0] = '%s\n%s' % (s[0], line)
    doc = ['']

    def dadd(line, s=doc):
        s[0] = '%s\n%s' % (s[0], line)
    for (name, vnames, vars) in findcommonblocks(m):
        lower_name = name.lower()
        hnames, inames = [], []
        for n in vnames:

            

Reported by Pylint.

Redefining built-in 'vars'
Error

Line: 66 Column: 24

              
    def dadd(line, s=doc):
        s[0] = '%s\n%s' % (s[0], line)
    for (name, vnames, vars) in findcommonblocks(m):
        lower_name = name.lower()
        hnames, inames = [], []
        for n in vnames:
            if isintent_hide(vars[n]):
                hnames.append(n)

            

Reported by Pylint.

numpy/core/tests/test_scalarprint.py
37 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              """
import code
import platform
import pytest
import sys

from tempfile import TemporaryFile
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises

            

Reported by Pylint.

No value for argument 'string' in unbound method call
Error

Line: 228 Column: 13

                                  "340300000000000000000000000000000000000.")
        # test that unique rounding is preserved when precision is supplied
        # but no extra digits need to be printed (gh-18609)
        a = np.float64.fromhex('-1p-97')
        assert_equal(fsci64(a, unique=True), '-6.310887241768095e-30')
        assert_equal(fsci64(a, unique=False, precision=15),
                     '-6.310887241768094e-30')
        assert_equal(fsci64(a, unique=True, precision=15),
                     '-6.310887241768095e-30')

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 369 Column: 9

                      a = np.float128('2')/np.float128('3')
        b = np.float128(str(a))
        assert_equal(str(a), str(b))
        assert_(a != b)

    def float32_roundtrip(self):
        # gh-9360
        x = np.float32(1024 - 2**-14)
        y = np.float32(1024 - 2**-13)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 375 Column: 9

                      # gh-9360
        x = np.float32(1024 - 2**-14)
        y = np.float32(1024 - 2**-13)
        assert_(repr(x) != repr(y))
        assert_equal(np.float32(repr(x)), x)
        assert_equal(np.float32(repr(y)), y)

    def float64_vs_python(self):
        # gh-2643, gh-6136, gh-6908

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 382 Column: 9

                  def float64_vs_python(self):
        # gh-2643, gh-6136, gh-6908
        assert_equal(repr(np.float64(0.1)), repr(0.1))
        assert_(repr(np.float64(0.20000000000000004)) != repr(0.2))

            

Reported by Pylint.

standard import "import sys" should be placed before "import pytest"
Error

Line: 8 Column: 1

              import code
import platform
import pytest
import sys

from tempfile import TemporaryFile
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises


            

Reported by Pylint.

standard import "from tempfile import TemporaryFile" should be placed before "import pytest"
Error

Line: 10 Column: 1

              import pytest
import sys

from tempfile import TemporaryFile
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises

class TestRealScalars:
    def test_str(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

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

class TestRealScalars:
    def test_str(self):
        svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
        styps = [np.float16, np.float32, np.float64, np.longdouble]
        wanted = [
             ['0.0',  '0.0',  '0.0',  '0.0' ],

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 5

              from numpy.testing import assert_, assert_equal, assert_raises

class TestRealScalars:
    def test_str(self):
        svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
        styps = [np.float16, np.float32, np.float64, np.longdouble]
        wanted = [
             ['0.0',  '0.0',  '0.0',  '0.0' ],
             ['-0.0', '-0.0', '-0.0', '-0.0'],

            

Reported by Pylint.

Method could be a function
Error

Line: 15 Column: 5

              from numpy.testing import assert_, assert_equal, assert_raises

class TestRealScalars:
    def test_str(self):
        svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
        styps = [np.float16, np.float32, np.float64, np.longdouble]
        wanted = [
             ['0.0',  '0.0',  '0.0',  '0.0' ],
             ['-0.0', '-0.0', '-0.0', '-0.0'],

            

Reported by Pylint.

numpy/typing/tests/data/fail/ufunc_config.py
37 issues
Unused argument 'c'
Error

Line: 5 Column: 27

              
import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...


            

Reported by Pylint.

Unused argument 'b'
Error

Line: 5 Column: 19

              
import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...


            

Reported by Pylint.

Unused argument 'a'
Error

Line: 5 Column: 11

              
import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...


            

Reported by Pylint.

Unused argument 'a'
Error

Line: 6 Column: 11

              import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...

class Write2:

            

Reported by Pylint.

Unused argument 'b'
Error

Line: 6 Column: 22

              import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...

class Write2:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 9 Column: 22

              def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...

class Write2:
    def write(self, a: str, b: str) -> None: ...

class Write3:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 12 Column: 21

                  def write1(self, a: str) -> None: ...

class Write2:
    def write(self, a: str, b: str) -> None: ...

class Write3:
    def write(self, *, a: str) -> None: ...

np.seterrcall(func1)  # E: Argument 1 to "seterrcall" has incompatible type

            

Reported by Pylint.

Unused argument 'b'
Error

Line: 12 Column: 29

                  def write1(self, a: str) -> None: ...

class Write2:
    def write(self, a: str, b: str) -> None: ...

class Write3:
    def write(self, *, a: str) -> None: ...

np.seterrcall(func1)  # E: Argument 1 to "seterrcall" has incompatible type

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 15 Column: 24

                  def write(self, a: str, b: str) -> None: ...

class Write3:
    def write(self, *, a: str) -> None: ...

np.seterrcall(func1)  # E: Argument 1 to "seterrcall" has incompatible type
np.seterrcall(func2)  # E: Argument 1 to "seterrcall" has incompatible type
np.seterrcall(Write1())  # E: Argument 1 to "seterrcall" has incompatible type
np.seterrcall(Write2())  # E: Argument 1 to "seterrcall" has incompatible type

            

Reported by Pylint.

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

Line: 5 Column: 1

              
import numpy as np

def func1(a: str, b: int, c: float) -> None: ...
def func2(a: str, *, b: int) -> None: ...

class Write1:
    def write1(self, a: str) -> None: ...


            

Reported by Pylint.

numpy/lib/__init__.py
36 issues
No name 'scimath' in module '__init__'
Error

Line: 21 Column: 1

              # Public submodules
# Note: recfunctions and (maybe) format are public too, but not imported
from . import mixins
from . import scimath as emath

# Private submodules
from .type_check import *
from .index_tricks import *
from .function_base import *

            

Reported by Pylint.

Unable to import '__init__.type_check'
Error

Line: 24 Column: 1

              from . import scimath as emath

# Private submodules
from .type_check import *
from .index_tricks import *
from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *

            

Reported by Pylint.

Unable to import '__init__.index_tricks'
Error

Line: 25 Column: 1

              
# Private submodules
from .type_check import *
from .index_tricks import *
from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *

            

Reported by Pylint.

Unable to import '__init__.function_base'
Error

Line: 26 Column: 1

              # Private submodules
from .type_check import *
from .index_tricks import *
from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *

            

Reported by Pylint.

Unable to import '__init__.nanfunctions'
Error

Line: 27 Column: 1

              from .type_check import *
from .index_tricks import *
from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

            

Reported by Pylint.

Unable to import '__init__.shape_base'
Error

Line: 28 Column: 1

              from .index_tricks import *
from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *


            

Reported by Pylint.

Unable to import '__init__.stride_tricks'
Error

Line: 29 Column: 1

              from .function_base import *
from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

from .polynomial import *

            

Reported by Pylint.

Unable to import '__init__.twodim_base'
Error

Line: 30 Column: 1

              from .nanfunctions import *
from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

from .polynomial import *
from .utils import *

            

Reported by Pylint.

Unable to import '__init__.ufunclike'
Error

Line: 31 Column: 1

              from .shape_base import *
from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

from .polynomial import *
from .utils import *
from .arraysetops import *

            

Reported by Pylint.

Unable to import '__init__.histograms'
Error

Line: 32 Column: 1

              from .stride_tricks import *
from .twodim_base import *
from .ufunclike import *
from .histograms import *

from .polynomial import *
from .utils import *
from .arraysetops import *
from .npyio import *

            

Reported by Pylint.

numpy/core/tests/test_abc.py
36 issues
Using deprecated method assert_()
Error

Line: 10 Column: 9

              
class TestABC:
    def test_abstract(self):
        assert_(issubclass(np.number, numbers.Number))

        assert_(issubclass(np.inexact, numbers.Complex))
        assert_(issubclass(np.complexfloating, numbers.Complex))
        assert_(issubclass(np.floating, numbers.Real))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 12 Column: 9

                  def test_abstract(self):
        assert_(issubclass(np.number, numbers.Number))

        assert_(issubclass(np.inexact, numbers.Complex))
        assert_(issubclass(np.complexfloating, numbers.Complex))
        assert_(issubclass(np.floating, numbers.Real))

        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 13 Column: 9

                      assert_(issubclass(np.number, numbers.Number))

        assert_(issubclass(np.inexact, numbers.Complex))
        assert_(issubclass(np.complexfloating, numbers.Complex))
        assert_(issubclass(np.floating, numbers.Real))

        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))
        assert_(issubclass(np.unsignedinteger, numbers.Integral))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 14 Column: 9

              
        assert_(issubclass(np.inexact, numbers.Complex))
        assert_(issubclass(np.complexfloating, numbers.Complex))
        assert_(issubclass(np.floating, numbers.Real))

        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))
        assert_(issubclass(np.unsignedinteger, numbers.Integral))


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 16 Column: 9

                      assert_(issubclass(np.complexfloating, numbers.Complex))
        assert_(issubclass(np.floating, numbers.Real))

        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))
        assert_(issubclass(np.unsignedinteger, numbers.Integral))

    def test_floats(self):
        for t in sctypes['float']:

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 17 Column: 9

                      assert_(issubclass(np.floating, numbers.Real))

        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))
        assert_(issubclass(np.unsignedinteger, numbers.Integral))

    def test_floats(self):
        for t in sctypes['float']:
            assert_(isinstance(t(), numbers.Real),

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 18 Column: 9

              
        assert_(issubclass(np.integer, numbers.Integral))
        assert_(issubclass(np.signedinteger, numbers.Integral))
        assert_(issubclass(np.unsignedinteger, numbers.Integral))

    def test_floats(self):
        for t in sctypes['float']:
            assert_(isinstance(t(), numbers.Real),
                    "{0} is not instance of Real".format(t.__name__))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 22 Column: 13

              
    def test_floats(self):
        for t in sctypes['float']:
            assert_(isinstance(t(), numbers.Real),
                    "{0} is not instance of Real".format(t.__name__))
            assert_(issubclass(t, numbers.Real),
                    "{0} is not subclass of Real".format(t.__name__))
            assert_(not isinstance(t(), numbers.Rational),
                    "{0} is instance of Rational".format(t.__name__))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 24 Column: 13

                      for t in sctypes['float']:
            assert_(isinstance(t(), numbers.Real),
                    "{0} is not instance of Real".format(t.__name__))
            assert_(issubclass(t, numbers.Real),
                    "{0} is not subclass of Real".format(t.__name__))
            assert_(not isinstance(t(), numbers.Rational),
                    "{0} is instance of Rational".format(t.__name__))
            assert_(not issubclass(t, numbers.Rational),
                    "{0} is subclass of Rational".format(t.__name__))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 26 Column: 13

                                  "{0} is not instance of Real".format(t.__name__))
            assert_(issubclass(t, numbers.Real),
                    "{0} is not subclass of Real".format(t.__name__))
            assert_(not isinstance(t(), numbers.Rational),
                    "{0} is instance of Rational".format(t.__name__))
            assert_(not issubclass(t, numbers.Rational),
                    "{0} is subclass of Rational".format(t.__name__))

    def test_complex(self):

            

Reported by Pylint.

benchmarks/benchmarks/bench_overrides.py
35 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from .common import Benchmark

try:
    from numpy.core.overrides import array_function_dispatch
except ImportError:
    # Don't fail at import time with old Numpy versions
    def array_function_dispatch(*args, **kwargs):
        def wrap(*args, **kwargs):
            return None

            

Reported by Pylint.

Unused argument 'args'
Error

Line: 7 Column: 1

                  from numpy.core.overrides import array_function_dispatch
except ImportError:
    # Don't fail at import time with old Numpy versions
    def array_function_dispatch(*args, **kwargs):
        def wrap(*args, **kwargs):
            return None
        return wrap

import numpy as np

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 7 Column: 1

                  from numpy.core.overrides import array_function_dispatch
except ImportError:
    # Don't fail at import time with old Numpy versions
    def array_function_dispatch(*args, **kwargs):
        def wrap(*args, **kwargs):
            return None
        return wrap

import numpy as np

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 8 Column: 1

              except ImportError:
    # Don't fail at import time with old Numpy versions
    def array_function_dispatch(*args, **kwargs):
        def wrap(*args, **kwargs):
            return None
        return wrap

import numpy as np


            

Reported by Pylint.

Unused argument 'args'
Error

Line: 8 Column: 1

              except ImportError:
    # Don't fail at import time with old Numpy versions
    def array_function_dispatch(*args, **kwargs):
        def wrap(*args, **kwargs):
            return None
        return wrap

import numpy as np


            

Reported by Pylint.

Unused argument 'subok'
Error

Line: 15 Column: 44

              import numpy as np


def _broadcast_to_dispatcher(array, shape, subok=None):
    return (array,)


@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadcast_to(array, shape, subok=False):

            

Reported by Pylint.

Unused argument 'shape'
Error

Line: 15 Column: 37

              import numpy as np


def _broadcast_to_dispatcher(array, shape, subok=None):
    return (array,)


@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadcast_to(array, shape, subok=False):

            

Reported by Pylint.

Unused argument 'subok'
Error

Line: 20 Column: 37

              

@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadcast_to(array, shape, subok=False):
    pass


def _concatenate_dispatcher(arrays, axis=None, out=None):
    if out is not None:

            

Reported by Pylint.

Unused argument 'shape'
Error

Line: 20 Column: 30

              

@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadcast_to(array, shape, subok=False):
    pass


def _concatenate_dispatcher(arrays, axis=None, out=None):
    if out is not None:

            

Reported by Pylint.

Unused argument 'array'
Error

Line: 20 Column: 23

              

@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadcast_to(array, shape, subok=False):
    pass


def _concatenate_dispatcher(arrays, axis=None, out=None):
    if out is not None:

            

Reported by Pylint.

numpy/core/tests/test_cpu_features.py
35 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_umath'
Error

Line: 2 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

Unused variable '__tracebackhide__'
Error

Line: 5 Column: 5

              from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")
    try:

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 13 Column: 12

                  try:
        with open("/proc/cpuinfo", "r") as fd:
            cpuinfo = fd.read(2048)
    except Exception as err:
        cpuinfo = str(err)

    try:
        import subprocess
        auxv = subprocess.check_output(['/bin/true'], env=dict(LD_SHOW_AUXV="1"))

            

Reported by Pylint.

Catching too general exception Exception
Error

Line: 20 Column: 12

                      import subprocess
        auxv = subprocess.check_output(['/bin/true'], env=dict(LD_SHOW_AUXV="1"))
        auxv = auxv.decode()
    except Exception as err:
        auxv = str(err)

    import textwrap
    error_report = textwrap.indent(
"""

            

Reported by Pylint.

Multiple imports on one line (sys, platform, re, pytest)
Error

Line: 1 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

Imports from package sys are not grouped
Error

Line: 1 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 4 Column: 1

              import sys, platform, re, pytest
from numpy.core._multiarray_umath import __cpu_features__

def assert_features_equal(actual, desired, fname):
    __tracebackhide__ = True  # Hide traceback for py.test
    actual, desired = str(actual), str(desired)
    if actual == desired:
        return
    detected = str(__cpu_features__).replace("'", "")

            

Reported by Pylint.

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

Line: 11 Column: 44

                      return
    detected = str(__cpu_features__).replace("'", "")
    try:
        with open("/proc/cpuinfo", "r") as fd:
            cpuinfo = fd.read(2048)
    except Exception as err:
        cpuinfo = str(err)

    try:

            

Reported by Pylint.

numpy/core/_methods.py
34 issues
TODO: Optimize case when `where` is broadcast along a non-reduction
Error

Line: 78 Column: 3

                      for ax in axis:
            items *= arr.shape[mu.normalize_axis_index(ax, arr.ndim)]
    else:
        # TODO: Optimize case when `where` is broadcast along a non-reduction
        # axis and full sum is more excessive than needed.

        # guarded to protect circular imports
        from numpy.lib.stride_tricks import broadcast_to
        # count True values in (potentially broadcasted) boolean mask

            

Reported by Pylint.

Access to a protected member _UFuncOutputCastingError of a client class
Error

Line: 114 Column: 12

                  # try to deal with broken casting rules
    try:
        return ufunc(*args, out=out, **kwargs)
    except _exceptions._UFuncOutputCastingError as e:
        # Numpy 1.17.0, 2019-02-24
        warnings.warn(
            "Converting the output of clip from {!r} to {!r} is deprecated. "
            "Pass `casting=\"unsafe\"` explicitly to silence this warning, or "
            "correct the type of the variables.".format(e.from_, e.to),

            

Reported by Pylint.

Redefining built-in 'min'
Error

Line: 125 Column: 14

                      )
        return ufunc(*args, out=out, casting="unsafe", **kwargs)

def _clip(a, min=None, max=None, out=None, *, casting=None, **kwargs):
    if min is None and max is None:
        raise ValueError("One of max or min must be given")

    # Numpy 1.17.0, 2019-02-24
    # This deprecation probably incurs a substantial slowdown for small arrays,

            

Reported by Pylint.

Redefining built-in 'max'
Error

Line: 125 Column: 24

                      )
        return ufunc(*args, out=out, casting="unsafe", **kwargs)

def _clip(a, min=None, max=None, out=None, *, casting=None, **kwargs):
    if min is None and max is None:
        raise ValueError("One of max or min must be given")

    # Numpy 1.17.0, 2019-02-24
    # This deprecation probably incurs a substantial slowdown for small arrays,

            

Reported by Pylint.

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

Line: 38 Column: 1

              
# avoid keyword arguments to speed up parsing, saves about 15%-20% for very
# small reductions
def _amax(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):
    return umr_maximum(a, axis, None, out, keepdims, initial, where)

def _amin(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 38 Column: 1

              
# avoid keyword arguments to speed up parsing, saves about 15%-20% for very
# small reductions
def _amax(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):
    return umr_maximum(a, axis, None, out, keepdims, initial, where)

def _amin(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):

            

Reported by Pylint.

Too many arguments (6/5)
Error

Line: 42 Column: 1

                        initial=_NoValue, where=True):
    return umr_maximum(a, axis, None, out, keepdims, initial, where)

def _amin(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):
    return umr_minimum(a, axis, None, out, keepdims, initial, where)

def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
         initial=_NoValue, where=True):

            

Reported by Pylint.

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

Line: 42 Column: 1

                        initial=_NoValue, where=True):
    return umr_maximum(a, axis, None, out, keepdims, initial, where)

def _amin(a, axis=None, out=None, keepdims=False,
          initial=_NoValue, where=True):
    return umr_minimum(a, axis, None, out, keepdims, initial, where)

def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
         initial=_NoValue, where=True):

            

Reported by Pylint.

Too many arguments (7/5)
Error

Line: 46 Column: 1

                        initial=_NoValue, where=True):
    return umr_minimum(a, axis, None, out, keepdims, initial, where)

def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
         initial=_NoValue, where=True):
    return umr_sum(a, axis, dtype, out, keepdims, initial, where)

def _prod(a, axis=None, dtype=None, out=None, keepdims=False,
          initial=_NoValue, where=True):

            

Reported by Pylint.

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

Line: 46 Column: 1

                        initial=_NoValue, where=True):
    return umr_minimum(a, axis, None, out, keepdims, initial, where)

def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
         initial=_NoValue, where=True):
    return umr_sum(a, axis, dtype, out, keepdims, initial, where)

def _prod(a, axis=None, dtype=None, out=None, keepdims=False,
          initial=_NoValue, where=True):

            

Reported by Pylint.

numpy/f2py/tests/test_return_real.py
34 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import platform
import pytest

from numpy import array
from numpy.testing import assert_, assert_raises
from . import util


class TestReturnReal(util.F2PyTest):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              
from numpy import array
from numpy.testing import assert_, assert_raises
from . import util


class TestReturnReal(util.F2PyTest):

    def check_function(self, t, tname):

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 16 Column: 9

                          err = 1e-5
        else:
            err = 0.0
        assert_(abs(t(234) - 234.0) <= err)
        assert_(abs(t(234.6) - 234.6) <= err)
        assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 17 Column: 9

                      else:
            err = 0.0
        assert_(abs(t(234) - 234.0) <= err)
        assert_(abs(t(234.6) - 234.6) <= err)
        assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 18 Column: 9

                          err = 0.0
        assert_(abs(t(234) - 234.0) <= err)
        assert_(abs(t(234.6) - 234.6) <= err)
        assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 19 Column: 9

                      assert_(abs(t(234) - 234.0) <= err)
        assert_(abs(t(234.6) - 234.6) <= err)
        assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)
        assert_(abs(t(array([234])) - 234.) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 20 Column: 9

                      assert_(abs(t(234.6) - 234.6) <= err)
        assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)
        assert_(abs(t(array([234])) - 234.) <= err)
        assert_(abs(t(array([[234]])) - 234.) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 21 Column: 9

                      assert_(abs(t('234') - 234) <= err)
        assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)
        assert_(abs(t(array([234])) - 234.) <= err)
        assert_(abs(t(array([[234]])) - 234.) <= err)
        assert_(abs(t(array([234], 'b')) + 22) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 22 Column: 9

                      assert_(abs(t('234.6') - 234.6) <= err)
        assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)
        assert_(abs(t(array([234])) - 234.) <= err)
        assert_(abs(t(array([[234]])) - 234.) <= err)
        assert_(abs(t(array([234], 'b')) + 22) <= err)
        assert_(abs(t(array([234], 'h')) - 234.) <= err)

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 23 Column: 9

                      assert_(abs(t(-234) + 234) <= err)
        assert_(abs(t([234]) - 234) <= err)
        assert_(abs(t((234,)) - 234.) <= err)
        assert_(abs(t(array(234)) - 234.) <= err)
        assert_(abs(t(array([234])) - 234.) <= err)
        assert_(abs(t(array([[234]])) - 234.) <= err)
        assert_(abs(t(array([234], 'b')) + 22) <= err)
        assert_(abs(t(array([234], 'h')) - 234.) <= err)
        assert_(abs(t(array([234], 'i')) - 234.) <= err)

            

Reported by Pylint.