The following issues were found
numpy/core/__init__.py
81 issues
Line: 70
Column: 1
"numpy until none is found, then reinstall this version.")
raise ImportError(msg.format(path))
from . import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
from . import numeric
from .numeric import *
from . import fromnumeric
from .fromnumeric import *
Reported by Pylint.
Line: 73
Column: 1
from . import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
from . import numeric
from .numeric import *
from . import fromnumeric
from .fromnumeric import *
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
Reported by Pylint.
Line: 75
Column: 1
from . import numeric
from .numeric import *
from . import fromnumeric
from .fromnumeric import *
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
Reported by Pylint.
Line: 76
Column: 1
from .numeric import *
from . import fromnumeric
from .fromnumeric import *
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
from . import function_base
Reported by Pylint.
Line: 77
Column: 1
from . import fromnumeric
from .fromnumeric import *
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
from . import function_base
from .function_base import *
Reported by Pylint.
Line: 78
Column: 1
from .fromnumeric import *
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
from . import function_base
from .function_base import *
from . import machar
Reported by Pylint.
Line: 79
Column: 1
from . import defchararray as char
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
from . import function_base
from .function_base import *
from . import machar
from .machar import *
Reported by Pylint.
Line: 80
Column: 1
from . import records as rec
from .records import record, recarray, format_parser
from .memmap import *
from .defchararray import chararray
from . import function_base
from .function_base import *
from . import machar
from .machar import *
from . import getlimits
Reported by Pylint.
Line: 82
Column: 1
from .memmap import *
from .defchararray import chararray
from . import function_base
from .function_base import *
from . import machar
from .machar import *
from . import getlimits
from .getlimits import *
from . import shape_base
Reported by Pylint.
Line: 84
Column: 1
from . import function_base
from .function_base import *
from . import machar
from .machar import *
from . import getlimits
from .getlimits import *
from . import shape_base
from .shape_base import *
from . import einsumfunc
Reported by Pylint.
numpy/polynomial/polynomial.py
80 issues
Line: 86
Column: 1
import numpy.linalg as la
from numpy.core.multiarray import normalize_axis_index
from . import polyutils as pu
from ._polybase import ABCPolyBase
polytrim = pu.trimcoef
#
Reported by Pylint.
Line: 87
Column: 1
from numpy.core.multiarray import normalize_axis_index
from . import polyutils as pu
from ._polybase import ABCPolyBase
polytrim = pu.trimcoef
#
# These are constant arrays are of integer type so as to be compatible
Reported by Pylint.
Line: 212
Column: 12
array([1.+0.j, 0.+0.j, 1.+0.j])
"""
return pu._fromroots(polyline, polymul, roots)
def polyadd(c1, c2):
"""
Add one polynomial to another.
Reported by Pylint.
Line: 248
Column: 12
28.0
"""
return pu._add(c1, c2)
def polysub(c1, c2):
"""
Subtract one polynomial from another.
Reported by Pylint.
Line: 285
Column: 12
array([ 2., 0., -2.])
"""
return pu._sub(c1, c2)
def polymulx(c):
"""Multiply a polynomial by x.
Reported by Pylint.
Line: 424
Column: 16
return c1[j+1:]/scl, pu.trimseq(c1[:j+1])
def polypow(c, pow, maxpower=None):
"""Raise a polynomial to a power.
Returns the polynomial `c` raised to the power `pow`. The argument
`c` is a sequence of coefficients ordered from low to high. i.e.,
[1,2,3] is the series ``1 + 2*x + 3*x**2.``
Reported by Pylint.
Line: 460
Column: 12
"""
# note: this is more efficient than `pu._pow(polymul, c1, c2)`, as it
# avoids calling `as_series` repeatedly
return pu._pow(np.convolve, c, pow, maxpower)
def polyder(c, m=1, scl=1, axis=0):
"""
Differentiate a polynomial.
Reported by Pylint.
Line: 520
Column: 11
# astype fails with NA
c = c + 0.0
cdt = c.dtype
cnt = pu._deprecate_as_int(m, "the order of derivation")
iaxis = pu._deprecate_as_int(axis, "the axis")
if cnt < 0:
raise ValueError("The order of derivation must be non-negative")
iaxis = normalize_axis_index(iaxis, c.ndim)
Reported by Pylint.
Line: 521
Column: 13
c = c + 0.0
cdt = c.dtype
cnt = pu._deprecate_as_int(m, "the order of derivation")
iaxis = pu._deprecate_as_int(axis, "the axis")
if cnt < 0:
raise ValueError("The order of derivation must be non-negative")
iaxis = normalize_axis_index(iaxis, c.ndim)
if cnt == 0:
Reported by Pylint.
Line: 534
Column: 13
if cnt >= n:
c = c[:1]*0
else:
for i in range(cnt):
n = n - 1
c *= scl
der = np.empty((n,) + c.shape[1:], dtype=cdt)
for j in range(n, 0, -1):
der[j - 1] = j*c[j]
Reported by Pylint.
numpy/lib/utils.py
80 issues
Line: 1056
Column: 5
end with `?`.
- remained features are representing the baseline.
"""
from numpy.core._multiarray_umath import (
__cpu_features__, __cpu_baseline__, __cpu_dispatch__
)
if len(__cpu_baseline__) == 0 and len(__cpu_dispatch__) == 0:
return ''
Reported by Pylint.
Line: 38
Column: 5
...
"""
import numpy
if numpy.show_config is None:
# running from numpy source directory
d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include')
else:
# using installed numpy core headers
Reported by Pylint.
Line: 330
Column: 17
"""
if vardict is None:
frame = sys._getframe().f_back
vardict = frame.f_globals
sta = []
cache = {}
for name in vardict.keys():
if isinstance(vardict[name], ndarray):
Reported by Pylint.
Line: 468
Column: 37
print("contiguous: ", bp(obj.flags.contiguous), file=output)
print("fortran: ", obj.flags.fortran, file=output)
print(
"data pointer: %s%s" % (hex(obj.ctypes._as_parameter_.value), extra),
file=output
)
print("byteorder: ", end=' ', file=output)
if endian in ['|', '=']:
print("%s%s%s" % (tic, sys.byteorder, tic), file=output)
Reported by Pylint.
Line: 486
Column: 10
@set_module('numpy')
def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'):
"""
Get help information for a function, class, or module.
Parameters
----------
Reported by Pylint.
Line: 535
Column: 5
*** Total of 3 references found. ***
"""
global _namedict, _dictlist
# Local import to speed up numpy's import time.
import pydoc
import inspect
if (hasattr(object, '_ppimport_importer') or
Reported by Pylint.
Line: 542
Column: 18
if (hasattr(object, '_ppimport_importer') or
hasattr(object, '_ppimport_module')):
object = object._ppimport_module
elif hasattr(object, '_ppimport_attr'):
object = object._ppimport_attr
if object is None:
info(info)
Reported by Pylint.
Line: 544
Column: 18
hasattr(object, '_ppimport_module')):
object = object._ppimport_module
elif hasattr(object, '_ppimport_attr'):
object = object._ppimport_attr
if object is None:
info(info)
elif isinstance(object, ndarray):
_info(object, output=output)
Reported by Pylint.
Line: 583
Column: 16
name = object.__name__
try:
arguments = str(inspect.signature(object))
except Exception:
arguments = "()"
if len(name+arguments) > maxwidth:
argstr = _split_line(name, arguments, maxwidth)
else:
Reported by Pylint.
Line: 598
Column: 16
name = object.__name__
try:
arguments = str(inspect.signature(object))
except Exception:
arguments = "()"
if len(name+arguments) > maxwidth:
argstr = _split_line(name, arguments, maxwidth)
else:
Reported by Pylint.
benchmarks/benchmarks/bench_random.py
79 issues
Line: 1
Column: 1
from .common import Benchmark
import numpy as np
try:
from numpy.random import Generator
except ImportError:
pass
Reported by Pylint.
Line: 95
Column: 23
def setup(self, bitgen):
if bitgen == 'numpy':
self.rg = np.random.RandomState()
else:
self.rg = Generator(getattr(np.random, bitgen)())
self.rg.random()
self.int32info = np.iinfo(np.int32)
self.uint32info = np.iinfo(np.uint32)
Reported by Pylint.
Line: 151
Column: 23
def setup(self, bitgen, args):
if bitgen == 'numpy':
self.rg = np.random.RandomState()
else:
self.rg = Generator(getattr(np.random, bitgen)())
self.rg.random()
def time_bounded(self, bitgen, args):
Reported by Pylint.
Line: 20
Column: 9
name = items.pop(0)
params = [float(x) for x in items]
self.func = getattr(np.random, name)
self.params = tuple(params) + ((100, 100),)
def time_rng(self, name):
self.func(*self.params)
Reported by Pylint.
Line: 23
Column: 24
self.func = getattr(np.random, name)
self.params = tuple(params) + ((100, 100),)
def time_rng(self, name):
self.func(*self.params)
class Shuffle(Benchmark):
def setup(self):
Reported by Pylint.
Line: 29
Column: 9
class Shuffle(Benchmark):
def setup(self):
self.a = np.arange(100000)
def time_100000(self):
np.random.shuffle(self.a)
Reported by Pylint.
Line: 58
Column: 21
param_names = ['dtype']
params = ['bool', 'uint8', 'uint16', 'uint32', 'uint64']
def setup(self, name):
from numpy.lib import NumpyVersion
if NumpyVersion(np.__version__) < '1.11.0.dev0':
raise NotImplementedError
def time_randint_fast(self, name):
Reported by Pylint.
Line: 74
Column: 9
class Permutation(Benchmark):
def setup(self):
self.n = 10000
self.a_1d = np.random.random(self.n)
self.a_2d = np.random.random((self.n, 2))
def time_permutation_1d(self):
np.random.permutation(self.a_1d)
Reported by Pylint.
Line: 75
Column: 9
class Permutation(Benchmark):
def setup(self):
self.n = 10000
self.a_1d = np.random.random(self.n)
self.a_2d = np.random.random((self.n, 2))
def time_permutation_1d(self):
np.random.permutation(self.a_1d)
Reported by Pylint.
Line: 76
Column: 9
def setup(self):
self.n = 10000
self.a_1d = np.random.random(self.n)
self.a_2d = np.random.random((self.n, 2))
def time_permutation_1d(self):
np.random.permutation(self.a_1d)
def time_permutation_2d(self):
Reported by Pylint.
numpy/typing/tests/data/pass/scalars.py
79 issues
Line: 4
Column: 1
import sys
import datetime as dt
import pytest
import numpy as np
b = np.bool_()
u8 = np.uint64()
i8 = np.int64()
Reported by Pylint.
Line: 7
Column: 6
import pytest
import numpy as np
b = np.bool_()
u8 = np.uint64()
i8 = np.int64()
f8 = np.float64()
c16 = np.complex128()
U = np.str_()
Reported by Pylint.
Line: 8
Column: 6
import numpy as np
b = np.bool_()
u8 = np.uint64()
i8 = np.int64()
f8 = np.float64()
c16 = np.complex128()
U = np.str_()
S = np.bytes_()
Reported by Pylint.
Line: 10
Column: 6
b = np.bool_()
u8 = np.uint64()
i8 = np.int64()
f8 = np.float64()
c16 = np.complex128()
U = np.str_()
S = np.bytes_()
Reported by Pylint.
Line: 11
Column: 7
u8 = np.uint64()
i8 = np.int64()
f8 = np.float64()
c16 = np.complex128()
U = np.str_()
S = np.bytes_()
# Construction
Reported by Pylint.
Line: 51
Column: 1
np.int32(4)
np.int64(-1)
np.uint8(B())
np.uint32()
np.int32("1")
np.int64(b"2")
np.float16(A())
np.float32(16)
Reported by Pylint.
Line: 81
Column: 1
np.int64().flags
np.uint8().itemsize * 2
np.uint16().ndim + 1
np.uint32().strides
np.uint64().shape
# Time structures
np.datetime64()
Reported by Pylint.
Line: 82
Column: 1
np.uint8().itemsize * 2
np.uint16().ndim + 1
np.uint32().strides
np.uint64().shape
# Time structures
np.datetime64()
np.datetime64(0, "D")
Reported by Pylint.
Line: 83
Column: 1
np.uint8().itemsize * 2
np.uint16().ndim + 1
np.uint32().strides
np.uint64().shape
# Time structures
np.datetime64()
np.datetime64(0, "D")
np.datetime64(0, b"D")
Reported by Pylint.
Line: 86
Column: 1
np.uint64().shape
# Time structures
np.datetime64()
np.datetime64(0, "D")
np.datetime64(0, b"D")
np.datetime64(0, ('ms', 3))
np.datetime64("2019")
np.datetime64(b"2019")
Reported by Pylint.
numpy/matrixlib/defmatrix.py
79 issues
Line: 319
Column: 16
[7.]])
"""
return N.ndarray.sum(self, axis, dtype, out, keepdims=True)._collapse(axis)
# To update docstring from array to matrix...
def squeeze(self, axis=None):
"""
Reported by Pylint.
Line: 445
Column: 16
[ 9.5]])
"""
return N.ndarray.mean(self, axis, dtype, out, keepdims=True)._collapse(axis)
def std(self, axis=None, dtype=None, out=None, ddof=0):
"""
Return the standard deviation of the array elements along the given axis.
Reported by Pylint.
Line: 479
Column: 16
[ 1.11803399]])
"""
return N.ndarray.std(self, axis, dtype, out, ddof, keepdims=True)._collapse(axis)
def var(self, axis=None, dtype=None, out=None, ddof=0):
"""
Returns the variance of the matrix elements, along the given axis.
Reported by Pylint.
Line: 513
Column: 16
[1.25]])
"""
return N.ndarray.var(self, axis, dtype, out, ddof, keepdims=True)._collapse(axis)
def prod(self, axis=None, dtype=None, out=None):
"""
Return the product of the array elements over the given axis.
Reported by Pylint.
Line: 546
Column: 16
[7920]])
"""
return N.ndarray.prod(self, axis, dtype, out, keepdims=True)._collapse(axis)
def any(self, axis=None, out=None):
"""
Test whether any array element along a given axis evaluates to True.
Reported by Pylint.
Line: 569
Column: 16
returns `ndarray`
"""
return N.ndarray.any(self, axis, out, keepdims=True)._collapse(axis)
def all(self, axis=None, out=None):
"""
Test whether all matrix elements along a given axis evaluate to True.
Reported by Pylint.
Line: 609
Column: 16
[False]])
"""
return N.ndarray.all(self, axis, out, keepdims=True)._collapse(axis)
def max(self, axis=None, out=None):
"""
Return the maximum value along an axis.
Reported by Pylint.
Line: 644
Column: 16
[11]])
"""
return N.ndarray.max(self, axis, out, keepdims=True)._collapse(axis)
def argmax(self, axis=None, out=None):
"""
Indexes of the maximum values along an axis.
Reported by Pylint.
Line: 644
Column: 16
[11]])
"""
return N.ndarray.max(self, axis, out, keepdims=True)._collapse(axis)
def argmax(self, axis=None, out=None):
"""
Indexes of the maximum values along an axis.
Reported by Pylint.
Line: 683
Column: 16
[3]])
"""
return N.ndarray.argmax(self, axis, out)._align(axis)
def min(self, axis=None, out=None):
"""
Return the minimum value along an axis.
Reported by Pylint.
numpy/distutils/tests/test_system_info.py
77 issues
Line: 3
Column: 1
import os
import shutil
import pytest
from tempfile import mkstemp, mkdtemp
from subprocess import Popen, PIPE
from distutils.errors import DistutilsError
from numpy.testing import assert_, assert_equal, assert_raises
from numpy.distutils import ccompiler, customized_ccompiler
Reported by Pylint.
Line: 16
Column: 21
from numpy.distutils import _shell_utils
def get_class(name, notfound_action=1):
"""
notfound_action:
0 - do nothing
1 - display warning message
2 - raise error
Reported by Pylint.
Line: 92
Column: 5
class _system_info(system_info):
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
Reported by Pylint.
Line: 92
Column: 5
class _system_info(system_info):
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
Reported by Pylint.
Line: 92
Column: 5
class _system_info(system_info):
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
Reported by Pylint.
Line: 93
Column: 18
class _system_info(system_info):
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
self.local_prefixes = []
Reported by Pylint.
Line: 94
Column: 18
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
self.local_prefixes = []
defaults = {'library_dirs': '',
Reported by Pylint.
Line: 95
Column: 18
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
):
self.__class__.info = {}
self.local_prefixes = []
defaults = {'library_dirs': '',
'include_dirs': '',
Reported by Pylint.
Line: 136
Column: 9
def setup(self):
""" Create the libraries """
# Create 2 sources and 2 libraries
self._dir1 = mkdtemp()
self._src1 = os.path.join(self._dir1, 'foo.c')
self._lib1 = os.path.join(self._dir1, 'libfoo.so')
self._dir2 = mkdtemp()
self._src2 = os.path.join(self._dir2, 'bar.c')
self._lib2 = os.path.join(self._dir2, 'libbar.so')
Reported by Pylint.
Line: 137
Column: 9
""" Create the libraries """
# Create 2 sources and 2 libraries
self._dir1 = mkdtemp()
self._src1 = os.path.join(self._dir1, 'foo.c')
self._lib1 = os.path.join(self._dir1, 'libfoo.so')
self._dir2 = mkdtemp()
self._src2 = os.path.join(self._dir2, 'bar.c')
self._lib2 = os.path.join(self._dir2, 'libbar.so')
# Update local site.cfg
Reported by Pylint.
numpy/random/tests/test_regression.py
76 issues
Line: 15
Column: 17
# Make sure generated random variables are in [-pi, pi].
# Regression test for ticket #986.
for mu in np.linspace(-7., 7., 5):
r = random.mtrand.vonmises(mu, 1, 50)
assert_(np.all(r > -np.pi) and np.all(r <= np.pi))
def test_hypergeometric_range(self):
# Test for ticket #921
assert_(np.all(np.random.hypergeometric(3, 18, 11, size=10) < 4))
Reported by Pylint.
Line: 20
Column: 24
def test_hypergeometric_range(self):
# Test for ticket #921
assert_(np.all(np.random.hypergeometric(3, 18, 11, size=10) < 4))
assert_(np.all(np.random.hypergeometric(18, 3, 11, size=10) > 0))
# Test for ticket #5623
args = [
(2**20 - 2, 2**20 - 2, 2**20 - 2), # Check for 32-bit systems
Reported by Pylint.
Line: 21
Column: 24
def test_hypergeometric_range(self):
# Test for ticket #921
assert_(np.all(np.random.hypergeometric(3, 18, 11, size=10) < 4))
assert_(np.all(np.random.hypergeometric(18, 3, 11, size=10) > 0))
# Test for ticket #5623
args = [
(2**20 - 2, 2**20 - 2, 2**20 - 2), # Check for 32-bit systems
]
Reported by Pylint.
Line: 32
Column: 21
# Check for 64-bit systems
args.append((2**40 - 2, 2**40 - 2, 2**40 - 2))
for arg in args:
assert_(np.random.hypergeometric(*arg) > 0)
def test_logseries_convergence(self):
# Test for ticket #923
N = 1000
np.random.seed(0)
Reported by Pylint.
Line: 37
Column: 9
def test_logseries_convergence(self):
# Test for ticket #923
N = 1000
np.random.seed(0)
rvsn = np.random.logseries(0.8, size=N)
# these two frequency counts should be close to theoretical
# numbers with this large sample
# theoretical large N result is 0.49706795
freq = np.sum(rvsn == 1) / N
Reported by Pylint.
Line: 38
Column: 16
# Test for ticket #923
N = 1000
np.random.seed(0)
rvsn = np.random.logseries(0.8, size=N)
# these two frequency counts should be close to theoretical
# numbers with this large sample
# theoretical large N result is 0.49706795
freq = np.sum(rvsn == 1) / N
msg = f'Frequency was {freq:f}, should be > 0.45'
Reported by Pylint.
Line: 56
Column: 13
[(1, 1), (2, 2), (3, 3), None],
[1, (2, 2), (3, 3), None],
[(1, 1), 2, 3, None]]:
np.random.seed(12345)
shuffled = list(t)
random.shuffle(shuffled)
expected = np.array([t[0], t[3], t[1], t[2]], dtype=object)
assert_array_equal(np.array(shuffled, dtype=object), expected)
Reported by Pylint.
Line: 58
Column: 13
[(1, 1), 2, 3, None]]:
np.random.seed(12345)
shuffled = list(t)
random.shuffle(shuffled)
expected = np.array([t[0], t[3], t[1], t[2]], dtype=object)
assert_array_equal(np.array(shuffled, dtype=object), expected)
def test_call_within_randomstate(self):
# Check that custom RandomState does not call into global state
Reported by Pylint.
Line: 64
Column: 13
def test_call_within_randomstate(self):
# Check that custom RandomState does not call into global state
m = np.random.RandomState()
res = np.array([0, 8, 7, 2, 1, 9, 4, 7, 0, 3])
for i in range(3):
np.random.seed(i)
m.seed(4321)
# If m.state is not honored, the result will change
Reported by Pylint.
Line: 67
Column: 13
m = np.random.RandomState()
res = np.array([0, 8, 7, 2, 1, 9, 4, 7, 0, 3])
for i in range(3):
np.random.seed(i)
m.seed(4321)
# If m.state is not honored, the result will change
assert_array_equal(m.choice(10, size=10, p=np.ones(10)/10.), res)
def test_multivariate_normal_size_types(self):
Reported by Pylint.
doc/source/conf.py
74 issues
Line: 467
Column: 1
return "https://github.com/numpy/numpy/blob/v%s/numpy/%s%s" % (
numpy.__version__, fn, linespec)
from pygments.lexers import CLexer
from pygments.lexer import inherit, bygroups
from pygments.token import Comment
class NumPyLexer(CLexer):
name = 'NUMPYLEXER'
Reported by Pylint.
Line: 28
Column: 5
class PyTypeObject(ctypes.Structure):
pass
PyObject._fields_ = [
('ob_refcnt', Py_ssize_t),
('ob_type', ctypes.POINTER(PyTypeObject)),
]
Reported by Pylint.
Line: 34
Column: 5
]
PyTypeObject._fields_ = [
# varhead
('ob_base', PyObject),
('ob_size', Py_ssize_t),
# declaration
('tp_name', ctypes.c_char_p),
Reported by Pylint.
Line: 46
Column: 5
assert 'numpy.core._add_newdocs_scalars' not in sys.modules
sys.modules['numpy.core._add_newdocs_scalars'] = object()
import numpy
# change the __name__ of the scalar types
for name in [
'byte', 'short', 'intc', 'int_', 'longlong',
'ubyte', 'ushort', 'uintc', 'uint', 'ulonglong',
Reported by Pylint.
Line: 46
Column: 5
assert 'numpy.core._add_newdocs_scalars' not in sys.modules
sys.modules['numpy.core._add_newdocs_scalars'] = object()
import numpy
# change the __name__ of the scalar types
for name in [
'byte', 'short', 'intc', 'int_', 'longlong',
'ubyte', 'ushort', 'uintc', 'uint', 'ulonglong',
Reported by Pylint.
Line: 49
Column: 9
import numpy
# change the __name__ of the scalar types
for name in [
'byte', 'short', 'intc', 'int_', 'longlong',
'ubyte', 'ushort', 'uintc', 'uint', 'ulonglong',
'half', 'single', 'double', 'longdouble',
'half', 'csingle', 'cdouble', 'clongdouble',
]:
Reported by Pylint.
Line: 100
Column: 1
# General substitutions.
project = 'NumPy'
copyright = '2008-2021, The NumPy community'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
import numpy
Reported by Pylint.
Line: 394
Column: 3
elif obj is numpy.ndarray:
return r"core/src/multiarray/arrayobject.c"
else:
# todo: come up with a better way to generate these
return None
def linkcode_resolve(domain, info):
"""
Reported by Pylint.
Line: 416
Column: 16
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except Exception:
return None
# strip decorators, which would resolve to the source of the decorator
# possibly an upstream bug in getsourcefile, bpo-1764286
try:
Reported by Pylint.
Line: 438
Column: 16
if fn is None:
try:
fn = inspect.getsourcefile(obj)
except Exception:
fn = None
if not fn:
return None
# Ignore re-exports as their source files are not within the numpy repo
Reported by Pylint.
numpy/linalg/lapack_lite/clapack_scrub.py
74 issues
Line: 7
Column: 1
import sys
from io import StringIO
from plex import Scanner, Str, Lexicon, Opt, Bol, State, AnyChar, TEXT, IGNORE
from plex.traditional import re as Re
class MyScanner(Scanner):
def __init__(self, info, name='<default>'):
Reported by Pylint.
Line: 8
Column: 1
from io import StringIO
from plex import Scanner, Str, Lexicon, Opt, Bol, State, AnyChar, TEXT, IGNORE
from plex.traditional import re as Re
class MyScanner(Scanner):
def __init__(self, info, name='<default>'):
Scanner.__init__(self, self.lexicon, info, name)
Reported by Pylint.
Line: 300
Column: 14
else:
nsteps = None
source = scrub_source(source, nsteps, verbose=True)
writefo = open(outfilename, 'w')
writefo.write(source)
writefo.close()
Reported by Pylint.
Line: 32
Column: 16
else:
scanner = scanner_class(info)
while True:
value, text = scanner.read()
if value is None:
break
elif value is IGNORE:
pass
else:
Reported by Pylint.
Line: 92
Column: 17
(AnyChar, TEXT),
])
def scrubFtnlen(source):
return runScanner(source, LenSubsScanner)[0]
def cleanSource(source):
# remove whitespace at end of lines
source = re.sub(r'[\t ]+\n', '\n', source)
Reported by Pylint.
Line: 95
Column: 17
def scrubFtnlen(source):
return runScanner(source, LenSubsScanner)[0]
def cleanSource(source):
# remove whitespace at end of lines
source = re.sub(r'[\t ]+\n', '\n', source)
# remove comments like .. Scalar Arguments ..
source = re.sub(r'(?m)^[\t ]*/\* *\.\. .*?\n', '', source)
# collapse blanks of more than two in-a-row to two
Reported by Pylint.
Line: 123
Column: 21
def getValue(self):
q = LineQueue()
self.flushTo(q)
s = ''.join(q._queue)
self.clear()
return s
class CommentQueue(LineQueue):
def __init__(self):
Reported by Pylint.
Line: 150
Column: 19
self.clear()
# This really seems to be about 4x longer than it needs to be
def cleanComments(source):
lines = LineQueue()
comments = CommentQueue()
def isCommentLine(line):
return line.startswith('/*') and line.endswith('*/\n')
Reported by Pylint.
Line: 198
Column: 18
comments.flushTo(lines)
return lines.getValue()
def removeHeader(source):
lines = LineQueue()
def LookingForHeader(line):
m = re.match(r'/\*[^\n]*-- translated', line)
if m:
Reported by Pylint.
Line: 225
Column: 32
state = state(line)
return lines.getValue()
def removeSubroutinePrototypes(source):
expression = re.compile(
r'/\* Subroutine \*/^\s*(?:(?:inline|static)\s+){0,2}(?!else|typedef|return)\w+\s+\*?\s*(\w+)\s*\([^0]+\)\s*;?'
)
lines = LineQueue()
for line in StringIO(source):
Reported by Pylint.