The following issues were found
numpy/distutils/fcompiler/ibm.py
19 issues
Line: 13
Column: 1
compilers = ['IBMFCompiler']
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
description = 'IBM XL Fortran Compiler'
version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
#IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
Reported by Pylint.
Line: 13
Column: 1
compilers = ['IBMFCompiler']
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
description = 'IBM XL Fortran Compiler'
version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
#IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
Reported by Pylint.
Line: 13
Column: 1
compilers = ['IBMFCompiler']
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
description = 'IBM XL Fortran Compiler'
version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
#IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
Reported by Pylint.
Line: 56
Column: 17
l = [d for d in l if os.path.isfile(os.path.join(xlf_dir, d, 'xlf.cfg'))]
if l:
from distutils.version import LooseVersion
self.version = version = LooseVersion(l[0])
return version
def get_flags(self):
return ['-qextname']
Reported by Pylint.
Line: 1
Column: 1
import os
import re
import sys
import subprocess
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.misc_util import make_temp_file
from distutils import log
Reported by Pylint.
Line: 4
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import re
import sys
import subprocess
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.misc_util import make_temp_file
from distutils import log
Reported by Bandit.
Line: 9
Column: 1
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.misc_util import make_temp_file
from distutils import log
compilers = ['IBMFCompiler']
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
Reported by Pylint.
Line: 13
Column: 1
compilers = ['IBMFCompiler']
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
description = 'IBM XL Fortran Compiler'
version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
#IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
Reported by Pylint.
Line: 16
Column: 1
class IBMFCompiler(FCompiler):
compiler_type = 'ibm'
description = 'IBM XL Fortran Compiler'
version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)'
#IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004
executables = {
'version_cmd' : ["<F77>", "-qversion"],
'compiler_f77' : ["xlf"],
Reported by Pylint.
Line: 38
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
xlf = find_executable('xlf')
if os.path.exists(xlf) and os.path.exists(lslpp):
try:
o = subprocess.check_output([lslpp, '-Lc', 'xlfcmp'])
except (OSError, subprocess.CalledProcessError):
pass
else:
m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o)
if m: version = m.group('version')
Reported by Bandit.
numpy/distutils/unixccompiler.py
19 issues
Line: 16
Column: 44
from numpy.distutils import log
# Note that UnixCCompiler._compile appeared in Python 2.3
def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
"""Compile a single source files with a Unix-style compiler."""
# HP ad-hoc fix, see ticket 1383
ccomp = self.compiler_so
if ccomp[0] == 'aCC':
# remove flags that will trigger ANSI-C mode for aCC
Reported by Pylint.
Line: 31
Column: 3
self.compiler_so = ccomp
# ensure OPT environment variable is read
if 'OPT' in os.environ:
# XXX who uses this?
from sysconfig import get_config_vars
opt = " ".join(os.environ['OPT'].split())
gcv_opt = " ".join(get_config_vars('OPT')[0].split())
ccomp_s = " ".join(self.compiler_so)
if opt not in ccomp_s:
Reported by Pylint.
Line: 73
Column: 54
def UnixCCompiler_create_static_lib(self, objects, output_libname,
output_dir=None, debug=0, target_lang=None):
"""
Build a static library in a separate sub-process.
Parameters
----------
Reported by Pylint.
Line: 73
Column: 63
def UnixCCompiler_create_static_lib(self, objects, output_libname,
output_dir=None, debug=0, target_lang=None):
"""
Build a static library in a separate sub-process.
Parameters
----------
Reported by Pylint.
Line: 97
Column: 27
None
"""
objects, output_dir = self._fix_object_args(objects, output_dir)
output_filename = \
self.library_filename(output_libname, output_dir=output_dir)
if self._need_link(objects, output_filename):
Reported by Pylint.
Line: 102
Column: 8
output_filename = \
self.library_filename(output_libname, output_dir=output_dir)
if self._need_link(objects, output_filename):
try:
# previous .a may be screwed up; best to remove it first
# and recreate.
# Also, ar on OS X doesn't handle updating universal archives
os.unlink(output_filename)
Reported by Pylint.
Line: 7
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
"""
import os
import sys
import subprocess
from distutils.errors import CompileError, DistutilsExecError, LibError
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.ccompiler import replace_method
from numpy.distutils.misc_util import _commandline_dep_string
Reported by Bandit.
Line: 16
Column: 1
from numpy.distutils import log
# Note that UnixCCompiler._compile appeared in Python 2.3
def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
"""Compile a single source files with a Unix-style compiler."""
# HP ad-hoc fix, see ticket 1383
ccomp = self.compiler_so
if ccomp[0] == 'aCC':
# remove flags that will trigger ANSI-C mode for aCC
Reported by Pylint.
Line: 16
Column: 1
from numpy.distutils import log
# Note that UnixCCompiler._compile appeared in Python 2.3
def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
"""Compile a single source files with a Unix-style compiler."""
# HP ad-hoc fix, see ticket 1383
ccomp = self.compiler_so
if ccomp[0] == 'aCC':
# remove flags that will trigger ANSI-C mode for aCC
Reported by Pylint.
Line: 16
Column: 1
from numpy.distutils import log
# Note that UnixCCompiler._compile appeared in Python 2.3
def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
"""Compile a single source files with a Unix-style compiler."""
# HP ad-hoc fix, see ticket 1383
ccomp = self.compiler_so
if ccomp[0] == 'aCC':
# remove flags that will trigger ANSI-C mode for aCC
Reported by Pylint.
numpy/core/_add_newdocs_scalars.py
19 issues
Line: 243
Column: 3
See :ref:`arrays.datetime` for more information.
""")
# TODO: work out how to put this on the base class, np.floating
for float_name in ('half', 'single', 'double', 'longdouble'):
add_newdoc('numpy.core.numerictypes', float_name, ('as_integer_ratio',
"""
{ftype}.as_integer_ratio() -> (int, int)
Reported by Pylint.
Line: 9
Column: 1
from numpy.core import dtype
from numpy.core import numerictypes as _numerictypes
from numpy.core.function_base import add_newdoc
import platform
##############################################################################
#
# Documentation for concrete scalar classes
#
Reported by Pylint.
Line: 17
Column: 1
#
##############################################################################
def numeric_type_aliases(aliases):
def type_aliases_gen():
for alias, doc in aliases:
try:
alias_type = getattr(_numerictypes, alias)
except AttributeError:
Reported by Pylint.
Line: 34
Column: 1
('int8', '8-bit signed integer (``-128`` to ``127``)'),
('int16', '16-bit signed integer (``-32_768`` to ``32_767``)'),
('int32', '32-bit signed integer (``-2_147_483_648`` to ``2_147_483_647``)'),
('int64', '64-bit signed integer (``-9_223_372_036_854_775_808`` to ``9_223_372_036_854_775_807``)'),
('intp', 'Signed integer large enough to fit pointer, compatible with C ``intptr_t``'),
('uint8', '8-bit unsigned integer (``0`` to ``255``)'),
('uint16', '16-bit unsigned integer (``0`` to ``65_535``)'),
('uint32', '32-bit unsigned integer (``0`` to ``4_294_967_295``)'),
('uint64', '64-bit unsigned integer (``0`` to ``18_446_744_073_709_551_615``)'),
Reported by Pylint.
Line: 41
Column: 1
('uint32', '32-bit unsigned integer (``0`` to ``4_294_967_295``)'),
('uint64', '64-bit unsigned integer (``0`` to ``18_446_744_073_709_551_615``)'),
('uintp', 'Unsigned integer large enough to fit pointer, compatible with C ``uintptr_t``'),
('float16', '16-bit-precision floating-point number type: sign bit, 5 bits exponent, 10 bits mantissa'),
('float32', '32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa'),
('float64', '64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa'),
('float96', '96-bit extended-precision floating-point number type'),
('float128', '128-bit extended-precision floating-point number type'),
('complex64', 'Complex number type composed of 2 32-bit-precision floating-point numbers'),
Reported by Pylint.
Line: 42
Column: 1
('uint64', '64-bit unsigned integer (``0`` to ``18_446_744_073_709_551_615``)'),
('uintp', 'Unsigned integer large enough to fit pointer, compatible with C ``uintptr_t``'),
('float16', '16-bit-precision floating-point number type: sign bit, 5 bits exponent, 10 bits mantissa'),
('float32', '32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa'),
('float64', '64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa'),
('float96', '96-bit extended-precision floating-point number type'),
('float128', '128-bit extended-precision floating-point number type'),
('complex64', 'Complex number type composed of 2 32-bit-precision floating-point numbers'),
('complex128', 'Complex number type composed of 2 64-bit-precision floating-point numbers'),
Reported by Pylint.
Line: 43
Column: 1
('uintp', 'Unsigned integer large enough to fit pointer, compatible with C ``uintptr_t``'),
('float16', '16-bit-precision floating-point number type: sign bit, 5 bits exponent, 10 bits mantissa'),
('float32', '32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa'),
('float64', '64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa'),
('float96', '96-bit extended-precision floating-point number type'),
('float128', '128-bit extended-precision floating-point number type'),
('complex64', 'Complex number type composed of 2 32-bit-precision floating-point numbers'),
('complex128', 'Complex number type composed of 2 64-bit-precision floating-point numbers'),
('complex192', 'Complex number type composed of 2 96-bit extended-precision floating-point numbers'),
Reported by Pylint.
Line: 48
Column: 1
('float128', '128-bit extended-precision floating-point number type'),
('complex64', 'Complex number type composed of 2 32-bit-precision floating-point numbers'),
('complex128', 'Complex number type composed of 2 64-bit-precision floating-point numbers'),
('complex192', 'Complex number type composed of 2 96-bit extended-precision floating-point numbers'),
('complex256', 'Complex number type composed of 2 128-bit extended-precision floating-point numbers'),
])
Reported by Pylint.
Line: 49
Column: 1
('complex64', 'Complex number type composed of 2 32-bit-precision floating-point numbers'),
('complex128', 'Complex number type composed of 2 64-bit-precision floating-point numbers'),
('complex192', 'Complex number type composed of 2 96-bit extended-precision floating-point numbers'),
('complex256', 'Complex number type composed of 2 128-bit extended-precision floating-point numbers'),
])
Reported by Pylint.
Line: 55
Column: 1
def add_newdoc_for_scalar_type(obj, fixed_aliases, doc):
# note: `:field: value` is rST syntax which renders as field lists.
o = getattr(_numerictypes, obj)
character_code = dtype(o).char
canonical_name_doc = "" if obj == o.__name__ else ":Canonical name: `numpy.{}`\n ".format(obj)
Reported by Pylint.
tools/allocation_tracking/track_allocations.py
19 issues
Line: 4
Column: 1
import numpy as np
import gc
import inspect
from alloc_hook import NumpyAllocHook
class AllocationTracker:
def __init__(self, threshold=0):
'''track numpy allocations of size threshold bytes or more.'''
Reported by Pylint.
Line: 32
Column: 24
def __enter__(self):
self.numpy_hook.__enter__()
def __exit__(self, type, value, traceback):
self.check_line_changed() # forces pending events to be handled
self.numpy_hook.__exit__()
def hook(self, inptr, outptr, size):
# minimize the chances that the garbage collector kicks in during a
Reported by Pylint.
Line: 77
Column: 16
# then actual code.
try:
return inspect.stack()[4][1:]
except Exception:
return inspect.stack()[0][1:]
def check_line_changed(self):
line = self.get_code_line()
if line != self.current_line and (self.current_line is not None):
Reported by Pylint.
Line: 124
Column: 45
if col == 'lineinfo':
# special handling
try:
filename, line, module, code, index = val
val = "{0}({1}): {2}".format(filename, line, code[index])
except Exception:
# sometimes this info is not available (from eval()?)
val = str(val)
f.write(" <TD>{0}</TD>".format(val))
Reported by Pylint.
Line: 126
Column: 32
try:
filename, line, module, code, index = val
val = "{0}({1}): {2}".format(filename, line, code[index])
except Exception:
# sometimes this info is not available (from eval()?)
val = str(val)
f.write(" <TD>{0}</TD>".format(val))
f.write("\n</TR>\n")
f.write("</TABLE></BODY></HTML>\n")
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import gc
import inspect
from alloc_hook import NumpyAllocHook
class AllocationTracker:
def __init__(self, threshold=0):
'''track numpy allocations of size threshold bytes or more.'''
Reported by Pylint.
Line: 2
Column: 1
import numpy as np
import gc
import inspect
from alloc_hook import NumpyAllocHook
class AllocationTracker:
def __init__(self, threshold=0):
'''track numpy allocations of size threshold bytes or more.'''
Reported by Pylint.
Line: 3
Column: 1
import numpy as np
import gc
import inspect
from alloc_hook import NumpyAllocHook
class AllocationTracker:
def __init__(self, threshold=0):
'''track numpy allocations of size threshold bytes or more.'''
Reported by Pylint.
Line: 6
Column: 1
import inspect
from alloc_hook import NumpyAllocHook
class AllocationTracker:
def __init__(self, threshold=0):
'''track numpy allocations of size threshold bytes or more.'''
self.threshold = threshold
Reported by Pylint.
Line: 36
Column: 5
self.check_line_changed() # forces pending events to be handled
self.numpy_hook.__exit__()
def hook(self, inptr, outptr, size):
# minimize the chances that the garbage collector kicks in during a
# cython __dealloc__ call and causes a double delete of the current
# object. To avoid this fully the hook would have to avoid all python
# api calls, e.g. by being implemented in C like python 3.4's
# tracemalloc module
Reported by Pylint.
numpy/typing/tests/data/reveal/ndarray_shape_manipulation.py
19 issues
Line: 6
Column: 13
nd = np.array([[1, 2], [3, 4]])
# reshape
reveal_type(nd.reshape()) # E: numpy.ndarray
reveal_type(nd.reshape(4)) # E: numpy.ndarray
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
Reported by Pylint.
Line: 6
Column: 1
nd = np.array([[1, 2], [3, 4]])
# reshape
reveal_type(nd.reshape()) # E: numpy.ndarray
reveal_type(nd.reshape(4)) # E: numpy.ndarray
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
Reported by Pylint.
Line: 7
Column: 1
# reshape
reveal_type(nd.reshape()) # E: numpy.ndarray
reveal_type(nd.reshape(4)) # E: numpy.ndarray
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
reveal_type(nd.reshape(4, order="C")) # E: numpy.ndarray
Reported by Pylint.
Line: 8
Column: 1
# reshape
reveal_type(nd.reshape()) # E: numpy.ndarray
reveal_type(nd.reshape(4)) # E: numpy.ndarray
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
reveal_type(nd.reshape(4, order="C")) # E: numpy.ndarray
Reported by Pylint.
Line: 9
Column: 1
reveal_type(nd.reshape()) # E: numpy.ndarray
reveal_type(nd.reshape(4)) # E: numpy.ndarray
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
reveal_type(nd.reshape(4, order="C")) # E: numpy.ndarray
# resize does not return a value
Reported by Pylint.
Line: 11
Column: 1
reveal_type(nd.reshape(2, 2)) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
reveal_type(nd.reshape(4, order="C")) # E: numpy.ndarray
# resize does not return a value
# transpose
Reported by Pylint.
Line: 12
Column: 1
reveal_type(nd.reshape((2, 2))) # E: numpy.ndarray
reveal_type(nd.reshape((2, 2), order="C")) # E: numpy.ndarray
reveal_type(nd.reshape(4, order="C")) # E: numpy.ndarray
# resize does not return a value
# transpose
reveal_type(nd.transpose()) # E: numpy.ndarray
Reported by Pylint.
Line: 17
Column: 1
# resize does not return a value
# transpose
reveal_type(nd.transpose()) # E: numpy.ndarray
reveal_type(nd.transpose(1, 0)) # E: numpy.ndarray
reveal_type(nd.transpose((1, 0))) # E: numpy.ndarray
# swapaxes
reveal_type(nd.swapaxes(0, 1)) # E: numpy.ndarray
Reported by Pylint.
Line: 18
Column: 1
# transpose
reveal_type(nd.transpose()) # E: numpy.ndarray
reveal_type(nd.transpose(1, 0)) # E: numpy.ndarray
reveal_type(nd.transpose((1, 0))) # E: numpy.ndarray
# swapaxes
reveal_type(nd.swapaxes(0, 1)) # E: numpy.ndarray
Reported by Pylint.
Line: 19
Column: 1
# transpose
reveal_type(nd.transpose()) # E: numpy.ndarray
reveal_type(nd.transpose(1, 0)) # E: numpy.ndarray
reveal_type(nd.transpose((1, 0))) # E: numpy.ndarray
# swapaxes
reveal_type(nd.swapaxes(0, 1)) # E: numpy.ndarray
# flatten
Reported by Pylint.
tools/npy_tempita/_looper.py
19 issues
Line: 21
Column: 1
"""
import sys
from .compat3 import basestring_
__all__ = ['looper']
class looper:
Reported by Pylint.
Line: 20
Column: 1
3 c
"""
import sys
from .compat3 import basestring_
__all__ = ['looper']
Reported by Pylint.
Line: 26
Column: 1
__all__ = ['looper']
class looper:
"""
Helper for looping (particularly in templates)
Use this like::
Reported by Pylint.
Line: 48
Column: 1
self.__class__.__name__, self.seq)
class looper_iter:
def __init__(self, seq):
self.seq = list(seq)
self.pos = 0
Reported by Pylint.
Line: 48
Column: 1
self.__class__.__name__, self.seq)
class looper_iter:
def __init__(self, seq):
self.seq = list(seq)
self.pos = 0
Reported by Pylint.
Line: 65
Column: 1
return result
class loop_pos:
def __init__(self, seq, pos):
self.seq = seq
self.pos = pos
Reported by Pylint.
Line: 65
Column: 1
return result
class loop_pos:
def __init__(self, seq, pos):
self.seq = seq
self.pos = pos
Reported by Pylint.
Line: 76
Column: 5
self.seq[self.pos], self.pos)
@property
def index(self):
return self.pos
@property
def number(self):
return self.pos + 1
Reported by Pylint.
Line: 80
Column: 5
return self.pos
@property
def number(self):
return self.pos + 1
@property
def item(self):
return self.seq[self.pos]
Reported by Pylint.
Line: 84
Column: 5
return self.pos + 1
@property
def item(self):
return self.seq[self.pos]
@property
def __next__(self):
try:
Reported by Pylint.
numpy/core/_dtype.py
19 issues
Line: 27
Column: 5
def _kind_name(dtype):
try:
return _kind_to_stem[dtype.kind]
except KeyError as e:
raise RuntimeError(
"internal dtype error, unknown kind {!r}"
.format(dtype.kind)
) from None
Reported by Pylint.
Line: 170
Column: 3
if byteorder == '=':
return native.byteorder
if byteorder == 'S':
# TODO: this path can never be reached
return swapped.byteorder
elif byteorder == '|':
return ''
else:
return byteorder
Reported by Pylint.
Line: 179
Column: 3
def _datetime_metadata_str(dtype):
# TODO: this duplicates the C metastr_to_unicode functionality
unit, count = np.datetime_data(dtype)
if unit == 'generic':
return ''
elif count == 1:
return '[{}]'.format(unit)
Reported by Pylint.
Line: 247
Column: 32
"""
total_offset = 0
for name in dtype.names:
fld_dtype, fld_offset, title = _unpack_field(*dtype.fields[name])
if fld_offset != total_offset:
return False
total_offset += fld_dtype.itemsize
if total_offset != dtype.itemsize:
return False
Reported by Pylint.
Line: 259
Column: 20
def _struct_list_str(dtype):
items = []
for name in dtype.names:
fld_dtype, fld_offset, title = _unpack_field(*dtype.fields[name])
item = "("
if title is not None:
item += "({!r}, {!r}), ".format(title, name)
else:
Reported by Pylint.
Line: 27
Column: 5
def _kind_name(dtype):
try:
return _kind_to_stem[dtype.kind]
except KeyError as e:
raise RuntimeError(
"internal dtype error, unknown kind {!r}"
.format(dtype.kind)
) from None
Reported by Pylint.
Line: 35
Column: 5
def __str__(dtype):
if dtype.fields is not None:
return _struct_str(dtype, include_align=True)
elif dtype.subdtype:
return _subarray_str(dtype)
elif issubclass(dtype.type, np.flexible) or not dtype.isnative:
return dtype.str
Reported by Pylint.
Line: 95
Column: 5
mode is intended for a full 'repr', where the 'align=True' is
provided as the second parameter.
"""
if dtype.fields is not None:
return _struct_str(dtype, include_align=include_align)
elif dtype.subdtype:
return _subarray_str(dtype)
else:
return _scalar_str(dtype, short=short)
Reported by Pylint.
Line: 103
Column: 1
return _scalar_str(dtype, short=short)
def _scalar_str(dtype, short):
byteorder = _byte_order_str(dtype)
if dtype.type == np.bool_:
if short:
return "'?'"
Reported by Pylint.
Line: 103
Column: 1
return _scalar_str(dtype, short=short)
def _scalar_str(dtype, short):
byteorder = _byte_order_str(dtype)
if dtype.type == np.bool_:
if short:
return "'?'"
Reported by Pylint.
benchmarks/benchmarks/bench_records.py
19 issues
Line: 1
Column: 1
from .common import Benchmark
import numpy as np
class Records(Benchmark):
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
Reported by Pylint.
Line: 8
Column: 9
class Records(Benchmark):
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
Reported by Pylint.
Line: 9
Column: 9
class Records(Benchmark):
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
[
Reported by Pylint.
Line: 10
Column: 9
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
[
('field_{}'.format(i), self.l50.dtype.str)
Reported by Pylint.
Line: 11
Column: 9
self.l50 = np.arange(1000)
self.fields_number = 10000
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
[
('field_{}'.format(i), self.l50.dtype.str)
for i in range(self.fields_number)
Reported by Pylint.
Line: 12
Column: 9
self.fields_number = 10000
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
[
('field_{}'.format(i), self.l50.dtype.str)
for i in range(self.fields_number)
]
Reported by Pylint.
Line: 13
Column: 9
self.arrays = [self.l50 for _ in range(self.fields_number)]
self.formats = [self.l50.dtype.str for _ in range(self.fields_number)]
self.formats_str = ','.join(self.formats)
self.dtype_ = np.dtype(
[
('field_{}'.format(i), self.l50.dtype.str)
for i in range(self.fields_number)
]
)
Reported by Pylint.
Line: 19
Column: 9
for i in range(self.fields_number)
]
)
self.buffer = self.l50.tostring() * self.fields_number
def time_fromarrays_w_dtype(self):
np.core.records.fromarrays(self.arrays, dtype=self.dtype_)
def time_fromarrays_wo_dtype(self):
Reported by Pylint.
Line: 1
Column: 1
from .common import Benchmark
import numpy as np
class Records(Benchmark):
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
Reported by Pylint.
Line: 3
Column: 1
from .common import Benchmark
import numpy as np
class Records(Benchmark):
def setup(self):
self.l50 = np.arange(1000)
self.fields_number = 10000
Reported by Pylint.
numpy/typing/tests/data/fail/ufuncs.py
19 issues
Line: 4
Column: 8
import numpy as np
import numpy.typing as npt
AR_f8: npt.NDArray[np.float64]
np.sin.nin + "foo" # E: Unsupported operand types
np.sin(1, foo="bar") # E: No overload variant
np.abs(None) # E: No overload variant
Reported by Pylint.
Line: 20
Column: 1
np.frexp(AR_f8, out=AR_f8) # E: No overload variant
np.absolute.outer() # E: "None" not callable
np.frexp.outer() # E: "None" not callable
np.divmod.outer() # E: "None" not callable
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
Reported by Pylint.
Line: 20
Column: 1
np.frexp(AR_f8, out=AR_f8) # E: No overload variant
np.absolute.outer() # E: "None" not callable
np.frexp.outer() # E: "None" not callable
np.divmod.outer() # E: "None" not callable
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
Reported by Pylint.
Line: 21
Column: 1
np.absolute.outer() # E: "None" not callable
np.frexp.outer() # E: "None" not callable
np.divmod.outer() # E: "None" not callable
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
Reported by Pylint.
Line: 21
Column: 1
np.absolute.outer() # E: "None" not callable
np.frexp.outer() # E: "None" not callable
np.divmod.outer() # E: "None" not callable
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
Reported by Pylint.
Line: 25
Column: 1
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
np.matmul.reduceat() # E: "None" not callable
np.absolute.reduce() # E: "None" not callable
np.frexp.reduce() # E: "None" not callable
Reported by Pylint.
Line: 25
Column: 1
np.matmul.outer() # E: "None" not callable
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
np.matmul.reduceat() # E: "None" not callable
np.absolute.reduce() # E: "None" not callable
np.frexp.reduce() # E: "None" not callable
Reported by Pylint.
Line: 26
Column: 1
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
np.matmul.reduceat() # E: "None" not callable
np.absolute.reduce() # E: "None" not callable
np.frexp.reduce() # E: "None" not callable
np.divmod.reduce() # E: "None" not callable
Reported by Pylint.
Line: 26
Column: 1
np.absolute.reduceat() # E: "None" not callable
np.frexp.reduceat() # E: "None" not callable
np.divmod.reduceat() # E: "None" not callable
np.matmul.reduceat() # E: "None" not callable
np.absolute.reduce() # E: "None" not callable
np.frexp.reduce() # E: "None" not callable
np.divmod.reduce() # E: "None" not callable
Reported by Pylint.
Line: 30
Column: 1
np.matmul.reduceat() # E: "None" not callable
np.absolute.reduce() # E: "None" not callable
np.frexp.reduce() # E: "None" not callable
np.divmod.reduce() # E: "None" not callable
np.matmul.reduce() # E: "None" not callable
np.absolute.accumulate() # E: "None" not callable
np.frexp.accumulate() # E: "None" not callable
Reported by Pylint.
numpy/typing/tests/data/reveal/lib_version.py
18 issues
Line: 5
Column: 1
version = NumpyVersion("1.8.0")
reveal_type(version.vstring) # E: str
reveal_type(version.version) # E: str
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
Reported by Pylint.
Line: 6
Column: 1
version = NumpyVersion("1.8.0")
reveal_type(version.vstring) # E: str
reveal_type(version.version) # E: str
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
Reported by Pylint.
Line: 7
Column: 1
reveal_type(version.vstring) # E: str
reveal_type(version.version) # E: str
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
Reported by Pylint.
Line: 8
Column: 1
reveal_type(version.vstring) # E: str
reveal_type(version.version) # E: str
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
Reported by Pylint.
Line: 9
Column: 1
reveal_type(version.version) # E: str
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
Reported by Pylint.
Line: 10
Column: 1
reveal_type(version.major) # E: int
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
reveal_type(version < "1.8.0") # E: bool
Reported by Pylint.
Line: 11
Column: 1
reveal_type(version.minor) # E: int
reveal_type(version.bugfix) # E: int
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
reveal_type(version < "1.8.0") # E: bool
reveal_type(version <= version) # E: bool
Reported by Pylint.
Line: 13
Column: 1
reveal_type(version.pre_release) # E: str
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
reveal_type(version < "1.8.0") # E: bool
reveal_type(version <= version) # E: bool
reveal_type(version > version) # E: bool
reveal_type(version >= "1.8.0") # E: bool
Reported by Pylint.
Line: 14
Column: 1
reveal_type(version.is_devversion) # E: bool
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
reveal_type(version < "1.8.0") # E: bool
reveal_type(version <= version) # E: bool
reveal_type(version > version) # E: bool
reveal_type(version >= "1.8.0") # E: bool
Reported by Pylint.
Line: 15
Column: 1
reveal_type(version == version) # E: bool
reveal_type(version != version) # E: bool
reveal_type(version < "1.8.0") # E: bool
reveal_type(version <= version) # E: bool
reveal_type(version > version) # E: bool
reveal_type(version >= "1.8.0") # E: bool
Reported by Pylint.