The following issues were found
numpy/typing/_generic_alias.py
10 issues
Line: 202
Column: 43
# See `_GenericAlias.__eq__`
if sys.version_info >= (3, 9):
_GENERIC_ALIAS_TYPE = (_GenericAlias, types.GenericAlias)
else:
_GENERIC_ALIAS_TYPE = (_GenericAlias,)
ScalarType = TypeVar("ScalarType", bound=np.generic, covariant=True)
Reported by Pylint.
Line: 210
Column: 15
if TYPE_CHECKING:
_DType = np.dtype[ScalarType]
NDArray = np.ndarray[Any, np.dtype[ScalarType]]
elif sys.version_info >= (3, 9):
_DType = types.GenericAlias(np.dtype, (ScalarType,))
NDArray = types.GenericAlias(np.ndarray, (Any, _DType))
else:
_DType = _GenericAlias(np.dtype, (ScalarType,))
Reported by Pylint.
Line: 212
Column: 14
_DType = np.dtype[ScalarType]
NDArray = np.ndarray[Any, np.dtype[ScalarType]]
elif sys.version_info >= (3, 9):
_DType = types.GenericAlias(np.dtype, (ScalarType,))
NDArray = types.GenericAlias(np.ndarray, (Any, _DType))
else:
_DType = _GenericAlias(np.dtype, (ScalarType,))
NDArray = _GenericAlias(np.ndarray, (Any, _DType))
Reported by Pylint.
Line: 213
Column: 15
NDArray = np.ndarray[Any, np.dtype[ScalarType]]
elif sys.version_info >= (3, 9):
_DType = types.GenericAlias(np.dtype, (ScalarType,))
NDArray = types.GenericAlias(np.ndarray, (Any, _DType))
else:
_DType = _GenericAlias(np.dtype, (ScalarType,))
NDArray = _GenericAlias(np.ndarray, (Any, _DType))
Reported by Pylint.
Line: 124
Column: 31
cls = type(self)
return cls, (self.__origin__, self.__args__)
def __mro_entries__(self, bases: Iterable[object]) -> Tuple[type]:
return (self.__origin__,)
def __dir__(self) -> List[str]:
"""Implement ``dir(self)``."""
cls = type(self)
Reported by Pylint.
Line: 139
Column: 13
try:
return super().__getattribute__("_hash")
except AttributeError:
self._hash: int = hash(self.__origin__) ^ hash(self.__args__)
return super().__getattribute__("_hash")
def __instancecheck__(self, obj: object) -> NoReturn:
"""Check if an `obj` is an instance."""
raise TypeError("isinstance() argument 2 cannot be a "
Reported by Pylint.
Line: 1
Column: 1
from __future__ import annotations
import sys
import types
from typing import (
Any,
ClassVar,
FrozenSet,
Generator,
Reported by Pylint.
Line: 29
Column: 5
def _to_str(obj: object) -> str:
"""Helper function for `_GenericAlias.__repr__`."""
if obj is Ellipsis:
return '...'
elif isinstance(obj, type) and not isinstance(obj, _GENERIC_ALIAS_TYPE):
if obj.__module__ == 'builtins':
return obj.__qualname__
else:
Reported by Pylint.
Line: 32
Column: 9
if obj is Ellipsis:
return '...'
elif isinstance(obj, type) and not isinstance(obj, _GENERIC_ALIAS_TYPE):
if obj.__module__ == 'builtins':
return obj.__qualname__
else:
return f'{obj.__module__}.{obj.__qualname__}'
else:
return repr(obj)
Reported by Pylint.
Line: 162
Column: 9
"""Return ``self[key]``."""
key_tup = key if isinstance(key, tuple) else (key,)
if len(self.__parameters__) == 0:
raise TypeError(f"There are no type variables left in {self}")
elif len(key_tup) > len(self.__parameters__):
raise TypeError(f"Too many arguments for {self}")
elif len(key_tup) < len(self.__parameters__):
raise TypeError(f"Too few arguments for {self}")
Reported by Pylint.
numpy/distutils/_shell_utils.py
10 issues
Line: 53
Column: 13
try:
ctypes.windll
except AttributeError:
raise NotImplementedError
# Windows has special parsing rules for the executable (no quotes),
# that we do not care about - insert a dummy element
if not cmd:
return []
Reported by Pylint.
Line: 7
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
"""
import os
import shlex
import subprocess
try:
from shlex import quote
except ImportError:
from pipes import quote
Reported by Bandit.
Line: 43
Column: 5
Note that this is _not_ the behavior of cmd.
"""
@staticmethod
def join(argv):
# note that list2cmdline is specific to the windows syntax
return subprocess.list2cmdline(argv)
@staticmethod
def split(cmd):
Reported by Pylint.
Line: 48
Column: 5
return subprocess.list2cmdline(argv)
@staticmethod
def split(cmd):
import ctypes # guarded import for systems without ctypes
try:
ctypes.windll
except AttributeError:
raise NotImplementedError
Reported by Pylint.
Line: 49
Column: 9
@staticmethod
def split(cmd):
import ctypes # guarded import for systems without ctypes
try:
ctypes.windll
except AttributeError:
raise NotImplementedError
Reported by Pylint.
Line: 61
Column: 9
return []
cmd = 'dummy ' + cmd
CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
CommandLineToArgvW.restype = ctypes.POINTER(ctypes.c_wchar_p)
CommandLineToArgvW.argtypes = (ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int))
nargs = ctypes.c_int()
lpargs = CommandLineToArgvW(cmd, ctypes.byref(nargs))
Reported by Pylint.
Line: 68
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
nargs = ctypes.c_int()
lpargs = CommandLineToArgvW(cmd, ctypes.byref(nargs))
args = [lpargs[i] for i in range(nargs.value)]
assert not ctypes.windll.kernel32.LocalFree(lpargs)
# strip the element we inserted
assert args[0] == "dummy"
return args[1:]
Reported by Bandit.
Line: 71
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert not ctypes.windll.kernel32.LocalFree(lpargs)
# strip the element we inserted
assert args[0] == "dummy"
return args[1:]
class PosixParser:
"""
Reported by Bandit.
Line: 80
Column: 5
The parsing behavior used by `subprocess.call("string", shell=True)` on Posix.
"""
@staticmethod
def join(argv):
return ' '.join(quote(arg) for arg in argv)
@staticmethod
def split(cmd):
return shlex.split(cmd, posix=True)
Reported by Pylint.
Line: 84
Column: 5
return ' '.join(quote(arg) for arg in argv)
@staticmethod
def split(cmd):
return shlex.split(cmd, posix=True)
if os.name == 'nt':
NativeParser = WindowsParser
Reported by Pylint.
tools/functions_missing_types.py
10 issues
Line: 80
Column: 5
def __init__(self):
self.attributes = set()
def visit_FunctionDef(self, node):
if node.name == "__getattr__":
# Not really a module member.
return
self.attributes.add(node.name)
# Do not call self.generic_visit; we are only interested in
Reported by Pylint.
Line: 80
Column: 5
def __init__(self):
self.attributes = set()
def visit_FunctionDef(self, node):
if node.name == "__getattr__":
# Not really a module member.
return
self.attributes.add(node.name)
# Do not call self.generic_visit; we are only interested in
Reported by Pylint.
Line: 89
Column: 5
# top-level functions.
return
def visit_ClassDef(self, node):
if not node.name.startswith("_"):
self.attributes.add(node.name)
return
def visit_AnnAssign(self, node):
Reported by Pylint.
Line: 89
Column: 5
# top-level functions.
return
def visit_ClassDef(self, node):
if not node.name.startswith("_"):
self.attributes.add(node.name)
return
def visit_AnnAssign(self, node):
Reported by Pylint.
Line: 89
Column: 5
# top-level functions.
return
def visit_ClassDef(self, node):
if not node.name.startswith("_"):
self.attributes.add(node.name)
return
def visit_AnnAssign(self, node):
Reported by Pylint.
Line: 94
Column: 5
self.attributes.add(node.name)
return
def visit_AnnAssign(self, node):
self.attributes.add(node.target.id)
def find_missing(module_name):
module_path = os.path.join(
Reported by Pylint.
Line: 94
Column: 5
self.attributes.add(node.name)
return
def visit_AnnAssign(self, node):
self.attributes.add(node.target.id)
def find_missing(module_name):
module_path = os.path.join(
Reported by Pylint.
Line: 98
Column: 1
self.attributes.add(node.target.id)
def find_missing(module_name):
module_path = os.path.join(
NUMPY_ROOT,
module_name.replace(".", os.sep),
"__init__.pyi",
)
Reported by Pylint.
Line: 111
Column: 35
}
if os.path.isfile(module_path):
with open(module_path) as f:
tree = ast.parse(f.read())
ast_visitor = FindAttributes()
ast_visitor.visit(tree)
stubs_attributes = ast_visitor.attributes
else:
Reported by Pylint.
Line: 126
Column: 1
print("\n".join(sorted(missing)))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("module")
args = parser.parse_args()
find_missing(args.module)
Reported by Pylint.
numpy/typing/tests/data/fail/multiarray.py
10 issues
Line: 7
Column: 7
i8: np.int64
AR_b: npt.NDArray[np.bool_]
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_M: npt.NDArray[np.datetime64]
Reported by Pylint.
Line: 8
Column: 8
i8: np.int64
AR_b: npt.NDArray[np.bool_]
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_M: npt.NDArray[np.datetime64]
M: np.datetime64
Reported by Pylint.
Line: 9
Column: 8
AR_b: npt.NDArray[np.bool_]
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_M: npt.NDArray[np.datetime64]
M: np.datetime64
Reported by Pylint.
Line: 10
Column: 8
AR_b: npt.NDArray[np.bool_]
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_M: npt.NDArray[np.datetime64]
M: np.datetime64
AR_LIKE_f: List[float]
Reported by Pylint.
Line: 11
Column: 7
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
AR_f8: npt.NDArray[np.float64]
AR_M: npt.NDArray[np.datetime64]
M: np.datetime64
AR_LIKE_f: List[float]
Reported by Pylint.
Line: 17
Column: 10
AR_LIKE_f: List[float]
def func(a: int) -> None: ...
np.where(AR_b, 1) # E: No overload variant
np.can_cast(AR_f8, 1) # E: incompatible type
Reported by Pylint.
Line: 1
Column: 1
from typing import List
import numpy as np
import numpy.typing as npt
i8: np.int64
AR_b: npt.NDArray[np.bool_]
AR_u1: npt.NDArray[np.uint8]
AR_i8: npt.NDArray[np.int64]
Reported by Pylint.
Line: 17
Column: 27
AR_LIKE_f: List[float]
def func(a: int) -> None: ...
np.where(AR_b, 1) # E: No overload variant
np.can_cast(AR_f8, 1) # E: incompatible type
Reported by Pylint.
Line: 17
Column: 1
AR_LIKE_f: List[float]
def func(a: int) -> None: ...
np.where(AR_b, 1) # E: No overload variant
np.can_cast(AR_f8, 1) # E: incompatible type
Reported by Pylint.
Line: 17
Column: 1
AR_LIKE_f: List[float]
def func(a: int) -> None: ...
np.where(AR_b, 1) # E: No overload variant
np.can_cast(AR_f8, 1) # E: incompatible type
Reported by Pylint.
numpy/tests/test_scripts.py
10 issues
Line: 7
Column: 1
"""
import sys
import os
import pytest
from os.path import join as pathjoin, isfile, dirname
import subprocess
import numpy as np
from numpy.testing import assert_equal
Reported by Pylint.
Line: 8
Column: 1
import sys
import os
import pytest
from os.path import join as pathjoin, isfile, dirname
import subprocess
import numpy as np
from numpy.testing import assert_equal
Reported by Pylint.
Line: 9
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import pytest
from os.path import join as pathjoin, isfile, dirname
import subprocess
import numpy as np
from numpy.testing import assert_equal
is_inplace = isfile(pathjoin(dirname(np.__file__), '..', 'setup.py'))
Reported by Bandit.
Line: 9
Column: 1
import os
import pytest
from os.path import join as pathjoin, isfile, dirname
import subprocess
import numpy as np
from numpy.testing import assert_equal
is_inplace = isfile(pathjoin(dirname(np.__file__), '..', 'setup.py'))
Reported by Pylint.
Line: 17
Column: 1
is_inplace = isfile(pathjoin(dirname(np.__file__), '..', 'setup.py'))
def find_f2py_commands():
if sys.platform == 'win32':
exe_dir = dirname(sys.executable)
if exe_dir.endswith('Scripts'): # virtualenv
return [os.path.join(exe_dir, 'f2py')]
else:
Reported by Pylint.
Line: 20
Column: 9
def find_f2py_commands():
if sys.platform == 'win32':
exe_dir = dirname(sys.executable)
if exe_dir.endswith('Scripts'): # virtualenv
return [os.path.join(exe_dir, 'f2py')]
else:
return [os.path.join(exe_dir, "Scripts", 'f2py')]
else:
# Three scripts are installed in Unix-like systems:
Reported by Pylint.
Line: 38
Column: 1
@pytest.mark.skipif(is_inplace, reason="Cannot test f2py command inplace")
@pytest.mark.xfail(reason="Test is unreliable")
@pytest.mark.parametrize('f2py_cmd', find_f2py_commands())
def test_f2py(f2py_cmd):
# test that we can run f2py script
stdout = subprocess.check_output([f2py_cmd, '-v'])
assert_equal(stdout.strip(), np.__version__.encode('ascii'))
Reported by Pylint.
Line: 40
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
@pytest.mark.parametrize('f2py_cmd', find_f2py_commands())
def test_f2py(f2py_cmd):
# test that we can run f2py script
stdout = subprocess.check_output([f2py_cmd, '-v'])
assert_equal(stdout.strip(), np.__version__.encode('ascii'))
def test_pep338():
stdout = subprocess.check_output([sys.executable, '-mnumpy.f2py', '-v'])
Reported by Bandit.
Line: 44
Column: 1
assert_equal(stdout.strip(), np.__version__.encode('ascii'))
def test_pep338():
stdout = subprocess.check_output([sys.executable, '-mnumpy.f2py', '-v'])
assert_equal(stdout.strip(), np.__version__.encode('ascii'))
Reported by Pylint.
Line: 45
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
def test_pep338():
stdout = subprocess.check_output([sys.executable, '-mnumpy.f2py', '-v'])
assert_equal(stdout.strip(), np.__version__.encode('ascii'))
Reported by Bandit.
numpy/f2py/tests/test_mixed.py
9 issues
Line: 3
Column: 1
import os
import textwrap
import pytest
from numpy.testing import assert_, assert_equal, IS_PYPY
from . import util
def _path(*a):
Reported by Pylint.
Line: 6
Column: 1
import pytest
from numpy.testing import assert_, assert_equal, IS_PYPY
from . import util
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
Reported by Pylint.
Line: 19
Column: 9
_path('src', 'mixed', 'foo_free.f90')]
def test_all(self):
assert_(self.module.bar11() == 11)
assert_(self.module.foo_fixed.bar12() == 12)
assert_(self.module.foo_free.bar13() == 13)
@pytest.mark.xfail(IS_PYPY,
reason="PyPy cannot modify tp_doc after PyType_Ready")
Reported by Pylint.
Line: 20
Column: 9
def test_all(self):
assert_(self.module.bar11() == 11)
assert_(self.module.foo_fixed.bar12() == 12)
assert_(self.module.foo_free.bar13() == 13)
@pytest.mark.xfail(IS_PYPY,
reason="PyPy cannot modify tp_doc after PyType_Ready")
def test_docstring(self):
Reported by Pylint.
Line: 21
Column: 9
def test_all(self):
assert_(self.module.bar11() == 11)
assert_(self.module.foo_fixed.bar12() == 12)
assert_(self.module.foo_free.bar13() == 13)
@pytest.mark.xfail(IS_PYPY,
reason="PyPy cannot modify tp_doc after PyType_Ready")
def test_docstring(self):
expected = textwrap.dedent("""\
Reported by Pylint.
Line: 1
Column: 1
import os
import textwrap
import pytest
from numpy.testing import assert_, assert_equal, IS_PYPY
from . import util
def _path(*a):
Reported by Pylint.
Line: 13
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestMixed(util.F2PyTest):
sources = [_path('src', 'mixed', 'foo.f'),
_path('src', 'mixed', 'foo_fixed.f90'),
_path('src', 'mixed', 'foo_free.f90')]
def test_all(self):
Reported by Pylint.
Line: 18
Column: 5
_path('src', 'mixed', 'foo_fixed.f90'),
_path('src', 'mixed', 'foo_free.f90')]
def test_all(self):
assert_(self.module.bar11() == 11)
assert_(self.module.foo_fixed.bar12() == 12)
assert_(self.module.foo_free.bar13() == 13)
@pytest.mark.xfail(IS_PYPY,
Reported by Pylint.
Line: 25
Column: 5
@pytest.mark.xfail(IS_PYPY,
reason="PyPy cannot modify tp_doc after PyType_Ready")
def test_docstring(self):
expected = textwrap.dedent("""\
a = bar11()
Wrapper for ``bar11``.
Reported by Pylint.
numpy/distutils/tests/test_fcompiler_nagfor.py
9 issues
Line: 22
Column: 13
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 1
Column: 1
from numpy.testing import assert_
import numpy.distutils.fcompiler
nag_version_strings = [('nagfor', 'NAG Fortran Compiler Release '
'6.2(Chiyoda) Build 6200', '6.2'),
('nagfor', 'NAG Fortran Compiler Release '
'6.1(Tozai) Build 6136', '6.1'),
('nagfor', 'NAG Fortran Compiler Release '
'6.0(Hibiya) Build 1021', '6.0'),
Reported by Pylint.
Line: 17
Column: 1
'431,435,437,446,459-460,463,472,494,496,503,508,'
'511,517,529,555,557,565)', '5.1')]
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 17
Column: 1
'431,435,437,446,459-460,463,472,494,496,503,508,'
'511,517,529,555,557,565)', '5.1')]
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 18
Column: 5
'511,517,529,555,557,565)', '5.1')]
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 18
Column: 5
'511,517,529,555,557,565)', '5.1')]
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 19
Column: 19
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 20
Column: 13
class TestNagFCompilerVersions:
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
Line: 21
Column: 13
def test_version_match(self):
for comp, vs, version in nag_version_strings:
fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
v = fc.version_match(vs)
assert_(v == version)
Reported by Pylint.
numpy/distutils/__init__.py
9 issues
Line: 27
Column: 1
from . import ccompiler
from . import unixccompiler
from .npy_pkg_config import *
# If numpy is installed, add distutils.test()
try:
from . import __config__
# Normally numpy is installed if the above import works, but an interrupted
Reported by Pylint.
Line: 24
Column: 1
# Must import local ccompiler ASAP in order to get
# customized CCompiler.spawn effective.
from . import ccompiler
from . import unixccompiler
from .npy_pkg_config import *
# If numpy is installed, add distutils.test()
Reported by Pylint.
Line: 25
Column: 1
# Must import local ccompiler ASAP in order to get
# customized CCompiler.spawn effective.
from . import ccompiler
from . import unixccompiler
from .npy_pkg_config import *
# If numpy is installed, add distutils.test()
try:
Reported by Pylint.
Line: 31
Column: 5
# If numpy is installed, add distutils.test()
try:
from . import __config__
# Normally numpy is installed if the above import works, but an interrupted
# in-place build could also have left a __config__.py. In that case the
# next import may still fail, so keep it inside the try block.
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
Reported by Pylint.
Line: 42
Column: 1
pass
def customized_fcompiler(plat=None, compiler=None):
from numpy.distutils.fcompiler import new_fcompiler
c = new_fcompiler(plat=plat, compiler=compiler)
c.customize()
return c
Reported by Pylint.
Line: 43
Column: 5
def customized_fcompiler(plat=None, compiler=None):
from numpy.distutils.fcompiler import new_fcompiler
c = new_fcompiler(plat=plat, compiler=compiler)
c.customize()
return c
def customized_ccompiler(plat=None, compiler=None, verbose=1):
Reported by Pylint.
Line: 44
Column: 5
def customized_fcompiler(plat=None, compiler=None):
from numpy.distutils.fcompiler import new_fcompiler
c = new_fcompiler(plat=plat, compiler=compiler)
c.customize()
return c
def customized_ccompiler(plat=None, compiler=None, verbose=1):
c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
Reported by Pylint.
Line: 48
Column: 1
c.customize()
return c
def customized_ccompiler(plat=None, compiler=None, verbose=1):
c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
c.customize('')
return c
Reported by Pylint.
Line: 49
Column: 5
return c
def customized_ccompiler(plat=None, compiler=None, verbose=1):
c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
c.customize('')
return c
Reported by Pylint.
numpy/core/_asarray.py
9 issues
Line: 6
Column: 1
`require` fits this category despite its name not matching this pattern.
"""
from .overrides import (
array_function_dispatch,
set_array_function_like_doc,
set_module,
)
from .multiarray import array, asanyarray
Reported by Pylint.
Line: 11
Column: 1
set_array_function_like_doc,
set_module,
)
from .multiarray import array, asanyarray
__all__ = ["require"]
Reported by Pylint.
Line: 18
Column: 40
def _require_dispatcher(a, dtype=None, requirements=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 18
Column: 28
def _require_dispatcher(a, dtype=None, requirements=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 18
Column: 25
def _require_dispatcher(a, dtype=None, requirements=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 18
Column: 1
def _require_dispatcher(a, dtype=None, requirements=None, *, like=None):
return (like,)
@set_array_function_like_doc
@set_module('numpy')
Reported by Pylint.
Line: 24
Column: 1
@set_array_function_like_doc
@set_module('numpy')
def require(a, dtype=None, requirements=None, *, like=None):
"""
Return an ndarray of the provided type that satisfies requirements.
This function is useful to be sure that an array with the correct flags
is returned for passing to compiled code (perhaps through ctypes).
Reported by Pylint.
Line: 108
Column: 5
'W': 'W', 'WRITEABLE': 'W',
'O': 'O', 'OWNDATA': 'O',
'E': 'E', 'ENSUREARRAY': 'E'}
if not requirements:
return asanyarray(a, dtype=dtype)
else:
requirements = {possible_flags[x.upper()] for x in requirements}
if 'E' in requirements:
Reported by Pylint.
Line: 120
Column: 5
subok = True
order = 'A'
if requirements >= {'C', 'F'}:
raise ValueError('Cannot specify both "C" and "F" order')
elif 'F' in requirements:
order = 'F'
requirements.remove('F')
elif 'C' in requirements:
Reported by Pylint.
benchmarks/asv_pip_nopep517.py
9 issues
Line: 10
Column: 18
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
subprocess.run(cmd + sys.argv[1:])
Reported by Pylint.
Line: 9
Column: 8
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
Reported by Pylint.
Line: 15
Column: 1
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
subprocess.run(cmd + sys.argv[1:])
Reported by Pylint.
Line: 4
Column: 1
"""
This file is used by asv_compare.conf.json.tpl.
"""
import subprocess, sys
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
"""
This file is used by asv_compare.conf.json.tpl.
"""
import subprocess, sys
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
Reported by Bandit.
Line: 8
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
# pip ignores '--global-option' when pep517 is enabled therefore we disable it.
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
Reported by Bandit.
Line: 9
Column: 1
cmd = [sys.executable, '-mpip', 'wheel', '--no-use-pep517']
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
Reported by Pylint.
Line: 10
Column: 5
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
output = str(e.output)
if "no such option" in output:
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
subprocess.run(cmd + sys.argv[1:])
Reported by Pylint.
Line: 15
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
print("old version of pip, escape '--no-use-pep517'")
cmd.pop()
subprocess.run(cmd + sys.argv[1:])
Reported by Bandit.