The following issues were found
numpy/core/tests/test_scalarinherit.py
74 issues
Line: 5
Column: 1
""" Test printing of scalar types.
"""
import pytest
import numpy as np
from numpy.testing import assert_, assert_raises
Reported by Pylint.
Line: 56
Column: 13
# previously caused RecursionError!?
with pytest.raises(TypeError):
B1(1.0, 2.0)
class TestCharacter:
def test_char_radd(self):
# GH issue 9620, reached gentype_add and raise TypeError
Reported by Pylint.
Line: 66
Column: 17
np_u = np.unicode_('abc')
s = b'def'
u = u'def'
assert_(np_s.__radd__(np_s) is NotImplemented)
assert_(np_s.__radd__(np_u) is NotImplemented)
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
Reported by Pylint.
Line: 67
Column: 17
s = b'def'
u = u'def'
assert_(np_s.__radd__(np_s) is NotImplemented)
assert_(np_s.__radd__(np_u) is NotImplemented)
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
Reported by Pylint.
Line: 68
Column: 17
u = u'def'
assert_(np_s.__radd__(np_s) is NotImplemented)
assert_(np_s.__radd__(np_u) is NotImplemented)
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
Reported by Pylint.
Line: 69
Column: 17
assert_(np_s.__radd__(np_s) is NotImplemented)
assert_(np_s.__radd__(np_u) is NotImplemented)
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
assert_(s + np_s == b'defabc')
Reported by Pylint.
Line: 70
Column: 17
assert_(np_s.__radd__(np_u) is NotImplemented)
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
assert_(s + np_s == b'defabc')
assert_(u + np_u == u'defabc')
Reported by Pylint.
Line: 71
Column: 17
assert_(np_s.__radd__(s) is NotImplemented)
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
assert_(s + np_s == b'defabc')
assert_(u + np_u == u'defabc')
Reported by Pylint.
Line: 72
Column: 17
assert_(np_s.__radd__(u) is NotImplemented)
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
assert_(s + np_s == b'defabc')
assert_(u + np_u == u'defabc')
class MyStr(str, np.generic):
Reported by Pylint.
Line: 73
Column: 17
assert_(np_u.__radd__(np_s) is NotImplemented)
assert_(np_u.__radd__(np_u) is NotImplemented)
assert_(np_u.__radd__(s) is NotImplemented)
assert_(np_u.__radd__(u) is NotImplemented)
assert_(s + np_s == b'defabc')
assert_(u + np_u == u'defabc')
class MyStr(str, np.generic):
# would segfault
Reported by Pylint.
tools/swig/test/testSuperTensor.py
73 issues
Line: 12
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import SuperTensor
######################################################################
class SuperTensorTestCase(unittest.TestCase):
Reported by Pylint.
Line: 69
Column: 9
def testMax(self):
"Test max function"
print(self.typeStr, "... ", file=sys.stderr)
max = SuperTensor.__dict__[self.typeStr + "Max"]
supertensor = [[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]]
self.assertEqual(max(supertensor), 8)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxBadList(self):
Reported by Pylint.
Line: 77
Column: 9
def testMaxBadList(self):
"Test max function with bad list"
print(self.typeStr, "... ", file=sys.stderr)
max = SuperTensor.__dict__[self.typeStr + "Max"]
supertensor = [[[[1, "two"], [3, 4]], [[5, "six"], [7, 8]]], [[[1, "two"], [3, 4]], [[5, "six"], [7, 8]]]]
self.assertRaises(BadListError, max, supertensor)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxNonContainer(self):
Reported by Pylint.
Line: 85
Column: 9
def testMaxNonContainer(self):
"Test max function with non-container"
print(self.typeStr, "... ", file=sys.stderr)
max = SuperTensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
Reported by Pylint.
Line: 92
Column: 9
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
print(self.typeStr, "... ", file=sys.stderr)
max = SuperTensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, -1, 2, -3])
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMin(self):
"Test min function"
Reported by Pylint.
Line: 99
Column: 9
def testMin(self):
"Test min function"
print(self.typeStr, "... ", file=sys.stderr)
min = SuperTensor.__dict__[self.typeStr + "Min"]
supertensor = [[[[9, 8], [7, 6]], [[5, 4], [3, 2]]], [[[9, 8], [7, 6]], [[5, 4], [3, 2]]]]
self.assertEqual(min(supertensor), 2)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinBadList(self):
Reported by Pylint.
Line: 107
Column: 9
def testMinBadList(self):
"Test min function with bad list"
print(self.typeStr, "... ", file=sys.stderr)
min = SuperTensor.__dict__[self.typeStr + "Min"]
supertensor = [[[["nine", 8], [7, 6]], [["five", 4], [3, 2]]], [[["nine", 8], [7, 6]], [["five", 4], [3, 2]]]]
self.assertRaises(BadListError, min, supertensor)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinNonContainer(self):
Reported by Pylint.
Line: 115
Column: 9
def testMinNonContainer(self):
"Test min function with non-container"
print(self.typeStr, "... ", file=sys.stderr)
min = SuperTensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, True)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
Reported by Pylint.
Line: 122
Column: 9
def testMinWrongDim(self):
"Test min function with wrong dimensions"
print(self.typeStr, "... ", file=sys.stderr)
min = SuperTensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [[1, 3], [5, 7]])
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScale(self):
"Test scale function"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
Reported by Pylint.
numpy/lib/twodim_base.py
72 issues
Line: 157
Column: 40
return m[::-1, ...]
def _eye_dispatcher(N, M=None, k=None, dtype=None, order=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 157
Column: 52
return m[::-1, ...]
def _eye_dispatcher(N, M=None, k=None, dtype=None, order=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 157
Column: 21
return m[::-1, ...]
def _eye_dispatcher(N, M=None, k=None, dtype=None, order=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 157
Column: 24
return m[::-1, ...]
def _eye_dispatcher(N, M=None, k=None, dtype=None, order=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 157
Column: 32
return m[::-1, ...]
def _eye_dispatcher(N, M=None, k=None, dtype=None, order=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 230
Column: 25
)(eye)
def _diag_dispatcher(v, k=None):
return (v,)
@array_function_dispatch(_diag_dispatcher)
def diag(v, k=0):
Reported by Pylint.
Line: 366
Column: 40
return wrap(res)
def _tri_dispatcher(N, M=None, k=None, dtype=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 366
Column: 32
return wrap(res)
def _tri_dispatcher(N, M=None, k=None, dtype=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 366
Column: 21
return wrap(res)
def _tri_dispatcher(N, M=None, k=None, dtype=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 366
Column: 24
return wrap(res)
def _tri_dispatcher(N, M=None, k=None, dtype=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
numpy/lib/tests/test_utils.py
70 issues
Line: 3
Column: 1
import inspect
import sys
import pytest
from numpy.core import arange
from numpy.testing import assert_, assert_equal, assert_raises_regex
from numpy.lib import deprecate, deprecate_with_doc
import numpy.lib.utils as utils
Reported by Pylint.
Line: 73
Column: 29
def test_deprecate_decorator():
assert_('deprecated' in old_func.__doc__)
def test_deprecate_decorator_message():
assert_('Rather use new_func2' in old_func2.__doc__)
Reported by Pylint.
Line: 77
Column: 39
def test_deprecate_decorator_message():
assert_('Rather use new_func2' in old_func2.__doc__)
def test_deprecate_fn():
assert_('old_func3' in new_func3.__doc__)
assert_('new_func3' in new_func3.__doc__)
Reported by Pylint.
Line: 86
Column: 39
def test_deprecate_with_doc_decorator_message():
assert_('Rather use new_func7' in old_func7.__doc__)
@pytest.mark.skipif(sys.flags.optimize == 2, reason="-OO discards docstrings")
@pytest.mark.parametrize('old_func, new_func', [
(old_func4, new_func4),
Reported by Pylint.
Line: 165
Column: 9
pass
class WithPublicMethods:
def first_method():
pass
def _has_method_heading(cls):
out = StringIO()
utils.info(cls, output=out)
Reported by Pylint.
Line: 23
Column: 5
utils.lookfor('eigenvalue', module='numpy', output=out,
import_modules=False)
out = out.getvalue()
assert_('numpy.linalg.eig' in out)
@deprecate
def old_func(self, x):
return x
Reported by Pylint.
Line: 27
Column: 14
@deprecate
def old_func(self, x):
return x
@deprecate(message="Rather use new_func2")
def old_func2(self, x):
Reported by Pylint.
Line: 32
Column: 15
@deprecate(message="Rather use new_func2")
def old_func2(self, x):
return x
def old_func3(self, x):
return x
Reported by Pylint.
Line: 36
Column: 15
return x
def old_func3(self, x):
return x
new_func3 = deprecate(old_func3, old_name="old_func3", new_name="new_func3")
def old_func4(self, x):
Reported by Pylint.
Line: 41
Column: 15
new_func3 = deprecate(old_func3, old_name="old_func3", new_name="new_func3")
def old_func4(self, x):
"""Summary.
Further info.
"""
return x
Reported by Pylint.
tools/swig/test/testMatrix.py
69 issues
Line: 12
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Matrix
######################################################################
class MatrixTestCase(unittest.TestCase):
Reported by Pylint.
Line: 66
Column: 9
def testMax(self):
"Test max function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6, 5, 4], [3, 2, 1]]
self.assertEqual(max(matrix), 6)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxBadList(self):
Reported by Pylint.
Line: 74
Column: 9
def testMaxBadList(self):
"Test max function with bad list"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6, "five", 4], ["three", 2, "one"]]
self.assertRaises(BadListError, max, matrix)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxNonContainer(self):
Reported by Pylint.
Line: 82
Column: 9
def testMaxNonContainer(self):
"Test max function with non-container"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
Reported by Pylint.
Line: 89
Column: 9
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, 1, 2, 3])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMin(self):
"Test min function"
Reported by Pylint.
Line: 96
Column: 9
def testMin(self):
"Test min function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [[9, 8], [7, 6], [5, 4]]
self.assertEqual(min(matrix), 4)
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinBadList(self):
Reported by Pylint.
Line: 104
Column: 9
def testMinBadList(self):
"Test min function with bad list"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [["nine", "eight"], ["seven", "six"]]
self.assertRaises(BadListError, min, matrix)
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinWrongDim(self):
Reported by Pylint.
Line: 112
Column: 9
def testMinWrongDim(self):
"Test min function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [1, 3, 5, 7, 9])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinNonContainer(self):
"Test min function with non-container"
Reported by Pylint.
Line: 119
Column: 9
def testMinNonContainer(self):
"Test min function with non-container"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, False)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScale(self):
"Test scale function"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
Reported by Pylint.
tools/swig/test/testVector.py
69 issues
Line: 12
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Vector
######################################################################
class VectorTestCase(unittest.TestCase):
Reported by Pylint.
Line: 90
Column: 9
def testSum(self):
"Test sum function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertEqual(sum([5, 6, 7, 8]), 26)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumBadList(self):
"Test sum function with bad list"
Reported by Pylint.
Line: 97
Column: 9
def testSumBadList(self):
"Test sum function with bad list"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(BadListError, sum, [3, 4, 5, "pi"])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumWrongDim(self):
"Test sum function with wrong dimensions"
Reported by Pylint.
Line: 104
Column: 9
def testSumWrongDim(self):
"Test sum function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, [[3, 4], [5, 6]])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumNonContainer(self):
"Test sum function with non-container"
Reported by Pylint.
Line: 111
Column: 9
def testSumNonContainer(self):
"Test sum function with non-container"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, True)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverse(self):
"Test reverse function"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
if major == 0: BadListError = TypeError
Reported by Pylint.
Line: 9
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 Vector
######################################################################
Reported by Pylint.
Line: 12
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Vector
######################################################################
class VectorTestCase(unittest.TestCase):
Reported by Pylint.
Line: 16
Column: 1
######################################################################
class VectorTestCase(unittest.TestCase):
def __init__(self, methodName="runTest"):
unittest.TestCase.__init__(self, methodName)
self.typeStr = "double"
self.typeCode = "d"
Reported by Pylint.
tools/swig/test/testTensor.py
69 issues
Line: 13
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Tensor
######################################################################
class TensorTestCase(unittest.TestCase):
Reported by Pylint.
Line: 75
Column: 9
def testMax(self):
"Test max function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1, 2], [3, 4]],
[[5, 6], [7, 8]]]
self.assertEqual(max(tensor), 8)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
Reported by Pylint.
Line: 84
Column: 9
def testMaxBadList(self):
"Test max function with bad list"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1, "two"], [3, 4]],
[[5, "six"], [7, 8]]]
self.assertRaises(BadListError, max, tensor)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
Reported by Pylint.
Line: 93
Column: 9
def testMaxNonContainer(self):
"Test max function with non-container"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
Reported by Pylint.
Line: 100
Column: 9
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, -1, 2, -3])
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMin(self):
"Test min function"
Reported by Pylint.
Line: 107
Column: 9
def testMin(self):
"Test min function"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[[9, 8], [7, 6]],
[[5, 4], [3, 2]]]
self.assertEqual(min(tensor), 2)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
Reported by Pylint.
Line: 116
Column: 9
def testMinBadList(self):
"Test min function with bad list"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[["nine", 8], [7, 6]],
[["five", 4], [3, 2]]]
self.assertRaises(BadListError, min, tensor)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
Reported by Pylint.
Line: 125
Column: 9
def testMinNonContainer(self):
"Test min function with non-container"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, True)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
Reported by Pylint.
Line: 132
Column: 9
def testMinWrongDim(self):
"Test min function with wrong dimensions"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [[1, 3], [5, 7]])
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScale(self):
"Test scale function"
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
from math import sqrt
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
Reported by Pylint.
benchmarks/benchmarks/bench_ma.py
68 issues
Line: 1
Column: 1
from .common import Benchmark
import numpy as np
class MA(Benchmark):
def setup(self):
self.l100 = range(100)
self.t100 = ([True] * 100)
Reported by Pylint.
Line: 8
Column: 9
class MA(Benchmark):
def setup(self):
self.l100 = range(100)
self.t100 = ([True] * 100)
def time_masked_array(self):
np.ma.masked_array()
Reported by Pylint.
Line: 9
Column: 9
class MA(Benchmark):
def setup(self):
self.l100 = range(100)
self.t100 = ([True] * 100)
def time_masked_array(self):
np.ma.masked_array()
def time_masked_array_l100(self):
Reported by Pylint.
Line: 30
Column: 13
x = np.arange(size**ndim).reshape(ndim * (size,))
if masked:
self.m = np.ma.array(x, mask=x%2 == 0)
else:
self.m = np.ma.array(x)
self.idx_scalar = (size//2,) * ndim
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
Reported by Pylint.
Line: 32
Column: 13
if masked:
self.m = np.ma.array(x, mask=x%2 == 0)
else:
self.m = np.ma.array(x)
self.idx_scalar = (size//2,) * ndim
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
Reported by Pylint.
Line: 34
Column: 9
else:
self.m = np.ma.array(x)
self.idx_scalar = (size//2,) * ndim
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
def time_scalar(self, masked, ndim, size):
self.m[self.idx_scalar]
Reported by Pylint.
Line: 35
Column: 9
self.m = np.ma.array(x)
self.idx_scalar = (size//2,) * ndim
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
def time_scalar(self, masked, ndim, size):
self.m[self.idx_scalar]
Reported by Pylint.
Line: 36
Column: 9
self.idx_scalar = (size//2,) * ndim
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
def time_scalar(self, masked, ndim, size):
self.m[self.idx_scalar]
def time_0d(self, masked, ndim, size):
Reported by Pylint.
Line: 38
Column: 35
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
def time_scalar(self, masked, ndim, size):
self.m[self.idx_scalar]
def time_0d(self, masked, ndim, size):
self.m[self.idx_0d]
Reported by Pylint.
Line: 38
Column: 27
self.idx_0d = (size//2,) * ndim + (Ellipsis,)
self.idx_1d = (size//2,) * (ndim - 1)
def time_scalar(self, masked, ndim, size):
self.m[self.idx_scalar]
def time_0d(self, masked, ndim, size):
self.m[self.idx_0d]
Reported by Pylint.
benchmarks/benchmarks/bench_shape_base.py
68 issues
Line: 1
Column: 1
from .common import Benchmark
import numpy as np
class Block(Benchmark):
params = [1, 10, 100]
param_names = ['size']
Reported by Pylint.
Line: 11
Column: 9
param_names = ['size']
def setup(self, n):
self.a_2d = np.ones((2 * n, 2 * n))
self.b_1d = np.ones(2 * n)
self.b_2d = 2 * self.a_2d
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
Reported by Pylint.
Line: 12
Column: 9
def setup(self, n):
self.a_2d = np.ones((2 * n, 2 * n))
self.b_1d = np.ones(2 * n)
self.b_2d = 2 * self.a_2d
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
Reported by Pylint.
Line: 13
Column: 9
def setup(self, n):
self.a_2d = np.ones((2 * n, 2 * n))
self.b_1d = np.ones(2 * n)
self.b_2d = 2 * self.a_2d
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
self.one_2d = np.ones((1 * n, 3 * n))
Reported by Pylint.
Line: 15
Column: 9
self.b_1d = np.ones(2 * n)
self.b_2d = 2 * self.a_2d
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
Reported by Pylint.
Line: 16
Column: 9
self.b_2d = 2 * self.a_2d
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
self.four_1d = np.ones(6 * n)
Reported by Pylint.
Line: 18
Column: 9
self.a = np.ones(3 * n)
self.b = np.ones(3 * n)
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
self.four_1d = np.ones(6 * n)
self.five_0d = np.ones(1 * n)
self.six_1d = np.ones(5 * n)
Reported by Pylint.
Line: 19
Column: 9
self.b = np.ones(3 * n)
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
self.four_1d = np.ones(6 * n)
self.five_0d = np.ones(1 * n)
self.six_1d = np.ones(5 * n)
# avoid np.zeros's lazy allocation that might cause
Reported by Pylint.
Line: 20
Column: 9
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
self.four_1d = np.ones(6 * n)
self.five_0d = np.ones(1 * n)
self.six_1d = np.ones(5 * n)
# avoid np.zeros's lazy allocation that might cause
# page faults during benchmark
Reported by Pylint.
Line: 21
Column: 9
self.one_2d = np.ones((1 * n, 3 * n))
self.two_2d = np.ones((1 * n, 3 * n))
self.three_2d = np.ones((1 * n, 6 * n))
self.four_1d = np.ones(6 * n)
self.five_0d = np.ones(1 * n)
self.six_1d = np.ones(5 * n)
# avoid np.zeros's lazy allocation that might cause
# page faults during benchmark
self.zero_2d = np.full((2 * n, 6 * n), 0)
Reported by Pylint.
numpy/testing/_private/noseclasses.py
67 issues
Line: 13
Column: 1
import inspect
import numpy
import nose
from nose.plugins import doctests as npd
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
Reported by Pylint.
Line: 14
Column: 1
import numpy
import nose
from nose.plugins import doctests as npd
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
Reported by Pylint.
Line: 15
Column: 1
import numpy
import nose
from nose.plugins import doctests as npd
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
Reported by Pylint.
Line: 16
Column: 1
import nose
from nose.plugins import doctests as npd
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
Reported by Pylint.
Line: 17
Column: 1
from nose.plugins import doctests as npd
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
# Some of the classes in this module begin with 'Numpy' to clearly distinguish
Reported by Pylint.
Line: 18
Column: 1
from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
# Some of the classes in this module begin with 'Numpy' to clearly distinguish
# them from the plethora of very similar names from nose/unittest/doctest
Reported by Pylint.
Line: 19
Column: 1
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
# Some of the classes in this module begin with 'Numpy' to clearly distinguish
# them from the plethora of very similar names from nose/unittest/doctest
Reported by Pylint.
Line: 326
Column: 9
"""
def prepareTestCase(self, test):
from numpy.core._multiarray_tests import get_fpu_mode
def run(result):
old_mode = get_fpu_mode()
test.test(result)
new_mode = get_fpu_mode()
Reported by Pylint.
Line: 355
Column: 12
to return it to the user, override TestProgram.runTests to retain
the result
"""
if self.testRunner is None:
self.testRunner = nose.core.TextTestRunner(stream=self.config.stream,
verbosity=self.config.verbosity,
config=self.config)
plug_runner = self.config.plugins.prepareTestRunner(self.testRunner)
if plug_runner is not None:
Reported by Pylint.
Line: 19
Column: 1
from nose.plugins.base import Plugin
from nose.util import src
from .nosetester import get_package_name
from .utils import KnownFailureException, KnownFailureTest
# Some of the classes in this module begin with 'Numpy' to clearly distinguish
# them from the plethora of very similar names from nose/unittest/doctest
Reported by Pylint.