The following issues were found
numpy/f2py/tests/test_string.py
31 issues
Line: 2
Column: 1
import os
import pytest
import textwrap
from numpy.testing import assert_array_equal
import numpy as np
from . import util
def _path(*a):
Reported by Pylint.
Line: 6
Column: 1
import textwrap
from numpy.testing import assert_array_equal
import numpy as np
from . import util
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
Reported by Pylint.
Line: 1
Column: 1
import os
import pytest
import textwrap
from numpy.testing import assert_array_equal
import numpy as np
from . import util
def _path(*a):
Reported by Pylint.
Line: 3
Column: 1
import os
import pytest
import textwrap
from numpy.testing import assert_array_equal
import numpy as np
from . import util
def _path(*a):
Reported by Pylint.
Line: 13
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestString(util.F2PyTest):
sources = [_path('src', 'string', 'char.f90')]
@pytest.mark.slow
def test_char(self):
strings = np.array(['ab', 'cd', 'ef'], dtype='c').T
Reported by Pylint.
Line: 13
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestString(util.F2PyTest):
sources = [_path('src', 'string', 'char.f90')]
@pytest.mark.slow
def test_char(self):
strings = np.array(['ab', 'cd', 'ef'], dtype='c').T
Reported by Pylint.
Line: 17
Column: 5
sources = [_path('src', 'string', 'char.f90')]
@pytest.mark.slow
def test_char(self):
strings = np.array(['ab', 'cd', 'ef'], dtype='c').T
inp, out = self.module.char_test.change_strings(strings,
strings.shape[1])
assert_array_equal(inp, strings)
expected = strings.copy()
Reported by Pylint.
Line: 27
Column: 1
assert_array_equal(out, expected)
class TestDocStringArguments(util.F2PyTest):
suffix = '.f'
code = """
C FILE: STRING.F
SUBROUTINE FOO(A,B,C,D)
Reported by Pylint.
Line: 27
Column: 1
assert_array_equal(out, expected)
class TestDocStringArguments(util.F2PyTest):
suffix = '.f'
code = """
C FILE: STRING.F
SUBROUTINE FOO(A,B,C,D)
Reported by Pylint.
Line: 54
Column: 5
C END OF FILE STRING.F
"""
def test_example(self):
a = np.array(b'123\0\0')
b = np.array(b'123\0\0')
c = np.array(b'123')
d = np.array(b'123')
Reported by Pylint.
numpy/random/tests/test_extending.py
31 issues
Line: 2
Column: 1
import os
import pytest
import shutil
import subprocess
import sys
import warnings
import numpy as np
try:
Reported by Pylint.
Line: 79
Column: 17
assert so2 is not None
# import the so's without adding the directory to sys.path
from importlib.machinery import ExtensionFileLoader
extending = ExtensionFileLoader('extending', so1).load_module()
extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')
Reported by Pylint.
Line: 80
Column: 31
# import the so's without adding the directory to sys.path
from importlib.machinery import ExtensionFileLoader
extending = ExtensionFileLoader('extending', so1).load_module()
extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')
assert values.shape == (10,)
Reported by Pylint.
Line: 61
Column: 13
# not really part of this test, but it is a convenient place to check
with open(build_dir / 'extending.c') as fid:
txt_to_find = 'NumPy API declarations from "numpy/__init__.pxd"'
for i, line in enumerate(fid):
if txt_to_find in line:
break
else:
assert False, ("Could not find '{}' in C file, "
"wrong pxd used".format(txt_to_find))
Reported by Pylint.
Line: 79
Column: 5
assert so2 is not None
# import the so's without adding the directory to sys.path
from importlib.machinery import ExtensionFileLoader
extending = ExtensionFileLoader('extending', so1).load_module()
extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')
Reported by Pylint.
Line: 79
Column: 17
assert so2 is not None
# import the so's without adding the directory to sys.path
from importlib.machinery import ExtensionFileLoader
extending = ExtensionFileLoader('extending', so1).load_module()
extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')
Reported by Pylint.
Line: 80
Column: 31
# import the so's without adding the directory to sys.path
from importlib.machinery import ExtensionFileLoader
extending = ExtensionFileLoader('extending', so1).load_module()
extending_distributions = ExtensionFileLoader('extending_distributions', so2).load_module()
# actually test the cython c-extension
from numpy.random import PCG64
values = extending_distributions.uniforms_ex(PCG64(0), 10, 'd')
assert values.shape == (10,)
Reported by Pylint.
Line: 91
Column: 5
@pytest.mark.skipif(numba is None or cffi is None,
reason="requires numba and cffi")
def test_numba():
from numpy.random._examples.numba import extending # noqa: F401
@pytest.mark.skipif(cffi is None, reason="requires cffi")
def test_cffi():
from numpy.random._examples.cffi import extending # noqa: F401
Reported by Pylint.
Line: 95
Column: 5
@pytest.mark.skipif(cffi is None, reason="requires cffi")
def test_cffi():
from numpy.random._examples.cffi import extending # noqa: F401
Reported by Pylint.
Line: 1
Column: 1
import os
import pytest
import shutil
import subprocess
import sys
import warnings
import numpy as np
try:
Reported by Pylint.
numpy/distutils/tests/test_ccompiler_opt_conf.py
31 issues
Line: 7
Column: 5
is_standalone = __name__ == '__main__' and __package__ is None
if is_standalone:
sys.path.append(path.abspath(path.join(path.dirname(__file__), "..")))
from ccompiler_opt import CCompilerOpt
else:
from numpy.distutils.ccompiler_opt import CCompilerOpt
arch_compilers = dict(
x86 = ("gcc", "clang", "icc", "iccw", "msvc"),
Reported by Pylint.
Line: 23
Column: 1
class FakeCCompilerOpt(CCompilerOpt):
fake_info = ("arch", "compiler", "extra_args")
def __init__(self, *args, **kwargs):
CCompilerOpt.__init__(self, None, **kwargs)
def dist_compile(self, sources, flags, **kwargs):
return sources
def dist_info(self):
return FakeCCompilerOpt.fake_info
Reported by Pylint.
Line: 25
Column: 1
fake_info = ("arch", "compiler", "extra_args")
def __init__(self, *args, **kwargs):
CCompilerOpt.__init__(self, None, **kwargs)
def dist_compile(self, sources, flags, **kwargs):
return sources
def dist_info(self):
return FakeCCompilerOpt.fake_info
@staticmethod
def dist_log(*args, stderr=False):
Reported by Pylint.
Line: 25
Column: 37
fake_info = ("arch", "compiler", "extra_args")
def __init__(self, *args, **kwargs):
CCompilerOpt.__init__(self, None, **kwargs)
def dist_compile(self, sources, flags, **kwargs):
return sources
def dist_info(self):
return FakeCCompilerOpt.fake_info
@staticmethod
def dist_log(*args, stderr=False):
Reported by Pylint.
Line: 127
Column: 48
continue
raise AssertionError(error_msg + "implies non-exist feature '%s'" % impl)
def test_group(self, error_msg, search_in, feature_name, feature_dict):
if feature_dict.get("disabled") is not None:
return
group = feature_dict.get("group", "")
if not group:
return
Reported by Pylint.
Line: 144
Column: 55
"in option 'group', '%s' already exists as a feature name" % f
)
def test_extra_checks(self, error_msg, search_in, feature_name, feature_dict):
if feature_dict.get("disabled") is not None:
return
extra_checks = feature_dict.get("extra_checks", "")
if not extra_checks:
return
Reported by Pylint.
Line: 1
Column: 1
import unittest
from os import sys, path
is_standalone = __name__ == '__main__' and __package__ is None
if is_standalone:
sys.path.append(path.abspath(path.join(path.dirname(__file__), "..")))
from ccompiler_opt import CCompilerOpt
else:
from numpy.distutils.ccompiler_opt import CCompilerOpt
Reported by Pylint.
Line: 21
Column: 1
narch = ("gcc",)
)
class FakeCCompilerOpt(CCompilerOpt):
fake_info = ("arch", "compiler", "extra_args")
def __init__(self, *args, **kwargs):
CCompilerOpt.__init__(self, None, **kwargs)
def dist_compile(self, sources, flags, **kwargs):
return sources
Reported by Pylint.
Line: 21
Column: 1
narch = ("gcc",)
)
class FakeCCompilerOpt(CCompilerOpt):
fake_info = ("arch", "compiler", "extra_args")
def __init__(self, *args, **kwargs):
CCompilerOpt.__init__(self, None, **kwargs)
def dist_compile(self, sources, flags, **kwargs):
return sources
Reported by Pylint.
Line: 33
Column: 1
def dist_log(*args, stderr=False):
pass
class _TestConfFeatures(FakeCCompilerOpt):
"""A hook to check the sanity of configured features
- before it called by the abstract class '_Feature'
"""
def conf_features_partial(self):
Reported by Pylint.
numpy/core/src/multiarray/dtype_transfer.c
30 issues
Line: 108
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
Py_XDECREF(dst_ref);
/* Move the reference */
NPY_DT_DBG_REFTRACE("move src ref", src_ref);
memcpy(dst, &src_ref, sizeof(src_ref));
/* Set the source reference to NULL */
src_ref = NULL;
memcpy(src, &src_ref, sizeof(src_ref));
src += src_stride;
Reported by FlawFinder.
Line: 111
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
memcpy(dst, &src_ref, sizeof(src_ref));
/* Set the source reference to NULL */
src_ref = NULL;
memcpy(src, &src_ref, sizeof(src_ref));
src += src_stride;
dst += dst_stride;
--N;
}
Reported by FlawFinder.
Line: 138
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* Copy the reference */
NPY_DT_DBG_REFTRACE("copy src ref", src_ref);
memcpy(dst, &src_ref, sizeof(src_ref));
/* Claim the reference */
Py_XINCREF(src_ref);
/* Release the reference in dst */
NPY_DT_DBG_REFTRACE("dec dst ref", dst_ref);
Py_XDECREF(dst_ref);
Reported by FlawFinder.
Line: 216
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
memcpy(&dst_ref, dst, sizeof(dst_ref));
Py_XDECREF(dst_ref);
dst_ref = data->getitem(src, &data->arr_fields);
memcpy(dst, &dst_ref, sizeof(PyObject *));
if (dst_ref == NULL) {
return -1;
}
src += src_stride;
Reported by FlawFinder.
Line: 304
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (res == NULL) {
return NULL;
}
memcpy(res, data, sizeof(*res));
Py_INCREF(res->descr);
return (NpyAuxData *)res;
}
Reported by FlawFinder.
Line: 391
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
npy_intp zero_size = dst_itemsize-src_itemsize;
while (N > 0) {
memcpy(dst, src, src_itemsize);
memset(dst + src_itemsize, 0, zero_size);
src += src_stride;
dst += dst_stride;
--N;
}
Reported by FlawFinder.
Line: 416
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
npy_intp dst_itemsize = context->descriptors[1]->elsize;
while (N > 0) {
memcpy(dst, src, dst_itemsize);
src += src_stride;
dst += dst_stride;
--N;
}
return 0;
Reported by FlawFinder.
Line: 447
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
int i;
while (N > 0) {
memcpy(dst, src, copy_size);
if (zero_size > 0) {
memset(dst + src_itemsize, 0, zero_size);
}
_dst = dst;
for (i=0; i < characters; i++) {
Reported by FlawFinder.
Line: 518
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return NULL;
}
memcpy(newdata, data, sizeof(_wrap_copy_swap_data));
Py_INCREF(newdata->arr);
return (NpyAuxData *)newdata;
}
Reported by FlawFinder.
Line: 616
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return NULL;
}
memcpy(newdata, data, sizeof(_strided_cast_data));
Py_INCREF(newdata->aip);
Py_INCREF(newdata->aop);
return (NpyAuxData *)newdata;
}
Reported by FlawFinder.
numpy/typing/_array_like.py
30 issues
Line: 22
Column: 1
str_,
bytes_,
)
from . import _HAS_TYPING_EXTENSIONS
if sys.version_info >= (3, 8):
from typing import Protocol
elif _HAS_TYPING_EXTENSIONS:
from typing_extensions import Protocol
Reported by Pylint.
Line: 27
Column: 5
if sys.version_info >= (3, 8):
from typing import Protocol
elif _HAS_TYPING_EXTENSIONS:
from typing_extensions import Protocol
_T = TypeVar("_T")
_ScalarType = TypeVar("_ScalarType", bound=generic)
_DType = TypeVar("_DType", bound="dtype[Any]")
_DType_co = TypeVar("_DType_co", covariant=True, bound="dtype[Any]")
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
Line: 5
Column: 1
import sys
from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar, Generic
from numpy import (
ndarray,
dtype,
generic,
bool_,
unsignedinteger,
Reported by Pylint.
numpy/f2py/tests/test_parameter.py
30 issues
Line: 2
Column: 1
import os
import pytest
import numpy as np
from numpy.testing import assert_raises, assert_equal
from . import util
Reported by Pylint.
Line: 7
Column: 1
import numpy as np
from numpy.testing import assert_raises, assert_equal
from . import util
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
Reported by Pylint.
Line: 1
Column: 1
import os
import pytest
import numpy as np
from numpy.testing import assert_raises, assert_equal
from . import util
Reported by Pylint.
Line: 14
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestParameters(util.F2PyTest):
# Check that intent(in out) translates as intent(inout)
sources = [_path('src', 'parameter', 'constant_real.f90'),
_path('src', 'parameter', 'constant_integer.f90'),
_path('src', 'parameter', 'constant_both.f90'),
_path('src', 'parameter', 'constant_compound.f90'),
Reported by Pylint.
Line: 24
Column: 5
]
@pytest.mark.slow
def test_constant_real_single(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float32)[::2]
assert_raises(ValueError, self.module.foo_single, x)
# check values with contiguous array
Reported by Pylint.
Line: 26
Column: 9
@pytest.mark.slow
def test_constant_real_single(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float32)[::2]
assert_raises(ValueError, self.module.foo_single, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float32)
self.module.foo_single(x)
Reported by Pylint.
Line: 30
Column: 9
assert_raises(ValueError, self.module.foo_single, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float32)
self.module.foo_single(x)
assert_equal(x, [0 + 1 + 2*3, 1, 2])
@pytest.mark.slow
def test_constant_real_double(self):
Reported by Pylint.
Line: 35
Column: 5
assert_equal(x, [0 + 1 + 2*3, 1, 2])
@pytest.mark.slow
def test_constant_real_double(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float64)[::2]
assert_raises(ValueError, self.module.foo_double, x)
# check values with contiguous array
Reported by Pylint.
Line: 37
Column: 9
@pytest.mark.slow
def test_constant_real_double(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float64)[::2]
assert_raises(ValueError, self.module.foo_double, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float64)
self.module.foo_double(x)
Reported by Pylint.
Line: 41
Column: 9
assert_raises(ValueError, self.module.foo_double, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float64)
self.module.foo_double(x)
assert_equal(x, [0 + 1 + 2*3, 1, 2])
@pytest.mark.slow
def test_constant_compound_int(self):
Reported by Pylint.
numpy/lib/tests/test_ufunclike.py
30 issues
Line: 60
Column: 43
res.metadata = metadata
return res
def __array_wrap__(self, obj, context=None):
if isinstance(obj, MyArray):
obj.metadata = self.metadata
return obj
def __array_finalize__(self, obj):
Reported by Pylint.
Line: 60
Column: 13
res.metadata = metadata
return res
def __array_wrap__(self, obj, context=None):
if isinstance(obj, MyArray):
obj.metadata = self.metadata
return obj
def __array_finalize__(self, obj):
Reported by Pylint.
Line: 66
Column: 17
return obj
def __array_finalize__(self, obj):
self.metadata = getattr(obj, 'metadata', None)
return self
a = nx.array([1.1, -1.1])
m = MyArray(a, metadata='foo')
f = ufl.fix(m)
Reported by Pylint.
Line: 73
Column: 9
m = MyArray(a, metadata='foo')
f = ufl.fix(m)
assert_array_equal(f, nx.array([1, -1]))
assert_(isinstance(f, MyArray))
assert_equal(f.metadata, 'foo')
# check 0d arrays don't decay to scalars
m0d = m[0,...]
m0d.metadata = 'bar'
Reported by Pylint.
Line: 80
Column: 9
m0d = m[0,...]
m0d.metadata = 'bar'
f0d = ufl.fix(m0d)
assert_(isinstance(f0d, MyArray))
assert_equal(f0d.metadata, 'bar')
def test_deprecated(self):
# NumPy 1.13.0, 2017-04-26
assert_warns(DeprecationWarning, ufl.fix, [1, 2], y=nx.empty(2))
Reported by Pylint.
Line: 104
Column: 9
out = np.array(0.0)
actual = np.fix(x, out=out)
assert_(actual is out)
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import numpy.core as nx
import numpy.lib.ufunclike as ufl
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_warns, assert_raises
)
class TestUfunclike:
Reported by Pylint.
Line: 9
Column: 1
)
class TestUfunclike:
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array([True, False, False, False, False, False])
Reported by Pylint.
Line: 11
Column: 5
class TestUfunclike:
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array([True, False, False, False, False, False])
res = ufl.isposinf(a)
Reported by Pylint.
Line: 11
Column: 5
class TestUfunclike:
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array([True, False, False, False, False, False])
res = ufl.isposinf(a)
Reported by Pylint.
numpy/typing/tests/data/reveal/ufunc_config.py
30 issues
Line: 10
Column: 1
class Write:
def write(self, value: str) -> None: ...
reveal_type(np.seterr(all=None)) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(divide="ignore")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
Reported by Pylint.
Line: 11
Column: 1
def write(self, value: str) -> None: ...
reveal_type(np.seterr(all=None)) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(divide="ignore")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
Reported by Pylint.
Line: 12
Column: 1
reveal_type(np.seterr(all=None)) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(divide="ignore")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
Reported by Pylint.
Line: 13
Column: 1
reveal_type(np.seterr(all=None)) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(divide="ignore")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
Reported by Pylint.
Line: 14
Column: 1
reveal_type(np.seterr(divide="ignore")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
Reported by Pylint.
Line: 15
Column: 1
reveal_type(np.seterr(over="warn")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(under="call")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
reveal_type(np.seterrcall(func)) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
Reported by Pylint.
Line: 17
Column: 1
reveal_type(np.seterr(invalid="raise")) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
reveal_type(np.seterrcall(func)) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.seterrcall(Write())) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.geterrcall()) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
Reported by Pylint.
Line: 18
Column: 1
reveal_type(np.geterr()) # E: TypedDict('numpy.core._ufunc_config._ErrDict'
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
reveal_type(np.seterrcall(func)) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.seterrcall(Write())) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.geterrcall()) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
Reported by Pylint.
Line: 20
Column: 1
reveal_type(np.setbufsize(4096)) # E: int
reveal_type(np.getbufsize()) # E: int
reveal_type(np.seterrcall(func)) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.seterrcall(Write())) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.geterrcall()) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.errstate(call=func, all="call")) # E: numpy.errstate[def (a: builtins.str, b: builtins.int)]
reveal_type(np.errstate(call=Write(), divide="log", over="log")) # E: numpy.errstate[ufunc_config.Write]
Reported by Pylint.
Line: 21
Column: 1
reveal_type(np.getbufsize()) # E: int
reveal_type(np.seterrcall(func)) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.seterrcall(Write())) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.geterrcall()) # E: Union[None, def (builtins.str, builtins.int) -> Any, numpy.core._ufunc_config._SupportsWrite]
reveal_type(np.errstate(call=func, all="call")) # E: numpy.errstate[def (a: builtins.str, b: builtins.int)]
reveal_type(np.errstate(call=Write(), divide="log", over="log")) # E: numpy.errstate[ufunc_config.Write]
Reported by Pylint.
numpy/distutils/tests/test_misc_util.py
30 issues
Line: 55
Column: 9
def test_gpaths(self):
local_path = minrelpath(join(dirname(__file__), '..'))
ls = gpaths('command/*.py', local_path)
assert_(join(local_path, 'command', 'build_src.py') in ls, repr(ls))
f = gpaths('system_info.py', local_path)
assert_(join(local_path, 'system_info.py') == f[0], repr(f))
class TestSharedExtension:
Reported by Pylint.
Line: 57
Column: 9
ls = gpaths('command/*.py', local_path)
assert_(join(local_path, 'command', 'build_src.py') in ls, repr(ls))
f = gpaths('system_info.py', local_path)
assert_(join(local_path, 'system_info.py') == f[0], repr(f))
class TestSharedExtension:
def test_get_shared_lib_extension(self):
import sys
Reported by Pylint.
Line: 73
Column: 9
elif sys.platform.startswith('win'):
assert_equal(ext, '.dll')
# just check for no crash
assert_(get_shared_lib_extension(is_python_ext=True))
def test_installed_npymath_ini():
# Regression test for gh-7707. If npymath.ini wasn't installed, then this
# will give an error.
Reported by Pylint.
Line: 1
Column: 1
from os.path import join, sep, dirname
from numpy.distutils.misc_util import (
appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info
)
from numpy.testing import (
assert_, assert_equal
)
Reported by Pylint.
Line: 12
Column: 1
ajoin = lambda *paths: join(*((sep,)+paths))
class TestAppendpath:
def test_1(self):
assert_equal(appendpath('prefix', 'name'), join('prefix', 'name'))
assert_equal(appendpath('/prefix', 'name'), ajoin('prefix', 'name'))
assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
Reported by Pylint.
Line: 14
Column: 5
class TestAppendpath:
def test_1(self):
assert_equal(appendpath('prefix', 'name'), join('prefix', 'name'))
assert_equal(appendpath('/prefix', 'name'), ajoin('prefix', 'name'))
assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
assert_equal(appendpath('prefix', '/name'), join('prefix', 'name'))
Reported by Pylint.
Line: 14
Column: 5
class TestAppendpath:
def test_1(self):
assert_equal(appendpath('prefix', 'name'), join('prefix', 'name'))
assert_equal(appendpath('/prefix', 'name'), ajoin('prefix', 'name'))
assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
assert_equal(appendpath('prefix', '/name'), join('prefix', 'name'))
Reported by Pylint.
Line: 20
Column: 5
assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
assert_equal(appendpath('prefix', '/name'), join('prefix', 'name'))
def test_2(self):
assert_equal(appendpath('prefix/sub', 'name'),
join('prefix', 'sub', 'name'))
assert_equal(appendpath('prefix/sub', 'sup/name'),
join('prefix', 'sub', 'sup', 'name'))
assert_equal(appendpath('/prefix/sub', '/prefix/name'),
Reported by Pylint.
Line: 20
Column: 5
assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
assert_equal(appendpath('prefix', '/name'), join('prefix', 'name'))
def test_2(self):
assert_equal(appendpath('prefix/sub', 'name'),
join('prefix', 'sub', 'name'))
assert_equal(appendpath('prefix/sub', 'sup/name'),
join('prefix', 'sub', 'sup', 'name'))
assert_equal(appendpath('/prefix/sub', '/prefix/name'),
Reported by Pylint.
Line: 28
Column: 5
assert_equal(appendpath('/prefix/sub', '/prefix/name'),
ajoin('prefix', 'sub', 'name'))
def test_3(self):
assert_equal(appendpath('/prefix/sub', '/prefix/sup/name'),
ajoin('prefix', 'sub', 'sup', 'name'))
assert_equal(appendpath('/prefix/sub/sub2', '/prefix/sup/sup2/name'),
ajoin('prefix', 'sub', 'sub2', 'sup', 'sup2', 'name'))
assert_equal(appendpath('/prefix/sub/sub2', '/prefix/sub/sup/name'),
Reported by Pylint.
numpy/typing/tests/data/reveal/einsumfunc.py
29 issues
Line: 11
Column: 8
AR_LIKE_c: List[complex]
AR_LIKE_U: List[str]
OUT_f: np.ndarray[Any, np.dtype[np.float64]]
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
Reported by Pylint.
Line: 13
Column: 1
OUT_f: np.ndarray[Any, np.dtype[np.float64]]
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
Reported by Pylint.
Line: 14
Column: 1
OUT_f: np.ndarray[Any, np.dtype[np.float64]]
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
Reported by Pylint.
Line: 15
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
Reported by Pylint.
Line: 16
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
Reported by Pylint.
Line: 17
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
Reported by Pylint.
Line: 18
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_i, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Any
Reported by Pylint.
Line: 19
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe")) # E: Any
Reported by Pylint.
Line: 21
Column: 1
reveal_type(np.einsum("i,i->i", AR_LIKE_b, AR_LIKE_i)) # E: Any
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe")) # E: Any
reveal_type(np.einsum_path("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Tuple[builtins.list[Any], builtins.str]
Reported by Pylint.
Line: 22
Column: 1
reveal_type(np.einsum("i,i,i,i->i", AR_LIKE_b, AR_LIKE_u, AR_LIKE_i, AR_LIKE_c)) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_c, AR_LIKE_c, out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe", out=OUT_f)) # E: numpy.ndarray[Any, numpy.dtype[{float64}]
reveal_type(np.einsum("i,i->i", AR_LIKE_f, AR_LIKE_f, dtype="c16")) # E: Any
reveal_type(np.einsum("i,i->i", AR_LIKE_U, AR_LIKE_U, dtype=bool, casting="unsafe")) # E: Any
reveal_type(np.einsum_path("i,i->i", AR_LIKE_b, AR_LIKE_b)) # E: Tuple[builtins.list[Any], builtins.str]
reveal_type(np.einsum_path("i,i->i", AR_LIKE_u, AR_LIKE_u)) # E: Tuple[builtins.list[Any], builtins.str]
Reported by Pylint.