The following issues were found
numpy/lib/format.py
41 issues
Line: 165
Column: 1
"""
import numpy
import io
import warnings
from numpy.lib.utils import safe_eval
from numpy.compat import (
isfileobj, os_fspath, pickle
)
Reported by Pylint.
Line: 166
Column: 1
"""
import numpy
import io
import warnings
from numpy.lib.utils import safe_eval
from numpy.compat import (
isfileobj, os_fspath, pickle
)
Reported by Pylint.
Line: 218
Column: 1
raise ValueError("minor version must be 0 <= minor < 256")
return MAGIC_PREFIX + bytes([major, minor])
def read_magic(fp):
""" Read the magic string to get the version of the file format.
Parameters
----------
fp : filelike object
Reported by Pylint.
Line: 237
Column: 1
major, minor = magic_str[-2:]
return major, minor
def _has_metadata(dt):
if dt.metadata is not None:
return True
elif dt.names is not None:
return any(_has_metadata(dt[k]) for k in dt.names)
elif dt.subdtype is not None:
Reported by Pylint.
Line: 238
Column: 5
return major, minor
def _has_metadata(dt):
if dt.metadata is not None:
return True
elif dt.names is not None:
return any(_has_metadata(dt[k]) for k in dt.names)
elif dt.subdtype is not None:
return _has_metadata(dt.base)
Reported by Pylint.
Line: 274
Column: 5
warnings.warn("metadata on a dtype may be saved or ignored, but will "
"raise if saved when read. Use another form of storage.",
UserWarning, stacklevel=2)
if dtype.names is not None:
# This is a record array. The .descr is fine. XXX: parts of the
# record array with an empty name, like padding bytes, still get
# fiddled with. This needs to be fixed in the C implementation of
# dtype().
return dtype.descr
Reported by Pylint.
Line: 304
Column: 5
The dtype constructed by the description.
"""
if isinstance(descr, str):
# No padding removal needed
return numpy.dtype(descr)
elif isinstance(descr, tuple):
# subtype, will always have a shape descr[1]
dt = descr_to_dtype(descr[0])
Reported by Pylint.
Line: 309
Column: 9
return numpy.dtype(descr)
elif isinstance(descr, tuple):
# subtype, will always have a shape descr[1]
dt = descr_to_dtype(descr[0])
return numpy.dtype((dt, descr[1]))
titles = []
names = []
formats = []
Reported by Pylint.
Line: 320
Column: 13
for field in descr:
if len(field) == 2:
name, descr_str = field
dt = descr_to_dtype(descr_str)
else:
name, descr_str, shape = field
dt = numpy.dtype((descr_to_dtype(descr_str), shape))
# Ignore padding bytes, which will be void bytes with '' as name
Reported by Pylint.
Line: 323
Column: 13
dt = descr_to_dtype(descr_str)
else:
name, descr_str, shape = field
dt = numpy.dtype((descr_to_dtype(descr_str), shape))
# Ignore padding bytes, which will be void bytes with '' as name
# Once support for blank names is removed, only "if name == ''" needed)
is_pad = (name == '' and dt.type is numpy.void and dt.names is None)
if not is_pad:
Reported by Pylint.
numpy/ctypeslib.py
40 issues
Line: 179
Column: 12
def from_param(cls, obj):
if not isinstance(obj, ndarray):
raise TypeError("argument must be an ndarray")
if cls._dtype_ is not None \
and obj.dtype != cls._dtype_:
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
Reported by Pylint.
Line: 180
Column: 33
if not isinstance(obj, ndarray):
raise TypeError("argument must be an ndarray")
if cls._dtype_ is not None \
and obj.dtype != cls._dtype_:
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
Reported by Pylint.
Line: 181
Column: 62
raise TypeError("argument must be an ndarray")
if cls._dtype_ is not None \
and obj.dtype != cls._dtype_:
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
Reported by Pylint.
Line: 182
Column: 12
if cls._dtype_ is not None \
and obj.dtype != cls._dtype_:
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
Reported by Pylint.
Line: 183
Column: 32
and obj.dtype != cls._dtype_:
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
Reported by Pylint.
Line: 184
Column: 65
raise TypeError("array must have data type %s" % cls._dtype_)
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
and ((obj.flags.num & cls._flags_) != cls._flags_):
Reported by Pylint.
Line: 185
Column: 12
if cls._ndim_ is not None \
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
and ((obj.flags.num & cls._flags_) != cls._flags_):
raise TypeError("array must have flags %s" %
Reported by Pylint.
Line: 186
Column: 33
and obj.ndim != cls._ndim_:
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
and ((obj.flags.num & cls._flags_) != cls._flags_):
raise TypeError("array must have flags %s" %
_flags_fromnum(cls._flags_))
Reported by Pylint.
Line: 187
Column: 62
raise TypeError("array must have %d dimension(s)" % cls._ndim_)
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
and ((obj.flags.num & cls._flags_) != cls._flags_):
raise TypeError("array must have flags %s" %
_flags_fromnum(cls._flags_))
return obj.ctypes
Reported by Pylint.
Line: 188
Column: 12
if cls._shape_ is not None \
and obj.shape != cls._shape_:
raise TypeError("array must have shape %s" % str(cls._shape_))
if cls._flags_ is not None \
and ((obj.flags.num & cls._flags_) != cls._flags_):
raise TypeError("array must have flags %s" %
_flags_fromnum(cls._flags_))
return obj.ctypes
Reported by Pylint.
numpy/core/machar.py
40 issues
Line: 10
Column: 1
"""
__all__ = ['MachAr']
from numpy.core.fromnumeric import any
from numpy.core._ufunc_config import errstate
from numpy.core.overrides import set_module
# Need to speed this up...especially for longfloat
Reported by Pylint.
Line: 296
Column: 13
xmax = one - beta*epsneg
xmax = xmax / (xmin*beta*beta*beta)
i = maxexp + minexp + 3
for j in range(i):
if ibeta == 2:
xmax = xmax + xmax
else:
xmax = xmax * beta
Reported by Pylint.
Line: 17
Column: 1
# Need to speed this up...especially for longfloat
@set_module('numpy')
class MachAr:
"""
Diagnosing machine parameters.
Attributes
----------
Reported by Pylint.
Line: 17
Column: 1
# Need to speed this up...especially for longfloat
@set_module('numpy')
class MachAr:
"""
Diagnosing machine parameters.
Attributes
----------
Reported by Pylint.
Line: 104
Column: 5
"""
def __init__(self, float_conv=float,int_conv=int,
float_to_float=float,
float_to_str=lambda v:'%24.16e' % v,
title='Python floating point number'):
"""
Reported by Pylint.
Line: 122
Column: 5
with errstate(under='ignore'):
self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)
two = one + one
zero = one - one
Reported by Pylint.
Line: 122
Column: 5
with errstate(under='ignore'):
self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)
two = one + one
zero = one - one
Reported by Pylint.
Line: 122
Column: 5
with errstate(under='ignore'):
self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)
two = one + one
zero = one - one
Reported by Pylint.
Line: 122
Column: 5
with errstate(under='ignore'):
self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)
two = one + one
zero = one - one
Reported by Pylint.
Line: 123
Column: 9
self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)
two = one + one
zero = one - one
Reported by Pylint.
numpy/polynomial/tests/test_polyutils.py
39 issues
Line: 14
Column: 13
class TestMisc:
def test_trimseq(self):
for i in range(5):
tgt = [1]
res = pu.trimseq([1] + [0]*5)
assert_equal(res, tgt)
def test_as_series(self):
Reported by Pylint.
Line: 31
Column: 17
ci = np.ones(1, types[i])
cj = np.ones(1, types[j])
[resi, resj] = pu.as_series([ci, cj])
assert_(resi.dtype.char == resj.dtype.char)
assert_(resj.dtype.char == types[i])
def test_trimcoef(self):
coef = [2, -1, 1, 0]
# Test exceptions
Reported by Pylint.
Line: 32
Column: 17
cj = np.ones(1, types[j])
[resi, resj] = pu.as_series([ci, cj])
assert_(resi.dtype.char == resj.dtype.char)
assert_(resj.dtype.char == types[i])
def test_trimcoef(self):
coef = [2, -1, 1, 0]
# Test exceptions
assert_raises(ValueError, pu.trimcoef, coef, -1)
Reported by Pylint.
Line: 45
Column: 35
def test_vander_nd_exception(self):
# n_dims != len(points)
assert_raises(ValueError, pu._vander_nd, (), (1, 2, 3), [90])
# n_dims != len(degrees)
assert_raises(ValueError, pu._vander_nd, (), (), [90.65])
# n_dims == 0
assert_raises(ValueError, pu._vander_nd, (), (), [])
Reported by Pylint.
Line: 47
Column: 35
# n_dims != len(points)
assert_raises(ValueError, pu._vander_nd, (), (1, 2, 3), [90])
# n_dims != len(degrees)
assert_raises(ValueError, pu._vander_nd, (), (), [90.65])
# n_dims == 0
assert_raises(ValueError, pu._vander_nd, (), (), [])
def test_div_zerodiv(self):
# c2[-1] == 0
Reported by Pylint.
Line: 49
Column: 35
# n_dims != len(degrees)
assert_raises(ValueError, pu._vander_nd, (), (), [90.65])
# n_dims == 0
assert_raises(ValueError, pu._vander_nd, (), (), [])
def test_div_zerodiv(self):
# c2[-1] == 0
assert_raises(ZeroDivisionError, pu._div, pu._div, (1, 2, 3), [0])
Reported by Pylint.
Line: 53
Column: 51
def test_div_zerodiv(self):
# c2[-1] == 0
assert_raises(ZeroDivisionError, pu._div, pu._div, (1, 2, 3), [0])
def test_pow_too_large(self):
# power > maxpower
assert_raises(ValueError, pu._pow, (), [1, 2, 3], 5, 4)
Reported by Pylint.
Line: 53
Column: 42
def test_div_zerodiv(self):
# c2[-1] == 0
assert_raises(ZeroDivisionError, pu._div, pu._div, (1, 2, 3), [0])
def test_pow_too_large(self):
# power > maxpower
assert_raises(ValueError, pu._pow, (), [1, 2, 3], 5, 4)
Reported by Pylint.
Line: 57
Column: 35
def test_pow_too_large(self):
# power > maxpower
assert_raises(ValueError, pu._pow, (), [1, 2, 3], 5, 4)
class TestDomain:
def test_getdomain(self):
# test for real values
Reported by Pylint.
Line: 106
Column: 9
dom2 = [1, 3]
x = np.array([dom1, dom1]).view(MyNDArray)
res = pu.mapdomain(x, dom1, dom2)
assert_(isinstance(res, MyNDArray))
def test_mapparms(self):
# test for real values
dom1 = [0, 4]
dom2 = [1, 3]
Reported by Pylint.
numpy/_version.py
39 issues
Line: 41
Column: 5
# these strings are filled in when 'setup.py versioneer' creates
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
Reported by Pylint.
Line: 42
Column: 5
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
return cfg
Reported by Pylint.
Line: 43
Column: 5
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
return cfg
Reported by Pylint.
Line: 44
Column: 5
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
return cfg
Reported by Pylint.
Line: 45
Column: 5
cfg.style = "pep440"
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
return cfg
class NotThisMethod(Exception):
Reported by Pylint.
Line: 46
Column: 5
cfg.tag_prefix = "v"
cfg.parentdir_prefix = "numpy-"
cfg.versionfile_source = "numpy/_version.py"
cfg.verbose = False
return cfg
class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario."""
Reported by Pylint.
Line: 113
Column: 9
"""
rootdirs = []
for i in range(3):
dirname = os.path.basename(root)
if dirname.startswith(parentdir_prefix):
return {"version": dirname[len(parentdir_prefix):],
"full-revisionid": None,
"dirty": False, "error": None, "date": None}
Reported by Pylint.
Line: 217
Column: 52
@register_vcs_handler("git", "pieces_from_vcs")
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
"""Get version from 'git describe' in the root of the source tree.
This only gets called if the git-archive 'subst' keywords were *not*
expanded, and _version.py hasn't already been rewritten with a short
version string, meaning we're inside a checked out source tree.
Reported by Pylint.
Line: 228
Column: 5
if sys.platform == "win32":
GITS = ["git.cmd", "git.exe"]
out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root,
hide_stderr=True)
if rc != 0:
if verbose:
print("Directory %s not under git control" % root)
raise NotThisMethod("'git rev-parse --git-dir' returned error")
Reported by Pylint.
Line: 501
Column: 13
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for i in cfg.versionfile_source.split('/'):
root = os.path.dirname(root)
except NameError:
return {"version": "0+unknown", "full-revisionid": None,
"dirty": None,
"error": "unable to find root of source tree",
Reported by Pylint.
numpy/typing/tests/data/reveal/shape_base.py
39 issues
Line: 2
Column: 1
import numpy as np
from numpy.typing import NDArray
from typing import Any, List
i8: np.int64
f8: np.float64
AR_b: NDArray[np.bool_]
AR_i8: NDArray[np.int64]
Reported by Pylint.
Line: 14
Column: 1
AR_LIKE_f8: List[float]
reveal_type(np.take_along_axis(AR_f8, AR_i8, axis=1)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.take_along_axis(f8, AR_i8, axis=None)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.put_along_axis(AR_f8, AR_i8, "1.0", axis=1)) # E: None
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 15
Column: 1
AR_LIKE_f8: List[float]
reveal_type(np.take_along_axis(AR_f8, AR_i8, axis=1)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.take_along_axis(f8, AR_i8, axis=None)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.put_along_axis(AR_f8, AR_i8, "1.0", axis=1)) # E: None
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
Reported by Pylint.
Line: 17
Column: 1
reveal_type(np.take_along_axis(AR_f8, AR_i8, axis=1)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.take_along_axis(f8, AR_i8, axis=None)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]]
reveal_type(np.put_along_axis(AR_f8, AR_i8, "1.0", axis=1)) # E: None
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 19
Column: 1
reveal_type(np.put_along_axis(AR_f8, AR_i8, "1.0", axis=1)) # E: None
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
Reported by Pylint.
Line: 20
Column: 1
reveal_type(np.put_along_axis(AR_f8, AR_i8, "1.0", axis=1)) # E: None
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.dstack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 22
Column: 1
reveal_type(np.expand_dims(AR_i8, 2)) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.dstack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.dstack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
Reported by Pylint.
Line: 23
Column: 1
reveal_type(np.expand_dims(AR_LIKE_f8, 2)) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.dstack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.dstack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.row_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 25
Column: 1
reveal_type(np.column_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.dstack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.dstack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.row_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.row_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
Reported by Pylint.
Line: 26
Column: 1
reveal_type(np.column_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.dstack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.dstack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.row_stack([AR_i8])) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(np.row_stack([AR_LIKE_f8])) # E: numpy.ndarray[Any, numpy.dtype[Any]]
reveal_type(np.array_split(AR_i8, [3, 5, 6, 10])) # E: list[numpy.ndarray[Any, numpy.dtype[{int64}]]]
Reported by Pylint.
numpy/distutils/tests/test_npy_pkg_config.py
38 issues
Line: 45
Column: 9
pkg = os.path.splitext(path)[0]
out = read_config(pkg)
assert_(out.cflags() == simple_d['cflags'])
assert_(out.libs() == simple_d['libflags'])
assert_(out.name == simple_d['name'])
assert_(out.version == simple_d['version'])
def test_simple_variable(self):
Reported by Pylint.
Line: 46
Column: 9
out = read_config(pkg)
assert_(out.cflags() == simple_d['cflags'])
assert_(out.libs() == simple_d['libflags'])
assert_(out.name == simple_d['name'])
assert_(out.version == simple_d['version'])
def test_simple_variable(self):
with temppath('foo.ini') as path:
Reported by Pylint.
Line: 47
Column: 9
assert_(out.cflags() == simple_d['cflags'])
assert_(out.libs() == simple_d['libflags'])
assert_(out.name == simple_d['name'])
assert_(out.version == simple_d['version'])
def test_simple_variable(self):
with temppath('foo.ini') as path:
with open(path, 'w') as f:
Reported by Pylint.
Line: 48
Column: 9
assert_(out.cflags() == simple_d['cflags'])
assert_(out.libs() == simple_d['libflags'])
assert_(out.name == simple_d['name'])
assert_(out.version == simple_d['version'])
def test_simple_variable(self):
with temppath('foo.ini') as path:
with open(path, 'w') as f:
f.write(simple_variable)
Reported by Pylint.
Line: 57
Column: 9
pkg = os.path.splitext(path)[0]
out = read_config(pkg)
assert_(out.cflags() == simple_variable_d['cflags'])
assert_(out.libs() == simple_variable_d['libflags'])
assert_(out.name == simple_variable_d['name'])
assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
assert_(out.cflags() == '-I/Users/david/include')
Reported by Pylint.
Line: 58
Column: 9
out = read_config(pkg)
assert_(out.cflags() == simple_variable_d['cflags'])
assert_(out.libs() == simple_variable_d['libflags'])
assert_(out.name == simple_variable_d['name'])
assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
assert_(out.cflags() == '-I/Users/david/include')
Reported by Pylint.
Line: 59
Column: 9
assert_(out.cflags() == simple_variable_d['cflags'])
assert_(out.libs() == simple_variable_d['libflags'])
assert_(out.name == simple_variable_d['name'])
assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
assert_(out.cflags() == '-I/Users/david/include')
class TestParseFlags:
Reported by Pylint.
Line: 60
Column: 9
assert_(out.cflags() == simple_variable_d['cflags'])
assert_(out.libs() == simple_variable_d['libflags'])
assert_(out.name == simple_variable_d['name'])
assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
assert_(out.cflags() == '-I/Users/david/include')
class TestParseFlags:
def test_simple_cflags(self):
Reported by Pylint.
Line: 62
Column: 9
assert_(out.name == simple_variable_d['name'])
assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
assert_(out.cflags() == '-I/Users/david/include')
class TestParseFlags:
def test_simple_cflags(self):
d = parse_flags("-I/usr/include")
assert_(d['include_dirs'] == ['/usr/include'])
Reported by Pylint.
Line: 67
Column: 9
class TestParseFlags:
def test_simple_cflags(self):
d = parse_flags("-I/usr/include")
assert_(d['include_dirs'] == ['/usr/include'])
d = parse_flags("-I/usr/include -DFOO")
assert_(d['include_dirs'] == ['/usr/include'])
assert_(d['macros'] == ['FOO'])
Reported by Pylint.
numpy/testing/_private/decorators.py
38 issues
Line: 19
Column: 1
import collections.abc
import warnings
from .utils import SkipTest, assert_warns, HAS_REFCOUNT
__all__ = ['slow', 'setastest', 'skipif', 'knownfailureif', 'deprecated',
'parametrize', '_needs_refcount',]
Reported by Pylint.
Line: 143
Column: 9
def skip_decorator(f):
# Local import to avoid a hard nose dependency and only incur the
# import time overhead at actual test-time.
import nose
# Numpy 1.21, 2020-12-20
warnings.warn('the np.testing.dec decorators are included for nose support, and are '
'deprecated since NumPy v1.21. Use the nose2 or pytest frameworks instead.', DeprecationWarning, stacklevel=2)
Reported by Pylint.
Line: 241
Column: 9
def knownfail_decorator(f):
# Local import to avoid a hard nose dependency and only incur the
# import time overhead at actual test-time.
import nose
from .noseclasses import KnownFailureException
def knownfailer(*args, **kwargs):
if fail_val():
raise KnownFailureException(msg)
Reported by Pylint.
Line: 242
Column: 9
# Local import to avoid a hard nose dependency and only incur the
# import time overhead at actual test-time.
import nose
from .noseclasses import KnownFailureException
def knownfailer(*args, **kwargs):
if fail_val():
raise KnownFailureException(msg)
else:
Reported by Pylint.
Line: 285
Column: 9
def deprecate_decorator(f):
# Local import to avoid a hard nose dependency and only incur the
# import time overhead at actual test-time.
import nose
# Numpy 1.21, 2020-12-20
warnings.warn('the np.testing.dec decorators are included for nose support, and are '
'deprecated since NumPy v1.21. Use the nose2 or pytest frameworks instead.', DeprecationWarning, stacklevel=2)
Reported by Pylint.
Line: 323
Column: 5
.. versionadded:: 1.14.0
"""
from .parameterized import parameterized
# Numpy 1.21, 2020-12-20
warnings.warn('the np.testing.dec decorators are included for nose support, and are '
'deprecated since NumPy v1.21. Use the nose2 or pytest frameworks instead.', DeprecationWarning, stacklevel=2)
Reported by Pylint.
Line: 151
Column: 24
# Allow for both boolean or callable skip conditions.
if isinstance(skip_condition, collections.abc.Callable):
skip_val = lambda: skip_condition()
else:
skip_val = lambda: skip_condition
def get_msg(func,msg=None):
"""Skip message with information about function being skipped."""
Reported by Pylint.
Line: 234
Column: 20
# Allow for both boolean or callable known failure conditions.
if isinstance(fail_condition, collections.abc.Callable):
fail_val = lambda: fail_condition()
else:
fail_val = lambda: fail_condition
def knownfail_decorator(f):
# Local import to avoid a hard nose dependency and only incur the
Reported by Pylint.
Line: 307
Column: 17
return deprecate_decorator
def parametrize(vars, input):
"""
.. deprecated:: 1.21
This decorator is retained for compatibility with the nose testing framework, which is being phased out.
Please use the nose2 or pytest frameworks instead.
Reported by Pylint.
Line: 307
Column: 17
return deprecate_decorator
def parametrize(vars, input):
"""
.. deprecated:: 1.21
This decorator is retained for compatibility with the nose testing framework, which is being phased out.
Please use the nose2 or pytest frameworks instead.
Reported by Pylint.
numpy/typing/tests/data/pass/modules.py
38 issues
Line: 4
Column: 1
import numpy as np
from numpy import f2py
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
Reported by Pylint.
Line: 5
Column: 1
from numpy import f2py
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
Reported by Pylint.
Line: 6
Column: 1
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
Reported by Pylint.
Line: 7
Column: 1
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
Reported by Pylint.
Line: 8
Column: 1
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
Reported by Pylint.
Line: 9
Column: 1
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
Reported by Pylint.
Line: 10
Column: 1
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
Reported by Pylint.
Line: 11
Column: 1
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version
Reported by Pylint.
Line: 12
Column: 1
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version
Reported by Pylint.
Line: 13
Column: 1
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version
np.lib.format
Reported by Pylint.
numpy/testing/_private/nosetester.py
37 issues
Line: 12
Column: 1
import warnings
import numpy as np
from .utils import import_nose, suppress_warnings
__all__ = ['get_package_name', 'run_module_suite', 'NoseTester',
'_numpy_tester', 'get_package_name', 'import_nose',
'suppress_warnings']
Reported by Pylint.
Line: 108
Column: 5
argv = argv + [file_to_run]
nose = import_nose()
from .noseclasses import KnownFailurePlugin
nose.run(argv=argv, addplugins=[KnownFailurePlugin()])
class NoseTester:
"""
Reported by Pylint.
Line: 243
Column: 13
print(f'NumPy is installed in {npdir}')
if 'scipy' in self.package_name:
import scipy
print(f'SciPy version {scipy.__version__}')
spdir = os.path.dirname(scipy.__file__)
print(f'SciPy is installed in {spdir}')
pyversion = sys.version.replace('\n', '')
Reported by Pylint.
Line: 259
Column: 9
A return value of None means use the nose builtin doctest plugin
"""
from .noseclasses import NumpyDoctest
return NumpyDoctest()
def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
doctests=False, coverage=False, timer=False):
"""
Reported by Pylint.
Line: 291
Column: 9
argv += ['--with-timer', '--timer-top-n', str(timer)]
# construct list of plugins
import nose.plugins.builtin
from nose.plugins import EntryPointPluginManager
from .noseclasses import (KnownFailurePlugin, Unplugger,
FPUModeCheckPlugin)
plugins = [KnownFailurePlugin()]
plugins += [p() for p in nose.plugins.builtin.plugins]
Reported by Pylint.
Line: 292
Column: 9
# construct list of plugins
import nose.plugins.builtin
from nose.plugins import EntryPointPluginManager
from .noseclasses import (KnownFailurePlugin, Unplugger,
FPUModeCheckPlugin)
plugins = [KnownFailurePlugin()]
plugins += [p() for p in nose.plugins.builtin.plugins]
if self.check_fpu_mode:
Reported by Pylint.
Line: 293
Column: 9
# construct list of plugins
import nose.plugins.builtin
from nose.plugins import EntryPointPluginManager
from .noseclasses import (KnownFailurePlugin, Unplugger,
FPUModeCheckPlugin)
plugins = [KnownFailurePlugin()]
plugins += [p() for p in nose.plugins.builtin.plugins]
if self.check_fpu_mode:
plugins += [FPUModeCheckPlugin()]
Reported by Pylint.
Line: 399
Column: 9
# cap verbosity at 3 because nose becomes *very* verbose beyond that
verbose = min(verbose, 3)
from . import utils
utils.verbose = verbose
argv, plugins = self.prepare_test_args(
label, verbose, extra_argv, doctests, coverage, timer)
Reported by Pylint.
Line: 448
Column: 17
# so fetch module for suppression here.
with warnings.catch_warnings():
warnings.simplefilter("always")
from ...distutils import cpuinfo
sup.filter(category=UserWarning, module=cpuinfo)
# Filter out some deprecation warnings inside nose 1.3.7 when run
# on python 3.5b2. See
# https://github.com/nose-devs/nose/issues/929
# Note: it is hard to filter based on module for sup (lineno could
Reported by Pylint.
Line: 459
Column: 13
category=DeprecationWarning,
module=r"nose\.")
from .noseclasses import NumpyTestProgram
t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
return t.result
Reported by Pylint.