The following issues were found
numpy/ma/testutils.py
66 issues
Line: 18
Column: 1
assert_, assert_allclose, assert_array_almost_equal_nulp,
assert_raises, build_err_msg
)
from .core import mask_or, getmask, masked_array, nomask, masked, filled
__all__masked = [
'almost', 'approx', 'assert_almost_equal', 'assert_array_almost_equal',
'assert_array_approx_equal', 'assert_array_compare',
'assert_array_equal', 'assert_array_less', 'assert_close',
Reported by Pylint.
Line: 59
Column: 23
return np.equal(d1, d2).ravel()
x = filled(masked_array(d1, copy=False, mask=m), fill_value).astype(float_)
y = filled(masked_array(d2, copy=False, mask=m), 1).astype(float_)
d = np.less_equal(umath.absolute(x - y), atol + rtol * umath.absolute(y))
return d.ravel()
def almost(a, b, decimal=6, fill_value=True):
"""
Reported by Pylint.
Line: 59
Column: 60
return np.equal(d1, d2).ravel()
x = filled(masked_array(d1, copy=False, mask=m), fill_value).astype(float_)
y = filled(masked_array(d2, copy=False, mask=m), 1).astype(float_)
d = np.less_equal(umath.absolute(x - y), atol + rtol * umath.absolute(y))
return d.ravel()
def almost(a, b, decimal=6, fill_value=True):
"""
Reported by Pylint.
Line: 13
Column: 1
import numpy as np
from numpy import ndarray, float_
import numpy.core.umath as umath
import numpy.testing
from numpy.testing import (
assert_, assert_allclose, assert_array_almost_equal_nulp,
assert_raises, build_err_msg
)
from .core import mask_or, getmask, masked_array, nomask, masked, filled
Reported by Pylint.
Line: 118
Column: 16
if not isinstance(actual, dict):
raise AssertionError(repr(type(actual)))
assert_equal(len(actual), len(desired), err_msg)
for k, i in desired.items():
if k not in actual:
raise AssertionError(f"{k} not in {actual}")
assert_equal(actual[k], desired[k], f'key={k!r}\n{err_msg}')
return
# Case #2: lists .....
Reported by Pylint.
Line: 156
Column: 16
if not isinstance(actual, dict):
raise AssertionError(repr(type(actual)))
fail_if_equal(len(actual), len(desired), err_msg)
for k, i in desired.items():
if k not in actual:
raise AssertionError(repr(k))
fail_if_equal(actual[k], desired[k], f'key={k!r}\n{err_msg}')
return
if isinstance(desired, (list, tuple)) and isinstance(actual, (list, tuple)):
Reported by Pylint.
Line: 285
Column: 9
"""
if m1 is nomask:
assert_(m2 is nomask)
if m2 is nomask:
assert_(m1 is nomask)
assert_array_equal(m1, m2, err_msg=err_msg)
Reported by Pylint.
Line: 287
Column: 9
if m1 is nomask:
assert_(m2 is nomask)
if m2 is nomask:
assert_(m1 is nomask)
assert_array_equal(m1, m2, err_msg=err_msg)
Reported by Pylint.
Line: 32
Column: 1
# have mistakenly included them from this file. SciPy is one. That is
# unfortunate, as some of these functions are not intended to work with
# masked arrays. But there was no way to tell before.
from unittest import TestCase
__some__from_testing = [
'TestCase', 'assert_', 'assert_allclose', 'assert_array_almost_equal_nulp',
'assert_raises'
]
Reported by Pylint.
Line: 32
Column: 1
# have mistakenly included them from this file. SciPy is one. That is
# unfortunate, as some of these functions are not intended to work with
# masked arrays. But there was no way to tell before.
from unittest import TestCase
__some__from_testing = [
'TestCase', 'assert_', 'assert_allclose', 'assert_array_almost_equal_nulp',
'assert_raises'
]
Reported by Pylint.
numpy/distutils/npy_pkg_config.py
66 issues
Line: 244
Column: 20
return VariableSet(d)
def parse_sections(config):
return meta_d, r
def pkg_to_filename(pkg_name):
return "%s.ini" % pkg_name
def parse_config(filename, dirs=None):
Reported by Pylint.
Line: 244
Column: 12
return VariableSet(d)
def parse_sections(config):
return meta_d, r
def pkg_to_filename(pkg_name):
return "%s.ini" % pkg_name
def parse_config(filename, dirs=None):
Reported by Pylint.
Line: 17
Column: 5
Exception thrown when there is a problem parsing a configuration file.
"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
Reported by Pylint.
Line: 25
Column: 5
class PkgNotFound(IOError):
"""Exception raised when a package can not be located."""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
Reported by Pylint.
Line: 53
Column: 5
* 'ignored'
"""
d = {'include_dirs': [], 'library_dirs': [], 'libraries': [],
'macros': [], 'ignored': []}
flags = (' ' + line).split(' -')
for flag in flags:
flag = '-' + flag
Reported by Pylint.
Line: 103
Column: 24
attributes of the same name.
"""
def __init__(self, name, description, version, sections, vars, requires=None):
self.name = name
self.description = description
if requires:
self.requires = requires
else:
Reported by Pylint.
Line: 103
Column: 62
attributes of the same name.
"""
def __init__(self, name, description, version, sections, vars, requires=None):
self.name = name
self.description = description
if requires:
self.requires = requires
else:
Reported by Pylint.
Line: 130
Column: 22
"""
return list(self._sections.keys())
def cflags(self, section="default"):
val = self.vars.interpolate(self._sections[section]['cflags'])
return _escape_backslash(val)
def libs(self, section="default"):
val = self.vars.interpolate(self._sections[section]['libs'])
Reported by Pylint.
Line: 134
Column: 20
val = self.vars.interpolate(self._sections[section]['cflags'])
return _escape_backslash(val)
def libs(self, section="default"):
val = self.vars.interpolate(self._sections[section]['libs'])
return _escape_backslash(val)
def __str__(self):
m = ['Name: %s' % self.name, 'Description: %s' % self.description]
Reported by Pylint.
Line: 139
Column: 9
return _escape_backslash(val)
def __str__(self):
m = ['Name: %s' % self.name, 'Description: %s' % self.description]
if self.requires:
m.append('Requires:')
else:
m.append('Requires: %s' % ",".join(self.requires))
m.append('Version: %s' % self.version)
Reported by Pylint.
numpy/ma/bench.py
65 issues
Line: 14
Column: 6
# Small arrays
xs = numpy.random.uniform(-1, 1, 6).reshape(2, 3)
ys = numpy.random.uniform(-1, 1, 6).reshape(2, 3)
zs = xs + 1j * ys
m1 = [[True, False, False], [False, False, True]]
m2 = [[True, False, True], [False, False, True]]
nmxs = numpy.ma.array(xs, mask=m1)
Reported by Pylint.
Line: 15
Column: 6
# Small arrays
xs = numpy.random.uniform(-1, 1, 6).reshape(2, 3)
ys = numpy.random.uniform(-1, 1, 6).reshape(2, 3)
zs = xs + 1j * ys
m1 = [[True, False, False], [False, False, True]]
m2 = [[True, False, True], [False, False, True]]
nmxs = numpy.ma.array(xs, mask=m1)
nmys = numpy.ma.array(ys, mask=m2)
Reported by Pylint.
Line: 24
Column: 6
nmzs = numpy.ma.array(zs, mask=m1)
# Big arrays
xl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100)
yl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100)
zl = xl + 1j * yl
maskx = xl > 0.8
masky = yl < -0.8
nmxl = numpy.ma.array(xl, mask=maskx)
Reported by Pylint.
Line: 25
Column: 6
# Big arrays
xl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100)
yl = numpy.random.uniform(-1, 1, 100*100).reshape(100, 100)
zl = xl + 1j * yl
maskx = xl > 0.8
masky = yl < -0.8
nmxl = numpy.ma.array(xl, mask=maskx)
nmyl = numpy.ma.array(yl, mask=masky)
Reported by Pylint.
Line: 58
Column: 31
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
Line: 58
Column: 31
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
Line: 58
Column: 49
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
Line: 58
Column: 42
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
Line: 58
Column: 24
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
Line: 58
Column: 24
def compare_functions_1v(func, nloop=500,
xs=xs, nmxs=nmxs, xl=xl, nmxl=nmxl):
funcname = func.__name__
print("-"*50)
print(f'{funcname} on small arrays')
module, data = "numpy.ma", "nmxs"
timer("%(module)s.%(funcname)s(%(data)s)" % locals(), v="%11s" % module, nloop=nloop)
Reported by Pylint.
numpy/typing/tests/data/pass/simple.py
65 issues
Line: 17
Column: 1
ndarray_func(np.array([1, 2]))
array == 1
array.dtype == float
# Dtype construction
np.dtype(float)
np.dtype(np.float64)
Reported by Pylint.
Line: 18
Column: 1
ndarray_func(np.array([1, 2]))
array == 1
array.dtype == float
# Dtype construction
np.dtype(float)
np.dtype(np.float64)
np.dtype(None)
Reported by Pylint.
Line: 51
Column: 1
np.dtype((np.int32, (np.int8, 4)))
# Dtype comparision
np.dtype(float) == float
np.dtype(float) != np.float64
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
Reported by Pylint.
Line: 52
Column: 1
# Dtype comparision
np.dtype(float) == float
np.dtype(float) != np.float64
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
Reported by Pylint.
Line: 53
Column: 1
# Dtype comparision
np.dtype(float) == float
np.dtype(float) != np.float64
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
# Iteration and indexing
Reported by Pylint.
Line: 54
Column: 1
np.dtype(float) == float
np.dtype(float) != np.float64
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
# Iteration and indexing
def iterable_func(x):
Reported by Pylint.
Line: 55
Column: 1
np.dtype(float) != np.float64
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
# Iteration and indexing
def iterable_func(x):
# type: (Iterable) -> Iterable
Reported by Pylint.
Line: 56
Column: 1
np.dtype(float) < None
np.dtype(float) <= "float64"
np.dtype(float) > np.dtype(float)
np.dtype(float) >= np.dtype(("U", 10))
# Iteration and indexing
def iterable_func(x):
# type: (Iterable) -> Iterable
return x
Reported by Pylint.
Line: 65
Column: 1
iterable_func(array)
[element for element in array]
iter(array)
zip(array, array)
array[1]
array[:]
array[...]
Reported by Pylint.
Line: 68
Column: 1
[element for element in array]
iter(array)
zip(array, array)
array[1]
array[:]
array[...]
array[:] = 0
array_2d = np.ones((3, 3))
Reported by Pylint.
numpy/linalg/lapack_lite/make_lite.py
65 issues
Line: 72
Column: 19
def __init__(self, name=None, filename=None):
self.filename = filename
if name is None:
root, ext = os.path.splitext(filename)
name = root
self.name = name
self._dependencies = None
def dependencies(self):
Reported by Pylint.
Line: 341
Column: 5
try:
shutil.rmtree(output_dir)
except:
pass
os.makedirs(output_dir)
wrapped_routines, ignores = getWrappedRoutineNames(wrapped_routines_file)
library = getLapackRoutines(wrapped_routines, ignores, lapack_src_dir)
Reported by Pylint.
Line: 17
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import sys
import os
import re
import subprocess
import shutil
import fortran
import clapack_scrub
Reported by Bandit.
Line: 23
Column: 1
import fortran
import clapack_scrub
from shutil import which
# Arguments to pass to f2c. You'll always want -A for ANSI C prototypes
# Others of interest: -a to not make variables static by default
# -C to check array subscripts
F2C_ARGS = ['-A', '-Nx800']
Reported by Pylint.
Line: 77
Column: 5
self.name = name
self._dependencies = None
def dependencies(self):
if self._dependencies is None:
deps = fortran.getDependencies(self.filename)
self._dependencies = [d.lower() for d in deps]
return self._dependencies
Reported by Pylint.
Line: 86
Column: 1
def __repr__(self):
return f'FortranRoutine({self.name!r}, filename={self.filename!r})'
class UnknownFortranRoutine(FortranRoutine):
"""Wrapper for a Fortran routine for which the corresponding file
is not known.
"""
type = 'unknown'
def __init__(self, name):
Reported by Pylint.
Line: 104
Column: 5
self._src_dirs = src_dirs
self.names_to_routines = {}
def _findRoutine(self, rname):
rname = rname.lower()
for s in self._src_dirs:
ffilename = os.path.join(s, rname + '.f')
if os.path.exists(ffilename):
return self._newFortranRoutine(rname, ffilename)
Reported by Pylint.
Line: 106
Column: 13
def _findRoutine(self, rname):
rname = rname.lower()
for s in self._src_dirs:
ffilename = os.path.join(s, rname + '.f')
if os.path.exists(ffilename):
return self._newFortranRoutine(rname, ffilename)
return UnknownFortranRoutine(rname)
Reported by Pylint.
Line: 112
Column: 5
return self._newFortranRoutine(rname, ffilename)
return UnknownFortranRoutine(rname)
def _newFortranRoutine(self, rname, filename):
return FortranRoutine(rname, filename)
def addIgnorableRoutine(self, rname):
"""Add a routine that we don't want to consider when looking at
dependencies.
Reported by Pylint.
Line: 112
Column: 5
return self._newFortranRoutine(rname, ffilename)
return UnknownFortranRoutine(rname)
def _newFortranRoutine(self, rname, filename):
return FortranRoutine(rname, filename)
def addIgnorableRoutine(self, rname):
"""Add a routine that we don't want to consider when looking at
dependencies.
Reported by Pylint.
numpy/typing/tests/data/reveal/twodim_base.py
65 issues
Line: 9
Column: 45
_SCT = TypeVar("_SCT", bound=np.generic)
def func1(ar: npt.NDArray[_SCT], a: int) -> npt.NDArray[_SCT]:
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
Reported by Pylint.
Line: 9
Column: 15
_SCT = TypeVar("_SCT", bound=np.generic)
def func1(ar: npt.NDArray[_SCT], a: int) -> npt.NDArray[_SCT]:
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
Reported by Pylint.
Line: 13
Column: 55
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
Reported by Pylint.
Line: 13
Column: 15
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
Reported by Pylint.
Line: 13
Column: 27
pass
def func2(ar: npt.NDArray[np.number[Any]], a: str) -> npt.NDArray[np.float64]:
pass
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
Reported by Pylint.
Line: 17
Column: 7
pass
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
AR_i: npt.NDArray[np.int64]
AR_f: npt.NDArray[np.float64]
AR_c: npt.NDArray[np.complex128]
AR_O: npt.NDArray[np.object_]
Reported by Pylint.
Line: 18
Column: 7
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
AR_i: npt.NDArray[np.int64]
AR_f: npt.NDArray[np.float64]
AR_c: npt.NDArray[np.complex128]
AR_O: npt.NDArray[np.object_]
Reported by Pylint.
Line: 19
Column: 7
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
AR_i: npt.NDArray[np.int64]
AR_f: npt.NDArray[np.float64]
AR_c: npt.NDArray[np.complex128]
AR_O: npt.NDArray[np.object_]
AR_LIKE_b: List[bool]
Reported by Pylint.
Line: 20
Column: 7
AR_b: npt.NDArray[np.bool_]
AR_u: npt.NDArray[np.uint64]
AR_i: npt.NDArray[np.int64]
AR_f: npt.NDArray[np.float64]
AR_c: npt.NDArray[np.complex128]
AR_O: npt.NDArray[np.object_]
AR_LIKE_b: List[bool]
Reported by Pylint.
Line: 21
Column: 7
AR_u: npt.NDArray[np.uint64]
AR_i: npt.NDArray[np.int64]
AR_f: npt.NDArray[np.float64]
AR_c: npt.NDArray[np.complex128]
AR_O: npt.NDArray[np.object_]
AR_LIKE_b: List[bool]
reveal_type(np.fliplr(AR_b)) # E: numpy.ndarray[Any, numpy.dtype[numpy.bool_]]
Reported by Pylint.
numpy/__init__.py
65 issues
Line: 112
Column: 1
import sys
import warnings
from ._globals import (
ModuleDeprecationWarning, VisibleDeprecationWarning, _NoValue
)
# We first need to detect if we're being called as part of the numpy setup
# procedure itself in a reliable manner.
Reported by Pylint.
Line: 138
Column: 5
'VisibleDeprecationWarning']
# get the version using versioneer
from ._version import get_versions
vinfo = get_versions()
__version__ = vinfo.get("closest-tag", vinfo["version"])
__git_version__ = vinfo.get("full-revisionid")
del get_versions, vinfo
Reported by Pylint.
Line: 151
Column: 5
from . import _distributor_init
from . import core
from .core import *
from . import compat
from . import lib
# NOTE: to be revisited following future namespace cleanup.
# See gh-14454 and gh-15672 for discussion.
from .lib import *
Reported by Pylint.
Line: 156
Column: 5
from . import lib
# NOTE: to be revisited following future namespace cleanup.
# See gh-14454 and gh-15672 for discussion.
from .lib import *
from . import linalg
from . import fft
from . import polynomial
from . import random
Reported by Pylint.
Line: 164
Column: 5
from . import random
from . import ctypeslib
from . import ma
from . import matrixlib as _mat
from .matrixlib import *
# Deprecations introduced in NumPy 1.20.0, 2020-06-06
import builtins as _builtins
Reported by Pylint.
Line: 165
Column: 5
from . import ctypeslib
from . import ma
from . import matrixlib as _mat
from .matrixlib import *
# Deprecations introduced in NumPy 1.20.0, 2020-06-06
import builtins as _builtins
_msg = (
Reported by Pylint.
Line: 226
Column: 5
del _msg, _specific_msg, _int_extended_msg, _type_info, _builtins
from .core import round, abs, max, min
# now that numpy modules are imported, can initialize limits
core.getlimits._register_known_types()
__all__.extend(['__version__', 'show_config'])
__all__.extend(core.__all__)
Reported by Pylint.
Line: 239
Column: 15
# These are exported by np.core, but are replaced by the builtins below
# remove them to ensure that we don't end up with `np.long == np.int_`,
# which would be a breaking change.
del long, unicode
__all__.remove('long')
__all__.remove('unicode')
# Remove things that are in the numpy.lib but not in the numpy namespace
# Note that there is a test (numpy/tests/test_public_api.py:test_numpy_namespace)
Reported by Pylint.
Line: 239
Column: 9
# These are exported by np.core, but are replaced by the builtins below
# remove them to ensure that we don't end up with `np.long == np.int_`,
# which would be a breaking change.
del long, unicode
__all__.remove('long')
__all__.remove('unicode')
# Remove things that are in the numpy.lib but not in the numpy namespace
# Note that there is a test (numpy/tests/test_public_api.py:test_numpy_namespace)
Reported by Pylint.
Line: 249
Column: 9
# The list below will grow until the `from .lib import *` fixme above is
# taken care of
__all__.remove('Arrayterator')
del Arrayterator
# These names were removed in NumPy 1.20. For at least one release,
# attempts to access these names in the numpy namespace will trigger
# a warning, and calling the function will raise an exception.
_financial_names = ['fv', 'ipmt', 'irr', 'mirr', 'nper', 'npv', 'pmt',
Reported by Pylint.
numpy/core/einsumfunc.py
65 issues
Line: 1377
Column: 16
# Handle order kwarg for output array, c_einsum allows mixed case
output_order = kwargs.pop('order', 'K')
if output_order.upper() == 'A':
if all(arr.flags.f_contiguous for arr in operands):
output_order = 'F'
else:
output_order = 'C'
# Start contraction loop
Reported by Pylint.
Line: 1377
Column: 16
# Handle order kwarg for output array, c_einsum allows mixed case
output_order = kwargs.pop('order', 'K')
if output_order.upper() == 'A':
if all(arr.flags.f_contiguous for arr in operands):
output_order = 'F'
else:
output_order = 'C'
# Start contraction loop
Reported by Pylint.
Line: 355
Column: 5
# Build up a naive cost
contract = _find_contraction(range(len(input_sets)), input_sets, output_set)
idx_result, new_input_sets, idx_removed, idx_contract = contract
naive_cost = _flop_count(idx_contract, idx_removed, len(input_sets), idx_dict)
# Initially iterate over all pairs
comb_iter = itertools.combinations(range(len(input_sets)), 2)
known_contractions = []
Reported by Pylint.
Line: 355
Column: 17
# Build up a naive cost
contract = _find_contraction(range(len(input_sets)), input_sets, output_set)
idx_result, new_input_sets, idx_removed, idx_contract = contract
naive_cost = _flop_count(idx_contract, idx_removed, len(input_sets), idx_dict)
# Initially iterate over all pairs
comb_iter = itertools.combinations(range(len(input_sets)), 2)
known_contractions = []
Reported by Pylint.
Line: 365
Column: 9
path_cost = 0
path = []
for iteration in range(len(input_sets) - 1):
# Iterate over all pairs on first step, only previously found pairs on subsequent steps
for positions in comb_iter:
# Always initially ignore outer products
Reported by Pylint.
Line: 568
Column: 13
tmp_operands = list(operands)
operand_list = []
subscript_list = []
for p in range(len(operands) // 2):
operand_list.append(tmp_operands.pop(0))
subscript_list.append(tmp_operands.pop(0))
output_list = tmp_operands[-1] if len(tmp_operands) else None
operands = [asanyarray(v) for v in operand_list]
Reported by Pylint.
Line: 696
Column: 40
return (input_subscripts, output_subscript, operands)
def _einsum_path_dispatcher(*operands, optimize=None, einsum_call=None):
# NOTE: technically, we should only dispatch on array-like arguments, not
# subscripts (given as strings). But separating operands into
# arrays/subscripts is a little tricky/slow (given einsum's two supported
# signatures), so as a practical shortcut we dispatch on everything.
# Strings will be ignored for dispatching since they don't define
Reported by Pylint.
Line: 696
Column: 55
return (input_subscripts, output_subscript, operands)
def _einsum_path_dispatcher(*operands, optimize=None, einsum_call=None):
# NOTE: technically, we should only dispatch on array-like arguments, not
# subscripts (given as strings). But separating operands into
# arrays/subscripts is a little tricky/slow (given einsum's two supported
# signatures), so as a practical shortcut we dispatch on everything.
# Strings will be ignored for dispatching since they don't define
Reported by Pylint.
Line: 911
Column: 9
elif path_type[0] == 'einsum_path':
path = path_type[1:]
else:
raise KeyError("Path name %s not found", path_type)
cost_list, scale_list, size_list, contraction_list = [], [], [], []
# Build contraction tuple (positions, gemm, einsum_str, remaining)
for cnum, contract_inds in enumerate(path):
Reported by Pylint.
Line: 980
Column: 15
path_print += "-" * 74
for n, contraction in enumerate(contraction_list):
inds, idx_rm, einsum_str, remaining, blas = contraction
remaining_str = ",".join(remaining) + "->" + output_subscript
path_run = (scale_list[n], einsum_str, remaining_str)
path_print += "\n%4d %24s %40s" % path_run
path = ['einsum_path'] + path
Reported by Pylint.
numpy/f2py/f90mod_rules.py
64 issues
Line: 22
Column: 1
import numpy as np
from . import capi_maps
from . import func2subr
from .crackfortran import undo_rmbadname, undo_rmbadname1
# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
Reported by Pylint.
Line: 23
Column: 1
import numpy as np
from . import capi_maps
from . import func2subr
from .crackfortran import undo_rmbadname, undo_rmbadname1
# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.
Reported by Pylint.
Line: 24
Column: 1
from . import capi_maps
from . import func2subr
from .crackfortran import undo_rmbadname, undo_rmbadname1
# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.
from .auxfuncs import *
Reported by Pylint.
Line: 29
Column: 1
# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
# code, it is safest to use import * pending a major refactoring of f2py.
from .auxfuncs import *
options = {}
def findf90modules(m):
Reported by Pylint.
Line: 35
Column: 8
def findf90modules(m):
if ismodule(m):
return [m]
if not hasbody(m):
return []
ret = []
for b in m['body']:
Reported by Pylint.
Line: 37
Column: 12
def findf90modules(m):
if ismodule(m):
return [m]
if not hasbody(m):
return []
ret = []
for b in m['body']:
if ismodule(b):
ret.append(b)
Reported by Pylint.
Line: 41
Column: 12
return []
ret = []
for b in m['body']:
if ismodule(b):
ret.append(b)
else:
ret = ret + findf90modules(b)
return ret
Reported by Pylint.
Line: 88
Column: 5
def buildhooks(pymod):
from . import rules
ret = {'f90modhooks': [], 'initf90modhooks': [], 'body': [],
'need': ['F_FUNC', 'arrayobject.h'],
'separatorsfor': {'includes0': '\n', 'includes': '\n'},
'docs': ['"Fortran 90/95 modules:\\n"'],
'latexdoc': []}
Reported by Pylint.
Line: 108
Column: 12
sargsp = []
ifargs = []
mfargs = []
if hasbody(m):
for b in m['body']:
notvars.append(b['name'])
for n in m['vars'].keys():
var = m['vars'][n]
if (n not in notvars) and (not l_or(isintent_hide, isprivate)(var)):
Reported by Pylint.
Line: 113
Column: 44
notvars.append(b['name'])
for n in m['vars'].keys():
var = m['vars'][n]
if (n not in notvars) and (not l_or(isintent_hide, isprivate)(var)):
onlyvars.append(n)
mfargs.append(n)
outmess('\t\tConstructing F90 module support for "%s"...\n' %
(m['name']))
if onlyvars:
Reported by Pylint.
numpy/random/__init__.py
64 issues
Line: 127
Column: 5
"""
__all__ = [
'beta',
'binomial',
'bytes',
'chisquare',
'choice',
'dirichlet',
Reported by Pylint.
Line: 128
Column: 5
"""
__all__ = [
'beta',
'binomial',
'bytes',
'chisquare',
'choice',
'dirichlet',
'exponential',
Reported by Pylint.
Line: 129
Column: 5
__all__ = [
'beta',
'binomial',
'bytes',
'chisquare',
'choice',
'dirichlet',
'exponential',
'f',
Reported by Pylint.
Line: 130
Column: 5
'beta',
'binomial',
'bytes',
'chisquare',
'choice',
'dirichlet',
'exponential',
'f',
'gamma',
Reported by Pylint.
Line: 131
Column: 5
'binomial',
'bytes',
'chisquare',
'choice',
'dirichlet',
'exponential',
'f',
'gamma',
'geometric',
Reported by Pylint.
Line: 132
Column: 5
'bytes',
'chisquare',
'choice',
'dirichlet',
'exponential',
'f',
'gamma',
'geometric',
'get_state',
Reported by Pylint.
Line: 133
Column: 5
'chisquare',
'choice',
'dirichlet',
'exponential',
'f',
'gamma',
'geometric',
'get_state',
'gumbel',
Reported by Pylint.
Line: 134
Column: 5
'choice',
'dirichlet',
'exponential',
'f',
'gamma',
'geometric',
'get_state',
'gumbel',
'hypergeometric',
Reported by Pylint.
Line: 135
Column: 5
'dirichlet',
'exponential',
'f',
'gamma',
'geometric',
'get_state',
'gumbel',
'hypergeometric',
'laplace',
Reported by Pylint.
Line: 136
Column: 5
'exponential',
'f',
'gamma',
'geometric',
'get_state',
'gumbel',
'hypergeometric',
'laplace',
'logistic',
Reported by Pylint.