The following issues were found

numpy/typing/_callable.py
102 issues
Attempted relative import beyond top-level package
Error

Line: 41 Column: 1

                  complexfloating,
    complex128,
)
from ._nbit import _NBitInt, _NBitDouble
from ._scalars import (
    _BoolLike_co,
    _IntLike_co,
    _FloatLike_co,
    _NumberLike_co,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 42 Column: 1

                  complex128,
)
from ._nbit import _NBitInt, _NBitDouble
from ._scalars import (
    _BoolLike_co,
    _IntLike_co,
    _FloatLike_co,
    _NumberLike_co,
)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 48 Column: 1

                  _FloatLike_co,
    _NumberLike_co,
)
from . import NBitBase, _HAS_TYPING_EXTENSIONS
from ._generic_alias import NDArray

if sys.version_info >= (3, 8):
    from typing import Protocol
elif _HAS_TYPING_EXTENSIONS:

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 49 Column: 1

                  _NumberLike_co,
)
from . import NBitBase, _HAS_TYPING_EXTENSIONS
from ._generic_alias import NDArray

if sys.version_info >= (3, 8):
    from typing import Protocol
elif _HAS_TYPING_EXTENSIONS:
    from typing_extensions import Protocol

            

Reported by Pylint.

Unable to import 'typing_extensions'
Error

Line: 54 Column: 5

              if sys.version_info >= (3, 8):
    from typing import Protocol
elif _HAS_TYPING_EXTENSIONS:
    from typing_extensions import Protocol

if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS or sys.version_info >= (3, 8):
    _T1 = TypeVar("_T1")
    _T2 = TypeVar("_T2")
    _2Tuple = Tuple[_T1, _T1]

            

Reported by Pylint.

Value 'floating' is unsubscriptable
Error

Line: 129 Column: 55

                      @overload  # platform dependent
        def __call__(self, __other: int) -> _2Tuple[int_]: ...
        @overload
        def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
        @overload
        def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ...
        @overload
        def __call__(self, __other: _FloatType) -> _2Tuple[_FloatType]: ...


            

Reported by Pylint.

Value 'floating' is unsubscriptable
Error

Line: 145 Column: 46

              
    class _IntTrueDiv(Protocol[_NBit1]):
        @overload
        def __call__(self, __other: bool) -> floating[_NBit1]: ...
        @overload
        def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
        @overload
        def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
        @overload

            

Reported by Pylint.

Value 'floating' is unsubscriptable
Error

Line: 147 Column: 45

                      @overload
        def __call__(self, __other: bool) -> floating[_NBit1]: ...
        @overload
        def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
        @overload
        def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
        @overload
        def __call__(
            self, __other: complex

            

Reported by Pylint.

Value 'floating' is unsubscriptable
Error

Line: 149 Column: 47

                      @overload
        def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
        @overload
        def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
        @overload
        def __call__(
            self, __other: complex
        ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
        @overload

            

Reported by Pylint.

Value 'complexfloating' is unsubscriptable
Error

Line: 153 Column: 14

                      @overload
        def __call__(
            self, __other: complex
        ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
        @overload
        def __call__(self, __other: integer[_NBit2]) -> floating[_NBit1 | _NBit2]: ...

    class _UnsignedIntOp(Protocol[_NBit1]):
        # NOTE: `uint64 + signedinteger -> float64`

            

Reported by Pylint.

numpy/distutils/tests/test_exec_command.py
101 issues
Non-mapping value kws is used in a mapping context
Error

Line: 164 Column: 71

              
    def check_basic(self, *kws):
        s, o = exec_command.exec_command(
                     '"%s" -c "raise \'Ignore me.\'"' % self.pyexe, **kws)
        assert_(s != 0)
        assert_(o != '')

        s, o = exec_command.exec_command(
             '"%s" -c "import sys;sys.stderr.write(\'0\');'

            

Reported by Pylint.

Non-mapping value kws is used in a mapping context
Error

Line: 171 Column: 28

                      s, o = exec_command.exec_command(
             '"%s" -c "import sys;sys.stderr.write(\'0\');'
             'sys.stderr.write(\'1\');sys.stderr.write(\'2\')"' %
             self.pyexe, **kws)
        assert_(s == 0)
        assert_(o == '012')

        s, o = exec_command.exec_command(
                 '"%s" -c "import sys;sys.exit(15)"' % self.pyexe, **kws)

            

Reported by Pylint.

Non-mapping value kws is used in a mapping context
Error

Line: 176 Column: 70

                      assert_(o == '012')

        s, o = exec_command.exec_command(
                 '"%s" -c "import sys;sys.exit(15)"' % self.pyexe, **kws)
        assert_(s == 15)
        assert_(o == '')

        s, o = exec_command.exec_command(
                     '"%s" -c "print(\'Heipa\'")' % self.pyexe, **kws)

            

Reported by Pylint.

Non-mapping value kws is used in a mapping context
Error

Line: 181 Column: 67

                      assert_(o == '')

        s, o = exec_command.exec_command(
                     '"%s" -c "print(\'Heipa\'")' % self.pyexe, **kws)
        assert_(s == 0)
        assert_(o == 'Heipa')

    def check_execute_in(self, **kws):
        with tempdir() as tmpdir:

            

Reported by Pylint.

Attribute 'old_stdout' defined outside __init__
Error

Line: 19 Column: 9

                      self._stdout = stdout or sys.stdout

    def __enter__(self):
        self.old_stdout = sys.stdout
        sys.stdout = self._stdout

    def __exit__(self, exc_type, exc_value, traceback):
        self._stdout.flush()
        sys.stdout = self.old_stdout

            

Reported by Pylint.

Attribute 'old_stderr' defined outside __init__
Error

Line: 34 Column: 9

                      self._stderr = stderr or sys.stderr

    def __enter__(self):
        self.old_stderr = sys.stderr
        sys.stderr = self._stderr

    def __exit__(self, exc_type, exc_value, traceback):
        self._stderr.flush()
        sys.stderr = self.old_stderr

            

Reported by Pylint.

Attribute '_old_name' defined outside __init__
Error

Line: 49 Column: 9

                      self._new_name = osname

    def __enter__(self):
        self._old_name = os.name
        os.name = self._new_name

    def __exit__(self, exc_type, exc_value, traceback):
        os.name = self._old_name


            

Reported by Pylint.

Attribute 'pyexe' defined outside __init__
Error

Line: 98 Column: 9

              
class TestExecCommand:
    def setup(self):
        self.pyexe = get_pythonexe()

    def check_nt(self, **kws):
        s, o = exec_command.exec_command('cmd /C echo path=%path%')
        assert_(s == 0)
        assert_(o != '')

            

Reported by Pylint.

Unused argument 'kws'
Error

Line: 100 Column: 1

                  def setup(self):
        self.pyexe = get_pythonexe()

    def check_nt(self, **kws):
        s, o = exec_command.exec_command('cmd /C echo path=%path%')
        assert_(s == 0)
        assert_(o != '')

        s, o = exec_command.exec_command(

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 102 Column: 9

              
    def check_nt(self, **kws):
        s, o = exec_command.exec_command('cmd /C echo path=%path%')
        assert_(s == 0)
        assert_(o != '')

        s, o = exec_command.exec_command(
         '"%s" -c "import sys;sys.stderr.write(sys.platform)"' % self.pyexe)
        assert_(s == 0)

            

Reported by Pylint.

numpy/fft/tests/test_pocketfft.py
100 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest
from numpy.random import random
from numpy.testing import (
        assert_array_equal, assert_raises, assert_allclose
        )
import threading
import queue


            

Reported by Pylint.

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

Line: 243 Column: 11

              def test_fft_with_order(dtype, order, fft):
    # Check that FFT/IFFT produces identical results for C, Fortran and
    # non contiguous arrays
    rng = np.random.RandomState(42)
    X = rng.rand(8, 7, 13).astype(dtype, copy=False)
    # See discussion in pull/14178
    _tol = 8.0 * np.sqrt(np.log2(X.size)) * np.finfo(X.dtype).eps
    if order == 'F':
        Y = np.asfortranarray(X)

            

Reported by Pylint.

Expression "[x.start() for x in t]" is assigned to nothing
Error

Line: 285 Column: 9

                      # Spin off a bunch of threads to call the same function simultaneously
        t = [threading.Thread(target=worker, args=(args, q))
             for i in range(self.threads)]
        [x.start() for x in t]

        [x.join() for x in t]
        # Make sure all threads returned the correct value
        for i in range(self.threads):
            assert_array_equal(q.get(timeout=5), expected,

            

Reported by Pylint.

Expression "[x.join() for x in t]" is assigned to nothing
Error

Line: 287 Column: 9

                           for i in range(self.threads)]
        [x.start() for x in t]

        [x.join() for x in t]
        # Make sure all threads returned the correct value
        for i in range(self.threads):
            assert_array_equal(q.get(timeout=5), expected,
                'Function returned wrong value in multithreaded context')


            

Reported by Pylint.

Unused variable 'i'
Error

Line: 289 Column: 13

              
        [x.join() for x in t]
        # Make sure all threads returned the correct value
        for i in range(self.threads):
            assert_array_equal(q.get(timeout=5), expected,
                'Function returned wrong value in multithreaded context')

    def test_fft(self):
        a = np.ones(self.input_shape) * 1+0j

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest
from numpy.random import random
from numpy.testing import (
        assert_array_equal, assert_raises, assert_allclose
        )
import threading
import queue


            

Reported by Pylint.

standard import "import threading" should be placed before "import numpy as np"
Error

Line: 7 Column: 1

              from numpy.testing import (
        assert_array_equal, assert_raises, assert_allclose
        )
import threading
import queue


def fft1(x):
    L = len(x)

            

Reported by Pylint.

standard import "import queue" should be placed before "import numpy as np"
Error

Line: 8 Column: 1

                      assert_array_equal, assert_raises, assert_allclose
        )
import threading
import queue


def fft1(x):
    L = len(x)
    phase = -2j * np.pi * (np.arange(L) / L)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              import queue


def fft1(x):
    L = len(x)
    phase = -2j * np.pi * (np.arange(L) / L)
    phase = np.arange(L).reshape(-1, 1) * phase
    return np.sum(x*np.exp(phase), axis=1)


            

Reported by Pylint.

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

Line: 11 Column: 1

              import queue


def fft1(x):
    L = len(x)
    phase = -2j * np.pi * (np.arange(L) / L)
    phase = np.arange(L).reshape(-1, 1) * phase
    return np.sum(x*np.exp(phase), axis=1)


            

Reported by Pylint.

benchmarks/benchmarks/bench_ufunc.py
99 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from .common import Benchmark, get_squares_

import numpy as np


ufuncs = ['abs', 'absolute', 'add', 'arccos', 'arccosh', 'arcsin', 'arcsinh',
          'arctan', 'arctan2', 'arctanh', 'bitwise_and', 'bitwise_not',
          'bitwise_or', 'bitwise_xor', 'cbrt', 'ceil', 'conj', 'conjugate',
          'copysign', 'cos', 'cosh', 'deg2rad', 'degrees', 'divide', 'divmod',

            

Reported by Pylint.

Attribute 'd' defined outside __init__
Error

Line: 30 Column: 9

              
class Broadcast(Benchmark):
    def setup(self):
        self.d = np.ones((50000, 100), dtype=np.float64)
        self.e = np.ones((100,), dtype=np.float64)

    def time_broadcast(self):
        self.d - self.e


            

Reported by Pylint.

Attribute 'e' defined outside __init__
Error

Line: 31 Column: 9

              class Broadcast(Benchmark):
    def setup(self):
        self.d = np.ones((50000, 100), dtype=np.float64)
        self.e = np.ones((100,), dtype=np.float64)

    def time_broadcast(self):
        self.d - self.e



            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 34 Column: 9

                      self.e = np.ones((100,), dtype=np.float64)

    def time_broadcast(self):
        self.d - self.e


class UFunc(Benchmark):
    params = [ufuncs]
    param_names = ['ufunc']

            

Reported by Pylint.

Attribute 'f' defined outside __init__
Error

Line: 45 Column: 13

                  def setup(self, ufuncname):
        np.seterr(all='ignore')
        try:
            self.f = getattr(np, ufuncname)
        except AttributeError:
            raise NotImplementedError()
        self.args = []
        for t, a in get_squares_().items():
            arg = (a,) * self.f.nin

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 47 Column: 13

                      try:
            self.f = getattr(np, ufuncname)
        except AttributeError:
            raise NotImplementedError()
        self.args = []
        for t, a in get_squares_().items():
            arg = (a,) * self.f.nin
            try:
                self.f(*arg)

            

Reported by Pylint.

Attribute 'args' defined outside __init__
Error

Line: 48 Column: 9

                          self.f = getattr(np, ufuncname)
        except AttributeError:
            raise NotImplementedError()
        self.args = []
        for t, a in get_squares_().items():
            arg = (a,) * self.f.nin
            try:
                self.f(*arg)
            except TypeError:

            

Reported by Pylint.

Unused variable 't'
Error

Line: 49 Column: 13

                      except AttributeError:
            raise NotImplementedError()
        self.args = []
        for t, a in get_squares_().items():
            arg = (a,) * self.f.nin
            try:
                self.f(*arg)
            except TypeError:
                continue

            

Reported by Pylint.

Unused argument 'ufuncname'
Error

Line: 57 Column: 32

                              continue
            self.args.append(arg)

    def time_ufunc_types(self, ufuncname):
        [self.f(*arg) for arg in self.args]


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

            

Reported by Pylint.

Expression "[self.f(*arg) for arg in self.args]" is assigned to nothing
Error

Line: 58 Column: 9

                          self.args.append(arg)

    def time_ufunc_types(self, ufuncname):
        [self.f(*arg) for arg in self.args]


class Custom(Benchmark):
    def setup(self):
        self.b = np.ones(20000, dtype=bool)

            

Reported by Pylint.

benchmarks/benchmarks/bench_function_base.py
96 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from .common import Benchmark

import numpy as np


class Histogram1D(Benchmark):
    def setup(self):
        self.d = np.linspace(0, 100, 100000)


            

Reported by Pylint.

Attribute 'd' defined outside __init__
Error

Line: 8 Column: 9

              
class Histogram1D(Benchmark):
    def setup(self):
        self.d = np.linspace(0, 100, 100000)

    def time_full_coverage(self):
        np.histogram(self.d, 200, (0, 100))

    def time_small_coverage(self):

            

Reported by Pylint.

Attribute 'd' defined outside __init__
Error

Line: 22 Column: 9

              
class Histogram2D(Benchmark):
    def setup(self):
        self.d = np.linspace(0, 100, 200000).reshape((-1,2))

    def time_full_coverage(self):
        np.histogramdd(self.d, (200, 200), ((0, 100), (0, 100)))

    def time_small_coverage(self):

            

Reported by Pylint.

Attribute 'd' defined outside __init__
Error

Line: 36 Column: 9

              
class Bincount(Benchmark):
    def setup(self):
        self.d = np.arange(80000, dtype=np.intp)
        self.e = self.d.astype(np.float64)

    def time_bincount(self):
        np.bincount(self.d)


            

Reported by Pylint.

Attribute 'e' defined outside __init__
Error

Line: 37 Column: 9

              class Bincount(Benchmark):
    def setup(self):
        self.d = np.arange(80000, dtype=np.intp)
        self.e = self.d.astype(np.float64)

    def time_bincount(self):
        np.bincount(self.d)

    def time_weights(self):

            

Reported by Pylint.

Attribute 'e' defined outside __init__
Error

Line: 48 Column: 9

              
class Median(Benchmark):
    def setup(self):
        self.e = np.arange(10000, dtype=np.float32)
        self.o = np.arange(10001, dtype=np.float32)
        self.tall = np.random.random((10000, 20))
        self.wide = np.random.random((20, 10000))

    def time_even(self):

            

Reported by Pylint.

Attribute 'o' defined outside __init__
Error

Line: 49 Column: 9

              class Median(Benchmark):
    def setup(self):
        self.e = np.arange(10000, dtype=np.float32)
        self.o = np.arange(10001, dtype=np.float32)
        self.tall = np.random.random((10000, 20))
        self.wide = np.random.random((20, 10000))

    def time_even(self):
        np.median(self.e)

            

Reported by Pylint.

Attribute 'tall' defined outside __init__
Error

Line: 50 Column: 9

                  def setup(self):
        self.e = np.arange(10000, dtype=np.float32)
        self.o = np.arange(10001, dtype=np.float32)
        self.tall = np.random.random((10000, 20))
        self.wide = np.random.random((20, 10000))

    def time_even(self):
        np.median(self.e)


            

Reported by Pylint.

Attribute 'wide' defined outside __init__
Error

Line: 51 Column: 9

                      self.e = np.arange(10000, dtype=np.float32)
        self.o = np.arange(10001, dtype=np.float32)
        self.tall = np.random.random((10000, 20))
        self.wide = np.random.random((20, 10000))

    def time_even(self):
        np.median(self.e)

    def time_odd(self):

            

Reported by Pylint.

Attribute 'e' defined outside __init__
Error

Line: 80 Column: 9

              
class Percentile(Benchmark):
    def setup(self):
        self.e = np.arange(10000, dtype=np.float32)
        self.o = np.arange(10001, dtype=np.float32)

    def time_quartile(self):
        np.percentile(self.e, [25, 75])


            

Reported by Pylint.

numpy/f2py/tests/test_callback.py
94 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import math
import textwrap
import sys
import pytest
import threading
import traceback
import time
import random


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              
import numpy as np
from numpy.testing import assert_, assert_equal, IS_PYPY
from . import util


class TestF77Callback(util.F2PyTest):
    code = """
       subroutine t(fun,a)

            

Reported by Pylint.

Instance of 'str' has no 'append' member
Error

Line: 207 Column: 17

                                  assert_(r == 42)
                    self.check_function(name)
            except Exception:
                errors.append(traceback.format_exc())

        threads = [threading.Thread(target=runner, args=(arg,))
                   for arg in ("t", "t2") for n in range(20)]

        for t in threads:

            

Reported by Pylint.

Unused import random
Error

Line: 8 Column: 1

              import threading
import traceback
import time
import random

import numpy as np
from numpy.testing import assert_, assert_equal, IS_PYPY
from . import util


            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 119 Column: 9

                  def check_function(self, name):
        t = getattr(self.module, name)
        r = t(lambda: 4)
        assert_(r == 4, repr(r))
        r = t(lambda a: 5, fun_extra_args=(6,))
        assert_(r == 5, repr(r))
        r = t(lambda a: a, fun_extra_args=(6,))
        assert_(r == 6, repr(r))
        r = t(lambda a: 5 + a, fun_extra_args=(7,))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 121 Column: 9

                      r = t(lambda: 4)
        assert_(r == 4, repr(r))
        r = t(lambda a: 5, fun_extra_args=(6,))
        assert_(r == 5, repr(r))
        r = t(lambda a: a, fun_extra_args=(6,))
        assert_(r == 6, repr(r))
        r = t(lambda a: 5 + a, fun_extra_args=(7,))
        assert_(r == 12, repr(r))
        r = t(lambda a: math.degrees(a), fun_extra_args=(math.pi,))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 123 Column: 9

                      r = t(lambda a: 5, fun_extra_args=(6,))
        assert_(r == 5, repr(r))
        r = t(lambda a: a, fun_extra_args=(6,))
        assert_(r == 6, repr(r))
        r = t(lambda a: 5 + a, fun_extra_args=(7,))
        assert_(r == 12, repr(r))
        r = t(lambda a: math.degrees(a), fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))
        r = t(math.degrees, fun_extra_args=(math.pi,))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 125 Column: 9

                      r = t(lambda a: a, fun_extra_args=(6,))
        assert_(r == 6, repr(r))
        r = t(lambda a: 5 + a, fun_extra_args=(7,))
        assert_(r == 12, repr(r))
        r = t(lambda a: math.degrees(a), fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))
        r = t(math.degrees, fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))


            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 126 Column: 15

                      assert_(r == 6, repr(r))
        r = t(lambda a: 5 + a, fun_extra_args=(7,))
        assert_(r == 12, repr(r))
        r = t(lambda a: math.degrees(a), fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))
        r = t(math.degrees, fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))

        r = t(self.module.func, fun_extra_args=(6,))

            

Reported by Pylint.

Using deprecated method assert_()
Error

Line: 127 Column: 9

                      r = t(lambda a: 5 + a, fun_extra_args=(7,))
        assert_(r == 12, repr(r))
        r = t(lambda a: math.degrees(a), fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))
        r = t(math.degrees, fun_extra_args=(math.pi,))
        assert_(r == 180, repr(r))

        r = t(self.module.func, fun_extra_args=(6,))
        assert_(r == 17, repr(r))

            

Reported by Pylint.

numpy/core/code_generators/generate_umath.py
94 issues
Unable to import 'ufunc_docstrings'
Error

Line: 8 Column: 1

              import textwrap

sys.path.insert(0, os.path.dirname(__file__))
import ufunc_docstrings as docstrings
sys.path.pop(0)

Zero = "PyLong_FromLong(0)"
One = "PyLong_FromLong(1)"
True_ = "(Py_INCREF(Py_True), Py_True)"

            

Reported by Pylint.

Redefining built-in 'type'
Error

Line: 60 Column: 24

                      specified targets of the dispatch-able source.
        NOTE: it doesn't support 'astype'
    """
    def __init__(self, type, f=None, in_=None, out=None, astype=None, cfunc_alias=None,
                 simd=None, dispatch=None):
        self.type = type
        self.func_data = f
        if astype is None:
            astype = {}

            

Reported by Pylint.

Attribute 'astype' defined outside __init__
Error

Line: 84 Column: 9

                      if self.out is None:
            self.out = self.type * nout
        assert len(self.out) == nout
        self.astype = self.astype_dict.get(self.type, None)

_fdata_map = dict(
    e='npy_%sf',
    f='npy_%sf',
    d='npy_%s',

            

Reported by Pylint.

Redefining built-in 'all'
Error

Line: 243 Column: 1

              }

noobj = '?bBhHiIlLqQefdgFDGmM'
all = '?bBhHiIlLqQefdgFDGOmM'

O = 'O'
P = 'P'
ints = 'bBhHiIlLqQ'
sints = 'bhilq'

            

Reported by Pylint.

TODO: using obj.logical_xor() seems pretty much useless:
Error

Line: 512 Column: 3

                        docstrings.get('numpy.core.umath.logical_xor'),
          'PyUFunc_SimpleBinaryComparisonTypeResolver',
          TD(nodatetime_or_obj, out='?'),
          # TODO: using obj.logical_xor() seems pretty much useless:
          TD(P, f='logical_xor'),
          ),
'maximum':
    Ufunc(2, 1, ReorderableNone,
          docstrings.get('numpy.core.umath.maximum'),

            

Reported by Pylint.

Unused variable 'e'
Error

Line: 1053 Column: 17

                          else:
                try:
                    thedict = arity_lookup[uf.nin, uf.nout]
                except KeyError as e:
                    raise ValueError(
                        f"Could not handle {name}[{t.type}] "
                        f"with nin={uf.nin}, nout={uf.nout}"
                    ) from None


            

Reported by Pylint.

Redefining name 'filename' from outer scope (line 1207)
Error

Line: 1175 Column: 25

                  return '\n'.join(code3list)


def make_code(funcdict, filename):
    code1, code2 = make_arrays(funcdict)
    code3 = make_ufuncs(funcdict)
    code2 = indent(code2, 4)
    code3 = indent(code3, 4)
    code = textwrap.dedent(r"""

            

Reported by Pylint.

Redefining name 'code' from outer scope (line 280)
Error

Line: 1180 Column: 5

                  code3 = make_ufuncs(funcdict)
    code2 = indent(code2, 4)
    code3 = indent(code3, 4)
    code = textwrap.dedent(r"""

    /** Warning this file is autogenerated!!!

        Please make changes to the code generator program (%s)
    **/

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import os
import re
import struct
import sys
import textwrap

sys.path.insert(0, os.path.dirname(__file__))
import ufunc_docstrings as docstrings
sys.path.pop(0)

            

Reported by Pylint.

Too many lines in module (1210/1000)
Error

Line: 1 Column: 1

              import os
import re
import struct
import sys
import textwrap

sys.path.insert(0, os.path.dirname(__file__))
import ufunc_docstrings as docstrings
sys.path.pop(0)

            

Reported by Pylint.

numpy/distutils/command/build_src.py
92 issues
Attribute 'package' defined outside __init__
Error

Line: 88 Column: 13

                                                 ('build_lib', 'build_lib'),
                                   ('force', 'force'))
        if self.package is None:
            self.package = self.distribution.ext_package
        self.extensions = self.distribution.ext_modules
        self.libraries = self.distribution.libraries or []
        self.py_modules = self.distribution.py_modules or []
        self.data_files = self.distribution.data_files or []


            

Reported by Pylint.

Attribute 'extensions' defined outside __init__
Error

Line: 89 Column: 9

                                                 ('force', 'force'))
        if self.package is None:
            self.package = self.distribution.ext_package
        self.extensions = self.distribution.ext_modules
        self.libraries = self.distribution.libraries or []
        self.py_modules = self.distribution.py_modules or []
        self.data_files = self.distribution.data_files or []

        if self.build_src is None:

            

Reported by Pylint.

Attribute 'libraries' defined outside __init__
Error

Line: 90 Column: 9

                      if self.package is None:
            self.package = self.distribution.ext_package
        self.extensions = self.distribution.ext_modules
        self.libraries = self.distribution.libraries or []
        self.py_modules = self.distribution.py_modules or []
        self.data_files = self.distribution.data_files or []

        if self.build_src is None:
            plat_specifier = ".{}-{}.{}".format(get_platform(), *sys.version_info[:2])

            

Reported by Pylint.

Attribute 'py_modules' defined outside __init__
Error

Line: 91 Column: 9

                          self.package = self.distribution.ext_package
        self.extensions = self.distribution.ext_modules
        self.libraries = self.distribution.libraries or []
        self.py_modules = self.distribution.py_modules or []
        self.data_files = self.distribution.data_files or []

        if self.build_src is None:
            plat_specifier = ".{}-{}.{}".format(get_platform(), *sys.version_info[:2])
            self.build_src = os.path.join(self.build_base, 'src'+plat_specifier)

            

Reported by Pylint.

Attribute 'data_files' defined outside __init__
Error

Line: 92 Column: 9

                      self.extensions = self.distribution.ext_modules
        self.libraries = self.distribution.libraries or []
        self.py_modules = self.distribution.py_modules or []
        self.data_files = self.distribution.data_files or []

        if self.build_src is None:
            plat_specifier = ".{}-{}.{}".format(get_platform(), *sys.version_info[:2])
            self.build_src = os.path.join(self.build_base, 'src'+plat_specifier)


            

Reported by Pylint.

Attribute 'build_src' defined outside __init__
Error

Line: 96 Column: 13

              
        if self.build_src is None:
            plat_specifier = ".{}-{}.{}".format(get_platform(), *sys.version_info[:2])
            self.build_src = os.path.join(self.build_base, 'src'+plat_specifier)

        # py_modules_dict is used in build_py.find_package_modules
        self.py_modules_dict = {}

        if self.f2pyflags:

            

Reported by Pylint.

Attribute 'py_modules_dict' defined outside __init__
Error

Line: 99 Column: 9

                          self.build_src = os.path.join(self.build_base, 'src'+plat_specifier)

        # py_modules_dict is used in build_py.find_package_modules
        self.py_modules_dict = {}

        if self.f2pyflags:
            if self.f2py_opts:
                log.warn('ignoring --f2pyflags as --f2py-opts already used')
            else:

            

Reported by Pylint.

Attribute 'f2py_opts' defined outside __init__
Error

Line: 105 Column: 17

                          if self.f2py_opts:
                log.warn('ignoring --f2pyflags as --f2py-opts already used')
            else:
                self.f2py_opts = self.f2pyflags
            self.f2pyflags = None
        if self.f2py_opts is None:
            self.f2py_opts = []
        else:
            self.f2py_opts = shlex.split(self.f2py_opts)

            

Reported by Pylint.

Attribute 'f2pyflags' defined outside __init__
Error

Line: 106 Column: 13

                              log.warn('ignoring --f2pyflags as --f2py-opts already used')
            else:
                self.f2py_opts = self.f2pyflags
            self.f2pyflags = None
        if self.f2py_opts is None:
            self.f2py_opts = []
        else:
            self.f2py_opts = shlex.split(self.f2py_opts)


            

Reported by Pylint.

Attribute 'f2py_opts' defined outside __init__
Error

Line: 108 Column: 13

                              self.f2py_opts = self.f2pyflags
            self.f2pyflags = None
        if self.f2py_opts is None:
            self.f2py_opts = []
        else:
            self.f2py_opts = shlex.split(self.f2py_opts)

        if self.swigflags:
            if self.swig_opts:

            

Reported by Pylint.

numpy/f2py/f2py2e.py
92 issues
Attempted relative import beyond top-level package
Error

Line: 22 Column: 1

              import pprint
import re

from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 23 Column: 1

              import re

from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 24 Column: 1

              
from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 25 Column: 1

              from . import crackfortran
from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 26 Column: 1

              from . import rules
from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps

f2py_version = __version__.version

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 27 Column: 1

              from . import cb_rules
from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps

f2py_version = __version__.version
numpy_version = __version__.version

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 28 Column: 1

              from . import auxfuncs
from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps

f2py_version = __version__.version
numpy_version = __version__.version
errmess = sys.stderr.write

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              from . import cfuncs
from . import f90mod_rules
from . import __version__
from . import capi_maps

f2py_version = __version__.version
numpy_version = __version__.version
errmess = sys.stderr.write
# outmess=sys.stdout.write

            

Reported by Pylint.

Using a conditional statement with a constant value
Error

Line: 547 Column: 5

                  fc_flags = [_m for _m in sys.argv[1:] if _reg4.match(_m)]
    sys.argv = [_m for _m in sys.argv if _m not in fc_flags]

    if 1:
        del_list = []
        for s in flib_flags:
            v = '--fcompiler='
            if s[:len(v)] == v:
                from numpy.distutils import fcompiler

            

Reported by Pylint.

XXX
Error

Line: 557 Column: 3

                              allowed_keys = list(fcompiler.fcompiler_class.keys())
                nv = ov = s[len(v):].lower()
                if ov not in allowed_keys:
                    vmap = {}  # XXX
                    try:
                        nv = vmap[ov]
                    except KeyError:
                        if ov not in vmap.values():
                            print('Unknown vendor: "%s"' % (s[len(v):]))

            

Reported by Pylint.

numpy/lib/histograms.py
91 issues
Redefining built-in 'range'
Error

Line: 32 Column: 23

                  return _unsigned_subtract(x.max(), x.min())


def _hist_bin_sqrt(x, range):
    """
    Square root histogram bin estimator.

    Bin width is inversely proportional to the data size. Used by many
    programs for its simplicity.

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 53 Column: 26

                  return _ptp(x) / np.sqrt(x.size)


def _hist_bin_sturges(x, range):
    """
    Sturges histogram bin estimator.

    A very simplistic estimator based on the assumption of normality of
    the data. This estimator has poor performance for non-normal data,

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 76 Column: 23

                  return _ptp(x) / (np.log2(x.size) + 1.0)


def _hist_bin_rice(x, range):
    """
    Rice histogram bin estimator.

    Another simple estimator with no normality assumption. It has better
    performance for large data than Sturges, but tends to overestimate

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 100 Column: 24

                  return _ptp(x) / (2.0 * x.size ** (1.0 / 3))


def _hist_bin_scott(x, range):
    """
    Scott histogram bin estimator.

    The binwidth is proportional to the standard deviation of the data
    and inversely proportional to the cube root of data size

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 122 Column: 24

                  return (24.0 * np.pi**0.5 / x.size)**(1.0 / 3.0) * np.std(x)


def _hist_bin_stone(x, range):
    """
    Histogram bin estimator based on minimizing the estimated integrated squared error (ISE).

    The number of bins is chosen by minimizing the estimated ISE against the unknown true distribution.
    The ISE is estimated using cross-validation and can be regarded as a generalization of Scott's rule.

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 164 Column: 24

                  return ptp_x / nbins


def _hist_bin_doane(x, range):
    """
    Doane's histogram bin estimator.

    Improved version of Sturges' formula which works better for
    non-normal data. See

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 199 Column: 21

                  return 0.0


def _hist_bin_fd(x, range):
    """
    The Freedman-Diaconis histogram bin estimator.

    The Freedman-Diaconis rule uses interquartile range (IQR) to
    estimate binwidth. It is considered a variation of the Scott rule

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 229 Column: 23

                  return 2.0 * iqr * x.size ** (-1.0 / 3.0)


def _hist_bin_auto(x, range):
    """
    Histogram bin estimator that uses the minimum width of the
    Freedman-Diaconis and Sturges estimators if the FD bin width is non-zero.
    If the bin width from the FD estimator is 0, the Sturges estimator is used.


            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 304 Column: 25

                  return a, weights


def _get_outer_edges(a, range):
    """
    Determine the outer bin edges to use, from either the data or the range
    argument
    """
    if range is not None:

            

Reported by Pylint.

Redefining built-in 'range'
Error

Line: 360 Column: 29

                      return np.subtract(a, b, casting='unsafe', dtype=dt)


def _get_bin_edges(a, bins, range, weights):
    """
    Computes the bins used internally by `histogram`.

    Parameters
    ==========

            

Reported by Pylint.