The following issues were found
numpy/distutils/fcompiler/__init__.py
108 issues
Line: 36
Column: 1
from numpy.distutils.exec_command import find_executable
from numpy.distutils import _shell_utils
from .environment import EnvironmentConfig
__metaclass__ = type
class CompilerNotFound(Exception):
pass
Reported by Pylint.
Line: 243
Column: 5
# Use properties for the attributes used by CCompiler. Setting them
# as attributes from the self.executables dictionary is error-prone,
# so we get them from there each time.
def _command_property(key):
def fget(self):
assert self._is_customised
return self.executables[key]
return property(fget=fget)
version_cmd = _command_property('version_cmd')
Reported by Pylint.
Line: 424
Column: 19
def get_version(self, force=False, ok_status=[0]):
assert self._is_customised
version = CCompiler.get_version(self, force=force, ok_status=ok_status)
if version is None:
raise CompilerNotFound()
return version
Reported by Pylint.
Line: 610
Column: 13
display = '%s: %s' % (os.path.basename(compiler[0]) + flavor,
src)
try:
self.spawn(command, display=display)
except DistutilsExecError as e:
msg = str(e)
raise CompileError(msg) from None
def module_options(self, module_dirs, module_build_dir):
Reported by Pylint.
Line: 141
Column: 3
language_map = {'.f': 'f77',
'.for': 'f77',
'.F': 'f77', # XXX: needs preprocessor
'.ftn': 'f77',
'.f77': 'f77',
'.f90': 'f90',
'.F90': 'f90', # XXX: needs preprocessor
'.f95': 'f90',
Reported by Pylint.
Line: 145
Column: 3
'.ftn': 'f77',
'.f77': 'f77',
'.f90': 'f90',
'.F90': 'f90', # XXX: needs preprocessor
'.f95': 'f90',
}
language_order = ['f90', 'f77']
Reported by Pylint.
Line: 245
Column: 20
# so we get them from there each time.
def _command_property(key):
def fget(self):
assert self._is_customised
return self.executables[key]
return property(fget=fget)
version_cmd = _command_property('version_cmd')
compiler_f77 = _command_property('compiler_f77')
compiler_f90 = _command_property('compiler_f90')
Reported by Pylint.
Line: 302
Column: 9
fc_exe = find_executable(exe)
exe_cache[exe] = exe_cache[fc_exe] = fc_exe
return fc_exe
def verify_command_form(name, value):
if value is not None and not is_sequence_of_strings(value):
raise ValueError(
"%s value %r is invalid in class %s" %
(name, value, self.__class__.__name__))
def set_exe(exe_key, f77=None, f90=None):
Reported by Pylint.
Line: 368
Column: 9
the command, which will be replaced by the found F77 or F90
compiler.
"""
pass
def get_flags(self):
"""List of flags common to all compiler types."""
return [] + self.pic_flags
Reported by Pylint.
Line: 422
Column: 5
"""List of compiler library directories."""
return self.library_dirs[:]
def get_version(self, force=False, ok_status=[0]):
assert self._is_customised
version = CCompiler.get_version(self, force=force, ok_status=ok_status)
if version is None:
raise CompilerNotFound()
return version
Reported by Pylint.
benchmarks/benchmarks/bench_linalg.py
108 issues
Line: 1
Column: 1
from .common import Benchmark, get_squares_, get_indexes_rand, TYPES1
import numpy as np
class Eindot(Benchmark):
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
self.ac = self.a.copy()
Reported by Pylint.
Line: 8
Column: 9
class Eindot(Benchmark):
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
self.ac = self.a.copy()
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
Reported by Pylint.
Line: 9
Column: 9
class Eindot(Benchmark):
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
self.ac = self.a.copy()
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
Reported by Pylint.
Line: 10
Column: 9
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
self.ac = self.a.copy()
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
Reported by Pylint.
Line: 11
Column: 9
self.a = np.arange(60000.0).reshape(150, 400)
self.ac = self.a.copy()
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
Reported by Pylint.
Line: 12
Column: 9
self.ac = self.a.copy()
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
self.b3 = np.arange(192000.).reshape(80, 60, 40)
Reported by Pylint.
Line: 13
Column: 9
self.at = self.a.T
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
self.b3 = np.arange(192000.).reshape(80, 60, 40)
Reported by Pylint.
Line: 14
Column: 9
self.atc = self.a.T.copy()
self.b = np.arange(240000.0).reshape(400, 600)
self.c = np.arange(600)
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
self.b3 = np.arange(192000.).reshape(80, 60, 40)
def time_dot_a_b(self):
Reported by Pylint.
Line: 16
Column: 9
self.c = np.arange(600)
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
self.b3 = np.arange(192000.).reshape(80, 60, 40)
def time_dot_a_b(self):
np.dot(self.a, self.b)
Reported by Pylint.
Line: 17
Column: 9
self.d = np.arange(400)
self.a3 = np.arange(480000.).reshape(60, 80, 100)
self.b3 = np.arange(192000.).reshape(80, 60, 40)
def time_dot_a_b(self):
np.dot(self.a, self.b)
def time_dot_d_dot_b_c(self):
Reported by Pylint.
tools/swig/test/testArray.py
107 issues
Line: 14
Column: 1
else:
BadListError = ValueError
import Array
######################################################################
class Array1TestCase(unittest.TestCase):
Reported by Pylint.
Line: 234
Column: 9
def testAsString(self):
"Test Array2 asString method"
result = """\
[ [ 0, 1, 2, 3 ],
[ 1, 2, 3, 4 ],
[ 2, 3, 4, 5 ],
[ 3, 4, 5, 6 ],
[ 4, 5, 6, 7 ] ]
Reported by Pylint.
Line: 248
Column: 9
def testStr(self):
"Test Array2 __str__ method"
result = """\
[ [ 0, -1, -2, -3 ],
[ 1, 0, -1, -2 ],
[ 2, 1, 0, -1 ],
[ 3, 2, 1, 0 ],
[ 4, 3, 2, 1 ] ]
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:
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:
Reported by Pylint.
Line: 14
Column: 1
else:
BadListError = ValueError
import Array
######################################################################
class Array1TestCase(unittest.TestCase):
Reported by Pylint.
Line: 18
Column: 1
######################################################################
class Array1TestCase(unittest.TestCase):
def setUp(self):
self.length = 5
self.array1 = Array.Array1(self.length)
Reported by Pylint.
Line: 24
Column: 5
self.length = 5
self.array1 = Array.Array1(self.length)
def testConstructor0(self):
"Test Array1 default constructor"
a = Array.Array1()
self.assertTrue(isinstance(a, Array.Array1))
self.assertTrue(len(a) == 0)
Reported by Pylint.
Line: 26
Column: 9
def testConstructor0(self):
"Test Array1 default constructor"
a = Array.Array1()
self.assertTrue(isinstance(a, Array.Array1))
self.assertTrue(len(a) == 0)
def testConstructor1(self):
"Test Array1 length constructor"
Reported by Pylint.
Line: 30
Column: 5
self.assertTrue(isinstance(a, Array.Array1))
self.assertTrue(len(a) == 0)
def testConstructor1(self):
"Test Array1 length constructor"
self.assertTrue(isinstance(self.array1, Array.Array1))
def testConstructor2(self):
"Test Array1 array constructor"
Reported by Pylint.
versioneer.py
107 issues
Line: 1594
Column: 9
cmds["build_ext"] = cmd_build_ext
if "cx_Freeze" in sys.modules: # cx_freeze enabled?
from cx_Freeze.dist import build_exe as _build_exe
# nczeczulin reports that py2exe won't like the pep440-style string
# as FILEVERSION, but it can be used for PRODUCTVERSION, e.g.
# setup(console=[{
# "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION
# "product_version": versioneer.get_version(),
Reported by Pylint.
Line: 1626
Column: 9
del cmds["build_py"]
if 'py2exe' in sys.modules: # py2exe enabled?
from py2exe.distutils_buildexe import py2exe as _py2exe
class cmd_py2exe(_py2exe):
def run(self):
root = get_root()
cfg = get_config_from_root(root)
Reported by Pylint.
Line: 345
Column: 5
return parser.get("versioneer", name)
return None
cfg = VersioneerConfig()
cfg.VCS = VCS
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
Reported by Pylint.
Line: 346
Column: 5
return None
cfg = VersioneerConfig()
cfg.VCS = VCS
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
Reported by Pylint.
Line: 347
Column: 5
cfg = VersioneerConfig()
cfg.VCS = VCS
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
Reported by Pylint.
Line: 348
Column: 5
cfg.VCS = VCS
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
Reported by Pylint.
Line: 349
Column: 5
cfg.style = get(parser, "style") or ""
cfg.versionfile_source = get(parser, "versionfile_source")
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
return cfg
Reported by Pylint.
Line: 351
Column: 9
cfg.versionfile_build = get(parser, "versionfile_build")
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
return cfg
Reported by Pylint.
Line: 352
Column: 5
cfg.tag_prefix = get(parser, "tag_prefix")
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
return cfg
class NotThisMethod(Exception):
Reported by Pylint.
Line: 353
Column: 5
if cfg.tag_prefix in ("''", '""'):
cfg.tag_prefix = ""
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
cfg.verbose = get(parser, "verbose")
return cfg
class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario."""
Reported by Pylint.
numpy/polynomial/tests/test_printing.py
107 issues
Line: 1
Column: 1
import pytest
from numpy.core import array, arange, printoptions
import numpy.polynomial as poly
from numpy.testing import assert_equal, assert_
# For testing polynomial printing with object arrays
from fractions import Fraction
from decimal import Decimal
Reported by Pylint.
Line: 226
Column: 17
with printoptions(linewidth=lw):
assert_equal(str(p), tgt)
for line in str(p).split('\n'):
assert_(len(line) < lw)
def test_set_default_printoptions():
p = poly.Polynomial([1, 2, 3])
c = poly.Chebyshev([1, 2, 3])
Reported by Pylint.
Line: 351
Column: 34
# right now we ignore the formatting of scalars in our tests, since
# it makes them too verbose. Ideally, the formatting of scalars will
# be fixed such that tests below continue to pass
obj._repr_latex_scalar = lambda x: str(x)
try:
return obj._repr_latex_()
finally:
del obj._repr_latex_scalar
Reported by Pylint.
Line: 351
Column: 9
# right now we ignore the formatting of scalars in our tests, since
# it makes them too verbose. Ideally, the formatting of scalars will
# be fixed such that tests below continue to pass
obj._repr_latex_scalar = lambda x: str(x)
try:
return obj._repr_latex_()
finally:
del obj._repr_latex_scalar
Reported by Pylint.
Line: 353
Column: 20
# be fixed such that tests below continue to pass
obj._repr_latex_scalar = lambda x: str(x)
try:
return obj._repr_latex_()
finally:
del obj._repr_latex_scalar
def test_simple_polynomial(self):
# default input
Reported by Pylint.
Line: 1
Column: 1
import pytest
from numpy.core import array, arange, printoptions
import numpy.polynomial as poly
from numpy.testing import assert_equal, assert_
# For testing polynomial printing with object arrays
from fractions import Fraction
from decimal import Decimal
Reported by Pylint.
Line: 7
Column: 1
from numpy.testing import assert_equal, assert_
# For testing polynomial printing with object arrays
from fractions import Fraction
from decimal import Decimal
class TestStrUnicodeSuperSubscripts:
Reported by Pylint.
Line: 8
Column: 1
# For testing polynomial printing with object arrays
from fractions import Fraction
from decimal import Decimal
class TestStrUnicodeSuperSubscripts:
@pytest.fixture(scope='class', autouse=True)
Reported by Pylint.
Line: 11
Column: 1
from decimal import Decimal
class TestStrUnicodeSuperSubscripts:
@pytest.fixture(scope='class', autouse=True)
def use_unicode(self):
poly.set_default_printstyle('unicode')
Reported by Pylint.
Line: 14
Column: 5
class TestStrUnicodeSuperSubscripts:
@pytest.fixture(scope='class', autouse=True)
def use_unicode(self):
poly.set_default_printstyle('unicode')
@pytest.mark.parametrize(('inp', 'tgt'), (
([1, 2, 3], "1.0 + 2.0·x¹ + 3.0·x²"),
([-1, 0, 3, -1], "-1.0 + 0.0·x¹ + 3.0·x² - 1.0·x³"),
Reported by Pylint.
numpy/lib/polynomial.py
105 issues
Line: 661
Column: 13
rhs *= w
# scale lhs to improve condition number and solve
scale = NX.sqrt((lhs*lhs).sum(axis=0))
lhs /= scale
c, resids, rank, s = lstsq(lhs, rhs, rcond)
c = (c.T/scale).T # broadcast scale coefficients
# warn on rank reduction, which indicates an ill conditioned matrix
Reported by Pylint.
Line: 1323
Column: 23
return polyval(self.coeffs, val)
def __neg__(self):
return poly1d(-self.coeffs)
def __pos__(self):
return self
def __mul__(self, other):
Reported by Pylint.
Line: 1323
Column: 23
return polyval(self.coeffs, val)
def __neg__(self):
return poly1d(-self.coeffs)
def __pos__(self):
return self
def __mul__(self, other):
Reported by Pylint.
Line: 14
Column: 1
import warnings
import numpy.core.numeric as NX
from numpy.core import (isscalar, abs, finfo, atleast_1d, hstack, dot, array,
ones)
from numpy.core import overrides
from numpy.core.overrides import set_module
from numpy.lib.twodim_base import diag, vander
from numpy.lib.function_base import trim_zeros
Reported by Pylint.
Line: 37
Column: 5
`RankWarning` being issued, see `polyfit`.
"""
pass
def _poly_dispatcher(seq_of_zeros):
return seq_of_zeros
Reported by Pylint.
Line: 161
Column: 9
if issubclass(a.dtype.type, NX.complexfloating):
# if complex roots are all complex conjugates, the roots are real.
roots = NX.asarray(seq_of_zeros, complex)
if NX.all(NX.sort(roots) == NX.sort(roots.conjugate())):
a = a.real.copy()
return a
Reported by Pylint.
Line: 255
Column: 9
# build companion matrix and find its eigenvalues (the roots)
A = diag(NX.ones((N-2,), p.dtype), -1)
A[0,:] = -p[1:] / p[0]
roots = eigvals(A)
else:
roots = NX.array([])
# tack any zeros onto the back of the array
roots = hstack((roots, NX.zeros(trailing_zeros, roots.dtype)))
Reported by Pylint.
Line: 264
Column: 36
return roots
def _polyint_dispatcher(p, m=None, k=None):
return (p,)
@array_function_dispatch(_polyint_dispatcher)
def polyint(p, m=1, k=None):
Reported by Pylint.
Line: 264
Column: 28
return roots
def _polyint_dispatcher(p, m=None, k=None):
return (p,)
@array_function_dispatch(_polyint_dispatcher)
def polyint(p, m=1, k=None):
Reported by Pylint.
Line: 369
Column: 28
return val
def _polyder_dispatcher(p, m=None):
return (p,)
@array_function_dispatch(_polyder_dispatcher)
def polyder(p, m=1):
Reported by Pylint.
numpy/core/tests/test_half.py
105 issues
Line: 2
Column: 1
import platform
import pytest
import numpy as np
from numpy import uint16, float16, float32, float64
from numpy.testing import assert_, assert_equal
def assert_raises_fpe(strmatch, callable, *args, **kwargs):
Reported by Pylint.
Line: 90
Column: 23
@pytest.mark.parametrize("float_t", [np.float32, np.float64])
def test_half_conversion_rounding(self, float_t, shift, offset):
# Assumes that round to even is used during casting.
max_pattern = np.float16(np.finfo(np.float16).max).view(np.uint16)
# Test all (positive) finite numbers, denormals are most interesting
# however:
f16s_patterns = np.arange(0, max_pattern+1, dtype=np.uint16)
f16s_float = f16s_patterns.view(np.float16).astype(float_t)
Reported by Pylint.
Line: 149
Column: 26
# whether round to even should occur (i.e. no bits are lost at the
# end. Compare also gh-12721. The most bits can get lost for the
# smallest denormal:
smallest_value = np.uint16(1).view(np.float16).astype(float_t)
assert smallest_value == 2**-24
# Will be rounded to zero based on round to even rule:
rounded_to_zero = smallest_value / float_t(2)
assert rounded_to_zero.astype(np.float16) == 0
Reported by Pylint.
Line: 551
Column: 33
a = np.ones((1,), dtype=float16)
b = Dummy()
b.__array_interface__ = a.__array_interface__
c = np.array(b)
assert_(c.dtype == float16)
assert_equal(a, c)
Reported by Pylint.
Line: 9
Column: 33
from numpy.testing import assert_, assert_equal
def assert_raises_fpe(strmatch, callable, *args, **kwargs):
try:
callable(*args, **kwargs)
except FloatingPointError as exc:
assert_(str(exc).find(strmatch) >= 0,
"Did not raise floating point %s error" % strmatch)
Reported by Pylint.
Line: 13
Column: 9
try:
callable(*args, **kwargs)
except FloatingPointError as exc:
assert_(str(exc).find(strmatch) >= 0,
"Did not raise floating point %s error" % strmatch)
else:
assert_(False,
"Did not raise floating point %s error" % strmatch)
Reported by Pylint.
Line: 16
Column: 9
assert_(str(exc).find(strmatch) >= 0,
"Did not raise floating point %s error" % strmatch)
else:
assert_(False,
"Did not raise floating point %s error" % strmatch)
class TestHalf:
def setup(self):
# An array of all possible float16 values
Reported by Pylint.
Line: 22
Column: 9
class TestHalf:
def setup(self):
# An array of all possible float16 values
self.all_f16 = np.arange(0x10000, dtype=uint16)
self.all_f16.dtype = float16
self.all_f32 = np.array(self.all_f16, dtype=float32)
self.all_f64 = np.array(self.all_f16, dtype=float64)
# An array of all non-NaN float16 values, in sorted order
Reported by Pylint.
Line: 24
Column: 9
# An array of all possible float16 values
self.all_f16 = np.arange(0x10000, dtype=uint16)
self.all_f16.dtype = float16
self.all_f32 = np.array(self.all_f16, dtype=float32)
self.all_f64 = np.array(self.all_f16, dtype=float64)
# An array of all non-NaN float16 values, in sorted order
self.nonan_f16 = np.concatenate(
(np.arange(0xfc00, 0x7fff, -1, dtype=uint16),
Reported by Pylint.
Line: 25
Column: 9
self.all_f16 = np.arange(0x10000, dtype=uint16)
self.all_f16.dtype = float16
self.all_f32 = np.array(self.all_f16, dtype=float32)
self.all_f64 = np.array(self.all_f16, dtype=float64)
# An array of all non-NaN float16 values, in sorted order
self.nonan_f16 = np.concatenate(
(np.arange(0xfc00, 0x7fff, -1, dtype=uint16),
np.arange(0x0000, 0x7c01, 1, dtype=uint16)))
Reported by Pylint.
numpy/typing/tests/data/pass/bitwise_ops.py
103 issues
Line: 126
Column: 1
b_ ^ i
b_ & i
~i8
~i4
~u8
~u4
~b_
~AR
Reported by Pylint.
Line: 127
Column: 1
b_ & i
~i8
~i4
~u8
~u4
~b_
~AR
Reported by Pylint.
Line: 128
Column: 1
~i8
~i4
~u8
~u4
~b_
~AR
Reported by Pylint.
Line: 129
Column: 1
~i8
~i4
~u8
~u4
~b_
~AR
Reported by Pylint.
Line: 130
Column: 1
~i4
~u8
~u4
~b_
~AR
Reported by Pylint.
Line: 18
Column: 1
AR.setflags(write=False)
i8 << i8
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
Reported by Pylint.
Line: 19
Column: 1
i8 << i8
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
i8 << AR
Reported by Pylint.
Line: 20
Column: 1
i8 << i8
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
i8 << AR
i8 >> AR
Reported by Pylint.
Line: 21
Column: 1
i8 << i8
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
i8 << AR
i8 >> AR
i8 | AR
Reported by Pylint.
Line: 22
Column: 1
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
i8 << AR
i8 >> AR
i8 | AR
i8 ^ AR
Reported by Pylint.
numpy/typing/tests/data/reveal/bitwise_ops.py
103 issues
Line: 18
Column: 1
AR.setflags(write=False)
reveal_type(i8 << i8) # E: {int64}
reveal_type(i8 >> i8) # E: {int64}
reveal_type(i8 | i8) # E: {int64}
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
Reported by Pylint.
Line: 19
Column: 1
reveal_type(i8 << i8) # E: {int64}
reveal_type(i8 >> i8) # E: {int64}
reveal_type(i8 | i8) # E: {int64}
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
Reported by Pylint.
Line: 20
Column: 1
reveal_type(i8 << i8) # E: {int64}
reveal_type(i8 >> i8) # E: {int64}
reveal_type(i8 | i8) # E: {int64}
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
Reported by Pylint.
Line: 21
Column: 1
reveal_type(i8 << i8) # E: {int64}
reveal_type(i8 >> i8) # E: {int64}
reveal_type(i8 | i8) # E: {int64}
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
Reported by Pylint.
Line: 22
Column: 1
reveal_type(i8 >> i8) # E: {int64}
reveal_type(i8 | i8) # E: {int64}
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
Reported by Pylint.
Line: 24
Column: 1
reveal_type(i8 ^ i8) # E: {int64}
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
reveal_type(i8 & AR) # E: Any
Reported by Pylint.
Line: 25
Column: 1
reveal_type(i8 & i8) # E: {int64}
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
reveal_type(i8 & AR) # E: Any
reveal_type(i4 << i4) # E: {int32}
Reported by Pylint.
Line: 26
Column: 1
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
reveal_type(i8 & AR) # E: Any
reveal_type(i4 << i4) # E: {int32}
reveal_type(i4 >> i4) # E: {int32}
Reported by Pylint.
Line: 27
Column: 1
reveal_type(i8 << AR) # E: Any
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
reveal_type(i8 & AR) # E: Any
reveal_type(i4 << i4) # E: {int32}
reveal_type(i4 >> i4) # E: {int32}
reveal_type(i4 | i4) # E: {int32}
Reported by Pylint.
Line: 28
Column: 1
reveal_type(i8 >> AR) # E: Any
reveal_type(i8 | AR) # E: Any
reveal_type(i8 ^ AR) # E: Any
reveal_type(i8 & AR) # E: Any
reveal_type(i4 << i4) # E: {int32}
reveal_type(i4 >> i4) # E: {int32}
reveal_type(i4 | i4) # E: {int32}
reveal_type(i4 ^ i4) # E: {int32}
Reported by Pylint.
numpy/matrixlib/tests/test_masked_matrix.py
102 issues
Line: 163
Column: 44
def test_view(self):
# Test view w/ flexible dtype
iterator = list(zip(np.arange(10), np.random.rand(10)))
data = np.array(iterator)
a = masked_array(iterator, dtype=[('a', float), ('b', float)])
a.mask[0] = (1, 0)
test = a.view((float, 2), np.matrix)
assert_equal(test, data)
Reported by Pylint.
Line: 12
Column: 1
from numpy.compat import pickle
class MMatrix(MaskedArray, np.matrix,):
def __new__(cls, data, mask=nomask):
mat = np.matrix(data)
_data = MaskedArray.__new__(cls, data=mat, mask=mask)
return _data
Reported by Pylint.
Line: 14
Column: 5
class MMatrix(MaskedArray, np.matrix,):
def __new__(cls, data, mask=nomask):
mat = np.matrix(data)
_data = MaskedArray.__new__(cls, data=mat, mask=mask)
return _data
def __array_finalize__(self, obj):
Reported by Pylint.
Line: 27
Column: 9
@property
def _series(self):
_view = self.view(MaskedArray)
_view._sharedmask = False
return _view
class TestMaskedMatrix:
def test_matrix_indexing(self):
Reported by Pylint.
Line: 42
Column: 9
str(x2) # raises?
repr(x2) # raises?
# tests of indexing
assert_(type(x2[1, 0]) is type(x1[1, 0]))
assert_(x1[1, 0] == x2[1, 0])
assert_(x2[1, 1] is masked)
assert_equal(x1[0, 2], x2[0, 2])
assert_equal(x1[0, 1:], x2[0, 1:])
assert_equal(x1[:, 2], x2[:, 2])
Reported by Pylint.
Line: 43
Column: 9
repr(x2) # raises?
# tests of indexing
assert_(type(x2[1, 0]) is type(x1[1, 0]))
assert_(x1[1, 0] == x2[1, 0])
assert_(x2[1, 1] is masked)
assert_equal(x1[0, 2], x2[0, 2])
assert_equal(x1[0, 1:], x2[0, 1:])
assert_equal(x1[:, 2], x2[:, 2])
assert_equal(x1[:], x2[:])
Reported by Pylint.
Line: 44
Column: 9
# tests of indexing
assert_(type(x2[1, 0]) is type(x1[1, 0]))
assert_(x1[1, 0] == x2[1, 0])
assert_(x2[1, 1] is masked)
assert_equal(x1[0, 2], x2[0, 2])
assert_equal(x1[0, 1:], x2[0, 1:])
assert_equal(x1[:, 2], x2[:, 2])
assert_equal(x1[:], x2[:])
assert_equal(x1[1:], x3[1:])
Reported by Pylint.
Line: 62
Column: 9
assert_equal(x1, x2)
x2[0, :] = x1[0, :]
x2[0, 1] = masked
assert_(allequal(getmask(x2), np.array([[0, 1, 0], [0, 1, 0]])))
x3[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x3)[1], masked_array([1, 1, 0])))
assert_(allequal(getmask(x3[1]), masked_array([1, 1, 0])))
x4[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x4[1]), masked_array([1, 1, 0])))
Reported by Pylint.
Line: 64
Column: 9
x2[0, 1] = masked
assert_(allequal(getmask(x2), np.array([[0, 1, 0], [0, 1, 0]])))
x3[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x3)[1], masked_array([1, 1, 0])))
assert_(allequal(getmask(x3[1]), masked_array([1, 1, 0])))
x4[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x4[1]), masked_array([1, 1, 0])))
assert_(allequal(x4[1], masked_array([1, 2, 3])))
x1 = np.matrix(np.arange(5) * 1.0)
Reported by Pylint.
Line: 65
Column: 9
assert_(allequal(getmask(x2), np.array([[0, 1, 0], [0, 1, 0]])))
x3[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x3)[1], masked_array([1, 1, 0])))
assert_(allequal(getmask(x3[1]), masked_array([1, 1, 0])))
x4[1, :] = masked_array([1, 2, 3], [1, 1, 0])
assert_(allequal(getmask(x4[1]), masked_array([1, 1, 0])))
assert_(allequal(x4[1], masked_array([1, 2, 3])))
x1 = np.matrix(np.arange(5) * 1.0)
x2 = masked_values(x1, 3.0)
Reported by Pylint.