The following issues were found

numpy/f2py/func2subr.py
48 issues
Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              
import copy

from .auxfuncs import (
    getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
    isintent_out, islogicalfunction, ismoduleroutine, isscalar,
    issubroutine, issubroutine_wrap, outmess, show
)


            

Reported by Pylint.

Redefining built-in 'vars'
Error

Line: 29 Column: 20

              )


def var2fixfortran(vars, a, fa=None, f90mode=None):
    if fa is None:
        fa = a
    if a not in vars:
        show(vars)
        outmess('var2fixfortran: No definition for argument "%s".\n' % a)

            

Reported by Pylint.

Redefining built-in 'vars'
Error

Line: 82 Column: 5

                  assert isfunction(rout)

    extra_args = []
    vars = rout['vars']
    for a in rout['args']:
        v = rout['vars'][a]
        for i, d in enumerate(v.get('dimension', [])):
            if d == ':':
                dn = 'f2py_%s_d%s' % (a, i)

            

Reported by Pylint.

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

Line: 98 Column: 5

              
    ret = ['']

    def add(line, ret=ret):
        ret[0] = '%s\n      %s' % (ret[0], line)
    name = rout['name']
    fortranname = getfortranname(rout)
    f90mode = ismoduleroutine(rout)
    newname = '%sf2pywrap' % (name)

            

Reported by Pylint.

Redefining built-in 'vars'
Error

Line: 188 Column: 5

                  assert issubroutine(rout)

    extra_args = []
    vars = rout['vars']
    for a in rout['args']:
        v = rout['vars'][a]
        for i, d in enumerate(v.get('dimension', [])):
            if d == ':':
                dn = 'f2py_%s_d%s' % (a, i)

            

Reported by Pylint.

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

Line: 204 Column: 5

              
    ret = ['']

    def add(line, ret=ret):
        ret[0] = '%s\n      %s' % (ret[0], line)
    name = rout['name']
    fortranname = getfortranname(rout)
    f90mode = ismoduleroutine(rout)


            

Reported by Pylint.

Constant name "f2py_version" doesn't conform to UPPER_CASE naming style
Error

Line: 18 Column: 1

              """
__version__ = "$Revision: 1.16 $"[10:-1]

f2py_version = 'See `f2py -v`'

import copy

from .auxfuncs import (
    getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,

            

Reported by Pylint.

Import "import copy" should be placed at the top of the module
Error

Line: 20 Column: 1

              
f2py_version = 'See `f2py -v`'

import copy

from .auxfuncs import (
    getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
    isintent_out, islogicalfunction, ismoduleroutine, isscalar,
    issubroutine, issubroutine_wrap, outmess, show

            

Reported by Pylint.

Import "from .auxfuncs import getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in, isintent_out, islogicalfunction, ismoduleroutine, isscalar, issubroutine, issubroutine_wrap, outmess, show" should be placed at the top of the module
Error

Line: 22 Column: 1

              
import copy

from .auxfuncs import (
    getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
    isintent_out, islogicalfunction, ismoduleroutine, isscalar,
    issubroutine, issubroutine_wrap, outmess, show
)


            

Reported by Pylint.

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

Line: 29 Column: 1

              )


def var2fixfortran(vars, a, fa=None, f90mode=None):
    if fa is None:
        fa = a
    if a not in vars:
        show(vars)
        outmess('var2fixfortran: No definition for argument "%s".\n' % a)

            

Reported by Pylint.

numpy/typing/tests/data/reveal/constants.py
47 issues
Undefined variable 'reveal_type'
Error

Line: 3 Column: 1

              import numpy as np

reveal_type(np.Inf)  # E: float
reveal_type(np.Infinity)  # E: float
reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 4 Column: 1

              import numpy as np

reveal_type(np.Inf)  # E: float
reveal_type(np.Infinity)  # E: float
reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 5 Column: 1

              
reveal_type(np.Inf)  # E: float
reveal_type(np.Infinity)  # E: float
reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 6 Column: 1

              reveal_type(np.Inf)  # E: float
reveal_type(np.Infinity)  # E: float
reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 7 Column: 1

              reveal_type(np.Infinity)  # E: float
reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 8 Column: 1

              reveal_type(np.NAN)  # E: float
reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float
reveal_type(np.inf)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 9 Column: 1

              reveal_type(np.NINF)  # E: float
reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float
reveal_type(np.inf)  # E: float
reveal_type(np.infty)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 10 Column: 1

              reveal_type(np.NZERO)  # E: float
reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float
reveal_type(np.inf)  # E: float
reveal_type(np.infty)  # E: float
reveal_type(np.nan)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 11 Column: 1

              reveal_type(np.NaN)  # E: float
reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float
reveal_type(np.inf)  # E: float
reveal_type(np.infty)  # E: float
reveal_type(np.nan)  # E: float
reveal_type(np.pi)  # E: float

            

Reported by Pylint.

Undefined variable 'reveal_type'
Error

Line: 12 Column: 1

              reveal_type(np.PINF)  # E: float
reveal_type(np.PZERO)  # E: float
reveal_type(np.e)  # E: float
reveal_type(np.euler_gamma)  # E: float
reveal_type(np.inf)  # E: float
reveal_type(np.infty)  # E: float
reveal_type(np.nan)  # E: float
reveal_type(np.pi)  # E: float


            

Reported by Pylint.

numpy/typing/__init__.py
46 issues
Unable to import 'typing_extensions'
Error

Line: 150 Column: 5

              
if TYPE_CHECKING:
    # typing_extensions is always available when type-checking
    from typing_extensions import Literal as L
    _HAS_TYPING_EXTENSIONS: L[True]
else:
    try:
        import typing_extensions
    except ImportError:

            

Reported by Pylint.

Unable to import 'typing_extensions'
Error

Line: 161 Column: 5

                      _HAS_TYPING_EXTENSIONS = True

if TYPE_CHECKING:
    from typing_extensions import final
else:
    def final(f): return f

if not TYPE_CHECKING:
    __all__ = ["ArrayLike", "DTypeLike", "NBitBase", "NDArray"]

            

Reported by Pylint.

Using variable 'final' before assignment
Error

Line: 178 Column: 2

                  __path__: List[str]


@final  # Dissallow the creation of arbitrary `NBitBase` subclasses
class NBitBase:
    """
    An object representing `numpy.number` precision during static type checking.

    Used exclusively for the purpose static type checking, `NBitBase`

            

Reported by Pylint.

Unable to import '__init__._nbit'
Error

Line: 243 Column: 1

              class _16Bit(_32Bit): ...  # type: ignore[misc]
class _8Bit(_16Bit): ...  # type: ignore[misc]

from ._nbit import (
    _NBitByte,
    _NBitShort,
    _NBitIntC,
    _NBitIntP,
    _NBitInt,

            

Reported by Pylint.

Unable to import '__init__._char_codes'
Error

Line: 255 Column: 1

                  _NBitDouble,
    _NBitLongDouble,
)
from ._char_codes import (
    _BoolCodes,
    _UInt8Codes,
    _UInt16Codes,
    _UInt32Codes,
    _UInt64Codes,

            

Reported by Pylint.

Unable to import '__init__._scalars'
Error

Line: 296 Column: 1

                  _VoidCodes,
    _ObjectCodes,
)
from ._scalars import (
    _CharLike_co,
    _BoolLike_co,
    _UIntLike_co,
    _IntLike_co,
    _FloatLike_co,

            

Reported by Pylint.

Unable to import '__init__._shape'
Error

Line: 308 Column: 1

                  _ScalarLike_co,
    _VoidLike_co,
)
from ._shape import _Shape, _ShapeLike
from ._dtype_like import (
    DTypeLike as DTypeLike,
    _SupportsDType,
    _VoidDTypeLike,
    _DTypeLikeBool,

            

Reported by Pylint.

Unable to import '__init__._dtype_like'
Error

Line: 309 Column: 1

                  _VoidLike_co,
)
from ._shape import _Shape, _ShapeLike
from ._dtype_like import (
    DTypeLike as DTypeLike,
    _SupportsDType,
    _VoidDTypeLike,
    _DTypeLikeBool,
    _DTypeLikeUInt,

            

Reported by Pylint.

Unable to import '__init__._array_like'
Error

Line: 326 Column: 1

                  _DTypeLikeBytes,
    _DTypeLikeComplex_co,
)
from ._array_like import (
    ArrayLike as ArrayLike,
    _ArrayLike,
    _NestedSequence,
    _RecursiveSequence,
    _SupportsArray,

            

Reported by Pylint.

Unable to import '__init__._generic_alias'
Error

Line: 346 Column: 1

                  _ArrayLikeStr_co,
    _ArrayLikeBytes_co,
)
from ._generic_alias import (
    NDArray as NDArray,
    _DType,
    _GenericAlias,
)


            

Reported by Pylint.

numpy/lib/tests/test_mixins.py
46 issues
Using deprecated method assert_()
Error

Line: 138 Column: 9

                      opt_out = OptOut()

        # supported operations
        assert_(array_like + opt_out is opt_out)
        assert_(opt_out + array_like is opt_out)

        # not supported
        with assert_raises(TypeError):
            # don't use the Python default, array_like = array_like + opt_out

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 139 Column: 9

              
        # supported operations
        assert_(array_like + opt_out is opt_out)
        assert_(opt_out + array_like is opt_out)

        # not supported
        with assert_raises(TypeError):
            # don't use the Python default, array_like = array_like + opt_out
            array_like += opt_out

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 146 Column: 13

                          # don't use the Python default, array_like = array_like + opt_out
            array_like += opt_out
        with assert_raises(TypeError):
            array_like - opt_out
        with assert_raises(TypeError):
            opt_out - array_like

    def test_subclass(self):


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 148 Column: 13

                      with assert_raises(TypeError):
            array_like - opt_out
        with assert_raises(TypeError):
            opt_out - array_like

    def test_subclass(self):

        class SubArrayLike(ArrayLike):
            """Should take precedence over ArrayLike."""

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 164 Column: 13

                      x = ArrayLike(0)
        obj = object()
        with assert_raises(TypeError):
            x + obj
        with assert_raises(TypeError):
            obj + x
        with assert_raises(TypeError):
            x += obj


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 166 Column: 13

                      with assert_raises(TypeError):
            x + obj
        with assert_raises(TypeError):
            obj + x
        with assert_raises(TypeError):
            x += obj

    def test_unary_methods(self):
        array = np.array([-1, 0, 1, 2])

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 207 Column: 9

              
    def test_ufunc_at(self):
        array = ArrayLike(np.array([1, 2, 3, 4]))
        assert_(np.negative.at(array, np.array([0, 1])) is None)
        _assert_equal_type_and_value(array, ArrayLike([-1, -2, 3, 4]))

    def test_ufunc_two_outputs(self):
        mantissa, exponent = np.frexp(2 ** -3)
        expected = (ArrayLike(mantissa), ArrayLike(exponent))

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numbers
import operator

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


# NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 11 Column: 1

              # NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.

class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
    def __init__(self, value):
        self.value = np.asarray(value)

    # One might also consider adding the built-in list type to this
    # list, to support operations like np.add(array_like, list)

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              # NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.

class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
    def __init__(self, value):
        self.value = np.asarray(value)

    # One might also consider adding the built-in list type to this
    # list, to support operations like np.add(array_like, list)

            

Reported by Pylint.

numpy/core/tests/test_conversion_utils.py
46 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              """
import re

import pytest

import numpy as np
import numpy.core._multiarray_tests as mt
from numpy.testing import assert_warns


            

Reported by Pylint.

Unable to import 'numpy.core._multiarray_tests'
Error

Line: 9 Column: 1

              import pytest

import numpy as np
import numpy.core._multiarray_tests as mt
from numpy.testing import assert_warns


class StringConverterTestCase:
    allow_bytes = True

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 22 Column: 13

                  def _check_value_error(self, val):
        pattern = r'\(got {}\)'.format(re.escape(repr(val)))
        with pytest.raises(ValueError, match=pattern) as exc:
            self.conv(val)

    def _check_conv_assert_warn(self, val, expected):
        if self.warn:
            with assert_warns(DeprecationWarning) as exc:
                assert self.conv(val) == expected

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 27 Column: 24

                  def _check_conv_assert_warn(self, val, expected):
        if self.warn:
            with assert_warns(DeprecationWarning) as exc:
                assert self.conv(val) == expected
        else:
            assert self.conv(val) == expected

    def _check(self, val, expected):
        """Takes valid non-deprecated inputs for converters,

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 29 Column: 20

                          with assert_warns(DeprecationWarning) as exc:
                assert self.conv(val) == expected
        else:
            assert self.conv(val) == expected

    def _check(self, val, expected):
        """Takes valid non-deprecated inputs for converters,
        runs converters on inputs, checks correctness of outputs,
        warnings and errors"""

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 35 Column: 16

                      """Takes valid non-deprecated inputs for converters,
        runs converters on inputs, checks correctness of outputs,
        warnings and errors"""
        assert self.conv(val) == expected

        if self.allow_bytes:
            assert self.conv(val.encode('ascii')) == expected
        else:
            with pytest.raises(TypeError):

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 38 Column: 20

                      assert self.conv(val) == expected

        if self.allow_bytes:
            assert self.conv(val.encode('ascii')) == expected
        else:
            with pytest.raises(TypeError):
                self.conv(val.encode('ascii'))

        if len(val) != 1:

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 41 Column: 17

                          assert self.conv(val.encode('ascii')) == expected
        else:
            with pytest.raises(TypeError):
                self.conv(val.encode('ascii'))

        if len(val) != 1:
            if self.exact_match:
                self._check_value_error(val[:1])
                self._check_value_error(val + '\0')

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 64 Column: 13

                  def test_wrong_type(self):
        # common cases which apply to all the below
        with pytest.raises(TypeError):
            self.conv({})
        with pytest.raises(TypeError):
            self.conv([])

    def test_wrong_value(self):
        # nonsense strings

            

Reported by Pylint.

Instance of 'StringConverterTestCase' has no 'conv' member
Error

Line: 66 Column: 13

                      with pytest.raises(TypeError):
            self.conv({})
        with pytest.raises(TypeError):
            self.conv([])

    def test_wrong_value(self):
        # nonsense strings
        self._check_value_error('')
        self._check_value_error('\N{greek small letter pi}')

            

Reported by Pylint.

numpy/f2py/cb_rules.py
45 issues
Attempted relative import beyond top-level package
Error

Line: 16 Column: 1

              Pearu Peterson

"""
from . import __version__
from .auxfuncs import (
    applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
    iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
    isintent_hide, isintent_in, isintent_inout, isintent_nothide,
    isintent_out, isoptional, isrequired, isscalar, isstring,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

              
"""
from . import __version__
from .auxfuncs import (
    applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
    iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
    isintent_hide, isintent_in, isintent_inout, isintent_nothide,
    isintent_out, isoptional, isrequired, isscalar, isstring,
    isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

                  isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,
    stripcomma, throw_error
)
from . import cfuncs

f2py_version = __version__.version


################## Rules for callback function ##############

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 492 Column: 5

              

def buildcallback(rout, um):
    from . import capi_maps

    outmess('\tConstructing call-back function "cb_%s_in_%s"\n' %
            (rout['name'], um))
    args, depargs = getargs(rout)
    capi_maps.depargs = depargs

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 33 Column: 1

              ################## Rules for callback function ##############

cb_routine_rules = {
    'cbtypedefs': 'typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);',
    'body': """
#begintitle#
typedef struct {
    PyObject *capi;
    PyTupleObject *args_capi;

            

Reported by Pylint.

Line too long (222/100)
Error

Line: 234 Column: 1

                  }, {  # Function
        'decl': '    #ctype# return_value;',
        'frompyobj': [{debugcapi: '    CFUNCSMESS("cb:Getting return_value->");'},
                      '    if (capi_j>capi_i)\n        GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n");',
                      {debugcapi:
                       '    fprintf(stderr,"#showvalueformat#.\\n",return_value);'}
                      ],
        'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, 'GETSCALARFROMPYTUPLE'],
        'return': '    return return_value;',

            

Reported by Pylint.

Line too long (104/100)
Error

Line: 243 Column: 1

                      '_check': l_and(isfunction, l_not(isstringfunction), l_not(iscomplexfunction))
    },
    {  # String function
        'pyobjfrom': {debugcapi: '    fprintf(stderr,"debug-capi:cb:#name#:%d:\\n",return_value_len);'},
        'args': '#ctype# return_value,int return_value_len',
        'args_nm': 'return_value,&return_value_len',
        'args_td': '#ctype# ,int',
        'frompyobj': [{debugcapi: '    CFUNCSMESS("cb:Getting return_value->\\"");'},
                      """    if (capi_j>capi_i)

            

Reported by Pylint.

Line too long (175/100)
Error

Line: 283 Column: 1

                                    """\
    if (capi_j>capi_i)
#ifdef F2PY_CB_RETURNCOMPLEX
        GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#else
        GETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#endif
""",
                      {debugcapi: """

            

Reported by Pylint.

Line too long (174/100)
Error

Line: 285 Column: 1

              #ifdef F2PY_CB_RETURNCOMPLEX
        GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#else
        GETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#endif
""",
                      {debugcapi: """
#ifdef F2PY_CB_RETURNCOMPLEX
    fprintf(stderr,\"#showvalueformat#.\\n\",(return_value).r,(return_value).i);

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 321 Column: 1

                      'docstropt': {l_and(isoptional, isintent_nothide): '\t\t#pydocsign#'},
        'docstrreq': {l_and(isrequired, isintent_nothide): '\t\t#pydocsign#'},
        'docstrout': {isintent_out: '\t\t#pydocsignout#'},
        'latexdocstropt': {l_and(isoptional, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
                                                                 {hasnote: '--- #note#'}]},
        'latexdocstrreq': {l_and(isrequired, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
                                                                 {hasnote: '--- #note#'}]},
        'latexdocstrout': {isintent_out: ['\\item[]{{}\\verb@#pydocsignout#@{}}',
                                          {l_and(hasnote, isintent_hide): '--- #note#',

            

Reported by Pylint.

benchmarks/benchmarks/bench_reduce.py
44 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from .common import Benchmark, TYPES1, get_squares

import numpy as np


class AddReduce(Benchmark):
    def setup(self):
        self.squares = get_squares().values()


            

Reported by Pylint.

Attribute 'squares' defined outside __init__
Error

Line: 8 Column: 9

              
class AddReduce(Benchmark):
    def setup(self):
        self.squares = get_squares().values()

    def time_axis_0(self):
        [np.add.reduce(a, axis=0) for a in self.squares]

    def time_axis_1(self):

            

Reported by Pylint.

Expression "[np.add.reduce(a, axis=0) for a in self.squares]" is assigned to nothing
Error

Line: 11 Column: 9

                      self.squares = get_squares().values()

    def time_axis_0(self):
        [np.add.reduce(a, axis=0) for a in self.squares]

    def time_axis_1(self):
        [np.add.reduce(a, axis=1) for a in self.squares]



            

Reported by Pylint.

Expression "[np.add.reduce(a, axis=1) for a in self.squares]" is assigned to nothing
Error

Line: 14 Column: 9

                      [np.add.reduce(a, axis=0) for a in self.squares]

    def time_axis_1(self):
        [np.add.reduce(a, axis=1) for a in self.squares]


class AddReduceSeparate(Benchmark):
    params = [[0, 1], TYPES1]
    param_names = ['axis', 'type']

            

Reported by Pylint.

Unused argument 'axis'
Error

Line: 21 Column: 21

                  params = [[0, 1], TYPES1]
    param_names = ['axis', 'type']

    def setup(self, axis, typename):
        self.a = get_squares()[typename]

    def time_reduce(self, axis, typename):
        np.add.reduce(self.a, axis=axis)


            

Reported by Pylint.

Attribute 'a' defined outside __init__
Error

Line: 22 Column: 9

                  param_names = ['axis', 'type']

    def setup(self, axis, typename):
        self.a = get_squares()[typename]

    def time_reduce(self, axis, typename):
        np.add.reduce(self.a, axis=axis)



            

Reported by Pylint.

Unused argument 'typename'
Error

Line: 24 Column: 33

                  def setup(self, axis, typename):
        self.a = get_squares()[typename]

    def time_reduce(self, axis, typename):
        np.add.reduce(self.a, axis=axis)


class AnyAll(Benchmark):
    def setup(self):

            

Reported by Pylint.

Attribute 'zeros' defined outside __init__
Error

Line: 32 Column: 9

                  def setup(self):
        # avoid np.zeros's lazy allocation that would
        # cause page faults during benchmark
        self.zeros = np.full(100000, 0, bool)
        self.ones = np.full(100000, 1, bool)

    def time_all_fast(self):
        self.zeros.all()


            

Reported by Pylint.

Attribute 'ones' defined outside __init__
Error

Line: 33 Column: 9

                      # avoid np.zeros's lazy allocation that would
        # cause page faults during benchmark
        self.zeros = np.full(100000, 0, bool)
        self.ones = np.full(100000, 1, bool)

    def time_all_fast(self):
        self.zeros.all()

    def time_all_slow(self):

            

Reported by Pylint.

Attribute 'd' defined outside __init__
Error

Line: 53 Column: 9

                  param_names = ['dtype']

    def setup(self, dtype):
        self.d = np.ones(20000, dtype=dtype)

    def time_min(self, dtype):
        np.min(self.d)

    def time_max(self, dtype):

            

Reported by Pylint.

numpy/core/tests/test_scalar_ctors.py
43 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              """
Test the scalar constructors, which also do type-coercion
"""
import pytest

import numpy as np
from numpy.testing import (
    assert_equal, assert_almost_equal, assert_warns,
    )

            

Reported by Pylint.

Unexpected keyword argument 'garbage' in constructor call
Error

Line: 64 Column: 13

                      assert np.datetime_data(dt) == ('M', 2)

        with pytest.raises(TypeError):
            np.datetime64('2000', garbage=True)

    def test_bool(self):
        with pytest.raises(TypeError):
            np.bool_(False, garbage=True)


            

Reported by Pylint.

Unexpected keyword argument 'garbage' in constructor call
Error

Line: 68 Column: 13

              
    def test_bool(self):
        with pytest.raises(TypeError):
            np.bool_(False, garbage=True)

    def test_void(self):
        with pytest.raises(TypeError):
            np.void(b'test', garbage=True)


            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

                  assert_equal, assert_almost_equal, assert_warns,
    )

class TestFromString:
    def test_floating(self):
        # Ticket #640, floats from string
        fsingle = np.single('1.234')
        fdouble = np.double('1.234')
        flongdouble = np.longdouble('1.234')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 5

                  )

class TestFromString:
    def test_floating(self):
        # Ticket #640, floats from string
        fsingle = np.single('1.234')
        fdouble = np.double('1.234')
        flongdouble = np.longdouble('1.234')
        assert_almost_equal(fsingle, 1.234)

            

Reported by Pylint.

Method could be a function
Error

Line: 12 Column: 5

                  )

class TestFromString:
    def test_floating(self):
        # Ticket #640, floats from string
        fsingle = np.single('1.234')
        fdouble = np.double('1.234')
        flongdouble = np.longdouble('1.234')
        assert_almost_equal(fsingle, 1.234)

            

Reported by Pylint.

Method could be a function
Error

Line: 21 Column: 5

                      assert_almost_equal(fdouble, 1.234)
        assert_almost_equal(flongdouble, 1.234)

    def test_floating_overflow(self):
        """ Strings containing an unrepresentable float overflow """
        fhalf = np.half('1e10000')
        assert_equal(fhalf, np.inf)
        fsingle = np.single('1e10000')
        assert_equal(fsingle, np.inf)

            

Reported by Pylint.

Missing class docstring
Error

Line: 42 Column: 1

                      assert_equal(flongdouble, -np.inf)


class TestExtraArgs:
    def test_superclass(self):
        # try both positional and keyword arguments
        s = np.str_(b'\\x61', encoding='unicode-escape')
        assert s == 'a'
        s = np.str_(b'\\x61', 'unicode-escape')

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

              

class TestExtraArgs:
    def test_superclass(self):
        # try both positional and keyword arguments
        s = np.str_(b'\\x61', encoding='unicode-escape')
        assert s == 'a'
        s = np.str_(b'\\x61', 'unicode-escape')
        assert s == 'a'

            

Reported by Pylint.

Method could be a function
Error

Line: 43 Column: 5

              

class TestExtraArgs:
    def test_superclass(self):
        # try both positional and keyword arguments
        s = np.str_(b'\\x61', encoding='unicode-escape')
        assert s == 'a'
        s = np.str_(b'\\x61', 'unicode-escape')
        assert s == 'a'

            

Reported by Pylint.

numpy/typing/tests/data/pass/ufunc_config.py
43 issues
Unused argument 'b'
Error

Line: 5 Column: 19

              
import numpy as np

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

class Write1:
    def write(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) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...

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

            

Reported by Pylint.

Unused argument 'b'
Error

Line: 6 Column: 19

              import numpy as np

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

class Write1:
    def write(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) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...

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


            

Reported by Pylint.

Unused argument 'c'
Error

Line: 6 Column: 27

              import numpy as np

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

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


            

Reported by Pylint.

Unused argument 'b'
Error

Line: 7 Column: 19

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

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

class Write2:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 7 Column: 11

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

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

class Write2:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 10 Column: 21

              def func3(a: str, b: int) -> int: ...

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

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

class Write3:

            

Reported by Pylint.

Unused argument 'a'
Error

Line: 13 Column: 21

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

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

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



            

Reported by Pylint.

Unused argument 'b'
Error

Line: 13 Column: 29

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

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

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



            

Reported by Pylint.

tools/swig/test/testFlat.py
43 issues
Unable to import 'Flat'
Error

Line: 14 Column: 1

              if major == 0: BadListError = TypeError
else:          BadListError = ValueError

import Flat

######################################################################

class FlatTestCase(unittest.TestCase):


            

Reported by Pylint.

Module name "testFlat" doesn't conform to snake_case naming style
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
# System imports
import sys
import unittest

import struct

# Import NumPy
import numpy as np

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              #!/usr/bin/env python3
# System imports
import sys
import unittest

import struct

# Import NumPy
import numpy as np

            

Reported by Pylint.

More than one statement on a single line
Error

Line: 11 Column: 16

              # Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
else:          BadListError = ValueError

import Flat

######################################################################

            

Reported by Pylint.

Import "import Flat" should be placed at the top of the module
Error

Line: 14 Column: 1

              if major == 0: BadListError = TypeError
else:          BadListError = ValueError

import Flat

######################################################################

class FlatTestCase(unittest.TestCase):


            

Reported by Pylint.

Missing class docstring
Error

Line: 18 Column: 1

              
######################################################################

class FlatTestCase(unittest.TestCase):

    def __init__(self, methodName="runTest"):
        unittest.TestCase.__init__(self, methodName)
        self.typeStr  = "double"
        self.typeCode = "d"

            

Reported by Pylint.

Attribute name "typeStr" doesn't conform to snake_case naming style
Error

Line: 22 Column: 9

              
    def __init__(self, methodName="runTest"):
        unittest.TestCase.__init__(self, methodName)
        self.typeStr  = "double"
        self.typeCode = "d"

    # Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
    def testProcess1D(self):
        "Test Process function 1D array"

            

Reported by Pylint.

Attribute name "typeCode" doesn't conform to snake_case naming style
Error

Line: 23 Column: 9

                  def __init__(self, methodName="runTest"):
        unittest.TestCase.__init__(self, methodName)
        self.typeStr  = "double"
        self.typeCode = "d"

    # Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
    def testProcess1D(self):
        "Test Process function 1D array"
        print(self.typeStr, "... ", end=' ', file=sys.stderr)

            

Reported by Pylint.

Method name "testProcess1D" doesn't conform to snake_case naming style
Error

Line: 26 Column: 5

                      self.typeCode = "d"

    # Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
    def testProcess1D(self):
        "Test Process function 1D array"
        print(self.typeStr, "... ", end=' ', file=sys.stderr)
        process = Flat.__dict__[self.typeStr + "Process"]
        pack_output = b''
        for i in range(10):

            

Reported by Pylint.

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

Line: 33 Column: 9

                      pack_output = b''
        for i in range(10):
            pack_output += struct.pack(self.typeCode,i)
        x = np.frombuffer(pack_output, dtype=self.typeCode)
        y = x.copy()
        process(y)
        self.assertEqual(np.all((x+1)==y),True)

    def testProcess3D(self):

            

Reported by Pylint.