The following issues were found
numpy/f2py/func2subr.py
48 issues
Line: 22
Column: 1
import copy
from .auxfuncs import (
getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
isintent_out, islogicalfunction, ismoduleroutine, isscalar,
issubroutine, issubroutine_wrap, outmess, show
)
Reported by Pylint.
Line: 29
Column: 20
)
def var2fixfortran(vars, a, fa=None, f90mode=None):
if fa is None:
fa = a
if a not in vars:
show(vars)
outmess('var2fixfortran: No definition for argument "%s".\n' % a)
Reported by Pylint.
Line: 82
Column: 5
assert isfunction(rout)
extra_args = []
vars = rout['vars']
for a in rout['args']:
v = rout['vars'][a]
for i, d in enumerate(v.get('dimension', [])):
if d == ':':
dn = 'f2py_%s_d%s' % (a, i)
Reported by Pylint.
Line: 98
Column: 5
ret = ['']
def add(line, ret=ret):
ret[0] = '%s\n %s' % (ret[0], line)
name = rout['name']
fortranname = getfortranname(rout)
f90mode = ismoduleroutine(rout)
newname = '%sf2pywrap' % (name)
Reported by Pylint.
Line: 188
Column: 5
assert issubroutine(rout)
extra_args = []
vars = rout['vars']
for a in rout['args']:
v = rout['vars'][a]
for i, d in enumerate(v.get('dimension', [])):
if d == ':':
dn = 'f2py_%s_d%s' % (a, i)
Reported by Pylint.
Line: 204
Column: 5
ret = ['']
def add(line, ret=ret):
ret[0] = '%s\n %s' % (ret[0], line)
name = rout['name']
fortranname = getfortranname(rout)
f90mode = ismoduleroutine(rout)
Reported by Pylint.
Line: 18
Column: 1
"""
__version__ = "$Revision: 1.16 $"[10:-1]
f2py_version = 'See `f2py -v`'
import copy
from .auxfuncs import (
getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
Reported by Pylint.
Line: 20
Column: 1
f2py_version = 'See `f2py -v`'
import copy
from .auxfuncs import (
getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
isintent_out, islogicalfunction, ismoduleroutine, isscalar,
issubroutine, issubroutine_wrap, outmess, show
Reported by Pylint.
Line: 22
Column: 1
import copy
from .auxfuncs import (
getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in,
isintent_out, islogicalfunction, ismoduleroutine, isscalar,
issubroutine, issubroutine_wrap, outmess, show
)
Reported by Pylint.
Line: 29
Column: 1
)
def var2fixfortran(vars, a, fa=None, f90mode=None):
if fa is None:
fa = a
if a not in vars:
show(vars)
outmess('var2fixfortran: No definition for argument "%s".\n' % a)
Reported by Pylint.
numpy/typing/tests/data/reveal/constants.py
47 issues
Line: 3
Column: 1
import numpy as np
reveal_type(np.Inf) # E: float
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
Reported by Pylint.
Line: 4
Column: 1
import numpy as np
reveal_type(np.Inf) # E: float
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
Reported by Pylint.
Line: 5
Column: 1
reveal_type(np.Inf) # E: float
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
Reported by Pylint.
Line: 6
Column: 1
reveal_type(np.Inf) # E: float
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
Reported by Pylint.
Line: 7
Column: 1
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
Reported by Pylint.
Line: 8
Column: 1
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
reveal_type(np.inf) # E: float
Reported by Pylint.
Line: 9
Column: 1
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
reveal_type(np.inf) # E: float
reveal_type(np.infty) # E: float
Reported by Pylint.
Line: 10
Column: 1
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
reveal_type(np.inf) # E: float
reveal_type(np.infty) # E: float
reveal_type(np.nan) # E: float
Reported by Pylint.
Line: 11
Column: 1
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
reveal_type(np.inf) # E: float
reveal_type(np.infty) # E: float
reveal_type(np.nan) # E: float
reveal_type(np.pi) # E: float
Reported by Pylint.
Line: 12
Column: 1
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E: float
reveal_type(np.euler_gamma) # E: float
reveal_type(np.inf) # E: float
reveal_type(np.infty) # E: float
reveal_type(np.nan) # E: float
reveal_type(np.pi) # E: float
Reported by Pylint.
numpy/typing/__init__.py
46 issues
Line: 150
Column: 5
if TYPE_CHECKING:
# typing_extensions is always available when type-checking
from typing_extensions import Literal as L
_HAS_TYPING_EXTENSIONS: L[True]
else:
try:
import typing_extensions
except ImportError:
Reported by Pylint.
Line: 161
Column: 5
_HAS_TYPING_EXTENSIONS = True
if TYPE_CHECKING:
from typing_extensions import final
else:
def final(f): return f
if not TYPE_CHECKING:
__all__ = ["ArrayLike", "DTypeLike", "NBitBase", "NDArray"]
Reported by Pylint.
Line: 178
Column: 2
__path__: List[str]
@final # Dissallow the creation of arbitrary `NBitBase` subclasses
class NBitBase:
"""
An object representing `numpy.number` precision during static type checking.
Used exclusively for the purpose static type checking, `NBitBase`
Reported by Pylint.
Line: 243
Column: 1
class _16Bit(_32Bit): ... # type: ignore[misc]
class _8Bit(_16Bit): ... # type: ignore[misc]
from ._nbit import (
_NBitByte,
_NBitShort,
_NBitIntC,
_NBitIntP,
_NBitInt,
Reported by Pylint.
Line: 255
Column: 1
_NBitDouble,
_NBitLongDouble,
)
from ._char_codes import (
_BoolCodes,
_UInt8Codes,
_UInt16Codes,
_UInt32Codes,
_UInt64Codes,
Reported by Pylint.
Line: 296
Column: 1
_VoidCodes,
_ObjectCodes,
)
from ._scalars import (
_CharLike_co,
_BoolLike_co,
_UIntLike_co,
_IntLike_co,
_FloatLike_co,
Reported by Pylint.
Line: 308
Column: 1
_ScalarLike_co,
_VoidLike_co,
)
from ._shape import _Shape, _ShapeLike
from ._dtype_like import (
DTypeLike as DTypeLike,
_SupportsDType,
_VoidDTypeLike,
_DTypeLikeBool,
Reported by Pylint.
Line: 309
Column: 1
_VoidLike_co,
)
from ._shape import _Shape, _ShapeLike
from ._dtype_like import (
DTypeLike as DTypeLike,
_SupportsDType,
_VoidDTypeLike,
_DTypeLikeBool,
_DTypeLikeUInt,
Reported by Pylint.
Line: 326
Column: 1
_DTypeLikeBytes,
_DTypeLikeComplex_co,
)
from ._array_like import (
ArrayLike as ArrayLike,
_ArrayLike,
_NestedSequence,
_RecursiveSequence,
_SupportsArray,
Reported by Pylint.
Line: 346
Column: 1
_ArrayLikeStr_co,
_ArrayLikeBytes_co,
)
from ._generic_alias import (
NDArray as NDArray,
_DType,
_GenericAlias,
)
Reported by Pylint.
numpy/lib/tests/test_mixins.py
46 issues
Line: 138
Column: 9
opt_out = OptOut()
# supported operations
assert_(array_like + opt_out is opt_out)
assert_(opt_out + array_like is opt_out)
# not supported
with assert_raises(TypeError):
# don't use the Python default, array_like = array_like + opt_out
Reported by Pylint.
Line: 139
Column: 9
# supported operations
assert_(array_like + opt_out is opt_out)
assert_(opt_out + array_like is opt_out)
# not supported
with assert_raises(TypeError):
# don't use the Python default, array_like = array_like + opt_out
array_like += opt_out
Reported by Pylint.
Line: 146
Column: 13
# don't use the Python default, array_like = array_like + opt_out
array_like += opt_out
with assert_raises(TypeError):
array_like - opt_out
with assert_raises(TypeError):
opt_out - array_like
def test_subclass(self):
Reported by Pylint.
Line: 148
Column: 13
with assert_raises(TypeError):
array_like - opt_out
with assert_raises(TypeError):
opt_out - array_like
def test_subclass(self):
class SubArrayLike(ArrayLike):
"""Should take precedence over ArrayLike."""
Reported by Pylint.
Line: 164
Column: 13
x = ArrayLike(0)
obj = object()
with assert_raises(TypeError):
x + obj
with assert_raises(TypeError):
obj + x
with assert_raises(TypeError):
x += obj
Reported by Pylint.
Line: 166
Column: 13
with assert_raises(TypeError):
x + obj
with assert_raises(TypeError):
obj + x
with assert_raises(TypeError):
x += obj
def test_unary_methods(self):
array = np.array([-1, 0, 1, 2])
Reported by Pylint.
Line: 207
Column: 9
def test_ufunc_at(self):
array = ArrayLike(np.array([1, 2, 3, 4]))
assert_(np.negative.at(array, np.array([0, 1])) is None)
_assert_equal_type_and_value(array, ArrayLike([-1, -2, 3, 4]))
def test_ufunc_two_outputs(self):
mantissa, exponent = np.frexp(2 ** -3)
expected = (ArrayLike(mantissa), ArrayLike(exponent))
Reported by Pylint.
Line: 1
Column: 1
import numbers
import operator
import numpy as np
from numpy.testing import assert_, assert_equal, assert_raises
# NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.
Reported by Pylint.
Line: 11
Column: 1
# NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.
class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
def __init__(self, value):
self.value = np.asarray(value)
# One might also consider adding the built-in list type to this
# list, to support operations like np.add(array_like, list)
Reported by Pylint.
Line: 11
Column: 1
# NOTE: This class should be kept as an exact copy of the example from the
# docstring for NDArrayOperatorsMixin.
class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
def __init__(self, value):
self.value = np.asarray(value)
# One might also consider adding the built-in list type to this
# list, to support operations like np.add(array_like, list)
Reported by Pylint.
numpy/core/tests/test_conversion_utils.py
46 issues
Line: 6
Column: 1
"""
import re
import pytest
import numpy as np
import numpy.core._multiarray_tests as mt
from numpy.testing import assert_warns
Reported by Pylint.
Line: 9
Column: 1
import pytest
import numpy as np
import numpy.core._multiarray_tests as mt
from numpy.testing import assert_warns
class StringConverterTestCase:
allow_bytes = True
Reported by Pylint.
Line: 22
Column: 13
def _check_value_error(self, val):
pattern = r'\(got {}\)'.format(re.escape(repr(val)))
with pytest.raises(ValueError, match=pattern) as exc:
self.conv(val)
def _check_conv_assert_warn(self, val, expected):
if self.warn:
with assert_warns(DeprecationWarning) as exc:
assert self.conv(val) == expected
Reported by Pylint.
Line: 27
Column: 24
def _check_conv_assert_warn(self, val, expected):
if self.warn:
with assert_warns(DeprecationWarning) as exc:
assert self.conv(val) == expected
else:
assert self.conv(val) == expected
def _check(self, val, expected):
"""Takes valid non-deprecated inputs for converters,
Reported by Pylint.
Line: 29
Column: 20
with assert_warns(DeprecationWarning) as exc:
assert self.conv(val) == expected
else:
assert self.conv(val) == expected
def _check(self, val, expected):
"""Takes valid non-deprecated inputs for converters,
runs converters on inputs, checks correctness of outputs,
warnings and errors"""
Reported by Pylint.
Line: 35
Column: 16
"""Takes valid non-deprecated inputs for converters,
runs converters on inputs, checks correctness of outputs,
warnings and errors"""
assert self.conv(val) == expected
if self.allow_bytes:
assert self.conv(val.encode('ascii')) == expected
else:
with pytest.raises(TypeError):
Reported by Pylint.
Line: 38
Column: 20
assert self.conv(val) == expected
if self.allow_bytes:
assert self.conv(val.encode('ascii')) == expected
else:
with pytest.raises(TypeError):
self.conv(val.encode('ascii'))
if len(val) != 1:
Reported by Pylint.
Line: 41
Column: 17
assert self.conv(val.encode('ascii')) == expected
else:
with pytest.raises(TypeError):
self.conv(val.encode('ascii'))
if len(val) != 1:
if self.exact_match:
self._check_value_error(val[:1])
self._check_value_error(val + '\0')
Reported by Pylint.
Line: 64
Column: 13
def test_wrong_type(self):
# common cases which apply to all the below
with pytest.raises(TypeError):
self.conv({})
with pytest.raises(TypeError):
self.conv([])
def test_wrong_value(self):
# nonsense strings
Reported by Pylint.
Line: 66
Column: 13
with pytest.raises(TypeError):
self.conv({})
with pytest.raises(TypeError):
self.conv([])
def test_wrong_value(self):
# nonsense strings
self._check_value_error('')
self._check_value_error('\N{greek small letter pi}')
Reported by Pylint.
numpy/f2py/cb_rules.py
45 issues
Line: 16
Column: 1
Pearu Peterson
"""
from . import __version__
from .auxfuncs import (
applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
isintent_hide, isintent_in, isintent_inout, isintent_nothide,
isintent_out, isoptional, isrequired, isscalar, isstring,
Reported by Pylint.
Line: 17
Column: 1
"""
from . import __version__
from .auxfuncs import (
applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
isintent_hide, isintent_in, isintent_inout, isintent_nothide,
isintent_out, isoptional, isrequired, isscalar, isstring,
isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,
Reported by Pylint.
Line: 25
Column: 1
isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,
stripcomma, throw_error
)
from . import cfuncs
f2py_version = __version__.version
################## Rules for callback function ##############
Reported by Pylint.
Line: 492
Column: 5
def buildcallback(rout, um):
from . import capi_maps
outmess('\tConstructing call-back function "cb_%s_in_%s"\n' %
(rout['name'], um))
args, depargs = getargs(rout)
capi_maps.depargs = depargs
Reported by Pylint.
Line: 33
Column: 1
################## Rules for callback function ##############
cb_routine_rules = {
'cbtypedefs': 'typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);',
'body': """
#begintitle#
typedef struct {
PyObject *capi;
PyTupleObject *args_capi;
Reported by Pylint.
Line: 234
Column: 1
}, { # Function
'decl': ' #ctype# return_value;',
'frompyobj': [{debugcapi: ' CFUNCSMESS("cb:Getting return_value->");'},
' if (capi_j>capi_i)\n GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n");',
{debugcapi:
' fprintf(stderr,"#showvalueformat#.\\n",return_value);'}
],
'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, 'GETSCALARFROMPYTUPLE'],
'return': ' return return_value;',
Reported by Pylint.
Line: 243
Column: 1
'_check': l_and(isfunction, l_not(isstringfunction), l_not(iscomplexfunction))
},
{ # String function
'pyobjfrom': {debugcapi: ' fprintf(stderr,"debug-capi:cb:#name#:%d:\\n",return_value_len);'},
'args': '#ctype# return_value,int return_value_len',
'args_nm': 'return_value,&return_value_len',
'args_td': '#ctype# ,int',
'frompyobj': [{debugcapi: ' CFUNCSMESS("cb:Getting return_value->\\"");'},
""" if (capi_j>capi_i)
Reported by Pylint.
Line: 283
Column: 1
"""\
if (capi_j>capi_i)
#ifdef F2PY_CB_RETURNCOMPLEX
GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#else
GETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#endif
""",
{debugcapi: """
Reported by Pylint.
Line: 285
Column: 1
#ifdef F2PY_CB_RETURNCOMPLEX
GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#else
GETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\");
#endif
""",
{debugcapi: """
#ifdef F2PY_CB_RETURNCOMPLEX
fprintf(stderr,\"#showvalueformat#.\\n\",(return_value).r,(return_value).i);
Reported by Pylint.
Line: 321
Column: 1
'docstropt': {l_and(isoptional, isintent_nothide): '\t\t#pydocsign#'},
'docstrreq': {l_and(isrequired, isintent_nothide): '\t\t#pydocsign#'},
'docstrout': {isintent_out: '\t\t#pydocsignout#'},
'latexdocstropt': {l_and(isoptional, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
{hasnote: '--- #note#'}]},
'latexdocstrreq': {l_and(isrequired, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
{hasnote: '--- #note#'}]},
'latexdocstrout': {isintent_out: ['\\item[]{{}\\verb@#pydocsignout#@{}}',
{l_and(hasnote, isintent_hide): '--- #note#',
Reported by Pylint.
benchmarks/benchmarks/bench_reduce.py
44 issues
Line: 1
Column: 1
from .common import Benchmark, TYPES1, get_squares
import numpy as np
class AddReduce(Benchmark):
def setup(self):
self.squares = get_squares().values()
Reported by Pylint.
Line: 8
Column: 9
class AddReduce(Benchmark):
def setup(self):
self.squares = get_squares().values()
def time_axis_0(self):
[np.add.reduce(a, axis=0) for a in self.squares]
def time_axis_1(self):
Reported by Pylint.
Line: 11
Column: 9
self.squares = get_squares().values()
def time_axis_0(self):
[np.add.reduce(a, axis=0) for a in self.squares]
def time_axis_1(self):
[np.add.reduce(a, axis=1) for a in self.squares]
Reported by Pylint.
Line: 14
Column: 9
[np.add.reduce(a, axis=0) for a in self.squares]
def time_axis_1(self):
[np.add.reduce(a, axis=1) for a in self.squares]
class AddReduceSeparate(Benchmark):
params = [[0, 1], TYPES1]
param_names = ['axis', 'type']
Reported by Pylint.
Line: 21
Column: 21
params = [[0, 1], TYPES1]
param_names = ['axis', 'type']
def setup(self, axis, typename):
self.a = get_squares()[typename]
def time_reduce(self, axis, typename):
np.add.reduce(self.a, axis=axis)
Reported by Pylint.
Line: 22
Column: 9
param_names = ['axis', 'type']
def setup(self, axis, typename):
self.a = get_squares()[typename]
def time_reduce(self, axis, typename):
np.add.reduce(self.a, axis=axis)
Reported by Pylint.
Line: 24
Column: 33
def setup(self, axis, typename):
self.a = get_squares()[typename]
def time_reduce(self, axis, typename):
np.add.reduce(self.a, axis=axis)
class AnyAll(Benchmark):
def setup(self):
Reported by Pylint.
Line: 32
Column: 9
def setup(self):
# avoid np.zeros's lazy allocation that would
# cause page faults during benchmark
self.zeros = np.full(100000, 0, bool)
self.ones = np.full(100000, 1, bool)
def time_all_fast(self):
self.zeros.all()
Reported by Pylint.
Line: 33
Column: 9
# avoid np.zeros's lazy allocation that would
# cause page faults during benchmark
self.zeros = np.full(100000, 0, bool)
self.ones = np.full(100000, 1, bool)
def time_all_fast(self):
self.zeros.all()
def time_all_slow(self):
Reported by Pylint.
Line: 53
Column: 9
param_names = ['dtype']
def setup(self, dtype):
self.d = np.ones(20000, dtype=dtype)
def time_min(self, dtype):
np.min(self.d)
def time_max(self, dtype):
Reported by Pylint.
numpy/core/tests/test_scalar_ctors.py
43 issues
Line: 4
Column: 1
"""
Test the scalar constructors, which also do type-coercion
"""
import pytest
import numpy as np
from numpy.testing import (
assert_equal, assert_almost_equal, assert_warns,
)
Reported by Pylint.
Line: 64
Column: 13
assert np.datetime_data(dt) == ('M', 2)
with pytest.raises(TypeError):
np.datetime64('2000', garbage=True)
def test_bool(self):
with pytest.raises(TypeError):
np.bool_(False, garbage=True)
Reported by Pylint.
Line: 68
Column: 13
def test_bool(self):
with pytest.raises(TypeError):
np.bool_(False, garbage=True)
def test_void(self):
with pytest.raises(TypeError):
np.void(b'test', garbage=True)
Reported by Pylint.
Line: 11
Column: 1
assert_equal, assert_almost_equal, assert_warns,
)
class TestFromString:
def test_floating(self):
# Ticket #640, floats from string
fsingle = np.single('1.234')
fdouble = np.double('1.234')
flongdouble = np.longdouble('1.234')
Reported by Pylint.
Line: 12
Column: 5
)
class TestFromString:
def test_floating(self):
# Ticket #640, floats from string
fsingle = np.single('1.234')
fdouble = np.double('1.234')
flongdouble = np.longdouble('1.234')
assert_almost_equal(fsingle, 1.234)
Reported by Pylint.
Line: 12
Column: 5
)
class TestFromString:
def test_floating(self):
# Ticket #640, floats from string
fsingle = np.single('1.234')
fdouble = np.double('1.234')
flongdouble = np.longdouble('1.234')
assert_almost_equal(fsingle, 1.234)
Reported by Pylint.
Line: 21
Column: 5
assert_almost_equal(fdouble, 1.234)
assert_almost_equal(flongdouble, 1.234)
def test_floating_overflow(self):
""" Strings containing an unrepresentable float overflow """
fhalf = np.half('1e10000')
assert_equal(fhalf, np.inf)
fsingle = np.single('1e10000')
assert_equal(fsingle, np.inf)
Reported by Pylint.
Line: 42
Column: 1
assert_equal(flongdouble, -np.inf)
class TestExtraArgs:
def test_superclass(self):
# try both positional and keyword arguments
s = np.str_(b'\\x61', encoding='unicode-escape')
assert s == 'a'
s = np.str_(b'\\x61', 'unicode-escape')
Reported by Pylint.
Line: 43
Column: 5
class TestExtraArgs:
def test_superclass(self):
# try both positional and keyword arguments
s = np.str_(b'\\x61', encoding='unicode-escape')
assert s == 'a'
s = np.str_(b'\\x61', 'unicode-escape')
assert s == 'a'
Reported by Pylint.
Line: 43
Column: 5
class TestExtraArgs:
def test_superclass(self):
# try both positional and keyword arguments
s = np.str_(b'\\x61', encoding='unicode-escape')
assert s == 'a'
s = np.str_(b'\\x61', 'unicode-escape')
assert s == 'a'
Reported by Pylint.
numpy/typing/tests/data/pass/ufunc_config.py
43 issues
Line: 5
Column: 19
import numpy as np
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
Reported by Pylint.
Line: 5
Column: 11
import numpy as np
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
Reported by Pylint.
Line: 6
Column: 19
import numpy as np
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
Reported by Pylint.
Line: 6
Column: 11
import numpy as np
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
Reported by Pylint.
Line: 6
Column: 27
import numpy as np
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
Reported by Pylint.
Line: 7
Column: 19
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
class Write2:
Reported by Pylint.
Line: 7
Column: 11
def func1(a: str, b: int) -> None: ...
def func2(a: str, b: int, c: float = ...) -> None: ...
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
class Write2:
Reported by Pylint.
Line: 10
Column: 21
def func3(a: str, b: int) -> int: ...
class Write1:
def write(self, a: str) -> None: ...
class Write2:
def write(self, a: str, b: int = ...) -> None: ...
class Write3:
Reported by Pylint.
Line: 13
Column: 21
def write(self, a: str) -> None: ...
class Write2:
def write(self, a: str, b: int = ...) -> None: ...
class Write3:
def write(self, a: str) -> int: ...
Reported by Pylint.
Line: 13
Column: 29
def write(self, a: str) -> None: ...
class Write2:
def write(self, a: str, b: int = ...) -> None: ...
class Write3:
def write(self, a: str) -> int: ...
Reported by Pylint.
tools/swig/test/testFlat.py
43 issues
Line: 14
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Flat
######################################################################
class FlatTestCase(unittest.TestCase):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
import struct
# Import NumPy
import numpy as np
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# System imports
import sys
import unittest
import struct
# Import NumPy
import numpy as np
Reported by Pylint.
Line: 11
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 Flat
######################################################################
Reported by Pylint.
Line: 14
Column: 1
if major == 0: BadListError = TypeError
else: BadListError = ValueError
import Flat
######################################################################
class FlatTestCase(unittest.TestCase):
Reported by Pylint.
Line: 18
Column: 1
######################################################################
class FlatTestCase(unittest.TestCase):
def __init__(self, methodName="runTest"):
unittest.TestCase.__init__(self, methodName)
self.typeStr = "double"
self.typeCode = "d"
Reported by Pylint.
Line: 22
Column: 9
def __init__(self, methodName="runTest"):
unittest.TestCase.__init__(self, methodName)
self.typeStr = "double"
self.typeCode = "d"
# Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
def testProcess1D(self):
"Test Process function 1D array"
Reported by Pylint.
Line: 23
Column: 9
def __init__(self, methodName="runTest"):
unittest.TestCase.__init__(self, methodName)
self.typeStr = "double"
self.typeCode = "d"
# Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
def testProcess1D(self):
"Test Process function 1D array"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
Reported by Pylint.
Line: 26
Column: 5
self.typeCode = "d"
# Test the (type* INPLACE_ARRAY_FLAT, int DIM_FLAT) typemap
def testProcess1D(self):
"Test Process function 1D array"
print(self.typeStr, "... ", end=' ', file=sys.stderr)
process = Flat.__dict__[self.typeStr + "Process"]
pack_output = b''
for i in range(10):
Reported by Pylint.
Line: 33
Column: 9
pack_output = b''
for i in range(10):
pack_output += struct.pack(self.typeCode,i)
x = np.frombuffer(pack_output, dtype=self.typeCode)
y = x.copy()
process(y)
self.assertEqual(np.all((x+1)==y),True)
def testProcess3D(self):
Reported by Pylint.