The following issues were found
numpy/lib/scimath.py
23 issues
Line: 240
Column: 12
"""
x = _fix_real_lt_zero(x)
return nx.sqrt(x)
@array_function_dispatch(_unary_dispatcher)
def log(x):
"""
Reported by Pylint.
Line: 338
Column: 12
"""
x = _fix_real_lt_zero(x)
return nx.log10(x)
def _logn_dispatcher(n, x):
return (n, x,)
Reported by Pylint.
Line: 36
Column: 1
"""
import numpy.core.numeric as nx
import numpy.core.numerictypes as nt
from numpy.core.numeric import asarray, any
from numpy.core.overrides import array_function_dispatch
from numpy.lib.type_check import isreal
__all__ = [
Reported by Pylint.
Line: 106
Column: 5
>>> cc
array([1.+0.j, 2.+0.j, 3.+0.j], dtype=complex64)
"""
if issubclass(arr.dtype.type, (nt.single, nt.byte, nt.short, nt.ubyte,
nt.ushort, nt.csingle)):
return arr.astype(nt.csingle)
else:
return arr.astype(nt.cdouble)
Reported by Pylint.
Line: 113
Column: 1
return arr.astype(nt.cdouble)
def _fix_real_lt_zero(x):
"""Convert `x` to complex if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
Reported by Pylint.
Line: 141
Column: 1
return x
def _fix_int_lt_zero(x):
"""Convert `x` to double if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
Reported by Pylint.
Line: 168
Column: 1
return x
def _fix_real_abs_gt_1(x):
"""Convert `x` to complex if it has real components x_i with abs(x_i)>1.
Otherwise, output is just the array version of the input (via asarray).
Parameters
Reported by Pylint.
Line: 195
Column: 1
return x
def _unary_dispatcher(x):
return (x,)
@array_function_dispatch(_unary_dispatcher)
def sqrt(x):
Reported by Pylint.
Line: 200
Column: 1
@array_function_dispatch(_unary_dispatcher)
def sqrt(x):
"""
Compute the square root of x.
For negative input elements, a complex value is returned
(unlike `numpy.sqrt` which returns NaN).
Reported by Pylint.
Line: 244
Column: 1
@array_function_dispatch(_unary_dispatcher)
def log(x):
"""
Compute the natural logarithm of `x`.
Return the "principal value" (for a description of this, see `numpy.log`)
of :math:`log_e(x)`. For real `x > 0`, this is a real number (``log(0)``
Reported by Pylint.
numpy/f2py/__init__.py
22 issues
Line: 11
Column: 1
import subprocess
import os
from . import f2py2e
from . import diagnose
run_main = f2py2e.run_main
main = f2py2e.main
Reported by Pylint.
Line: 12
Column: 1
import os
from . import f2py2e
from . import diagnose
run_main = f2py2e.run_main
main = f2py2e.main
Reported by Pylint.
Line: 18
Column: 1
main = f2py2e.main
def compile(source,
modulename='untitled',
extra_args='',
verbose=True,
source_fn=None,
extension='.f',
Reported by Pylint.
Line: 107
Column: 18
'-c',
'import numpy.f2py as f2py2e;f2py2e.main()'] + args
try:
cp = subprocess.run(c, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except OSError:
# preserve historic status code used by exec_command()
cp = subprocess.CompletedProcess(c, 127, stdout=b'', stderr=b'')
else:
Reported by Pylint.
Line: 180
Column: 13
# Avoid importing things that aren't needed for building
# which might import the main numpy module
if attr == "f2py_testing":
import numpy.f2py.f2py_testing as f2py_testing
return f2py_testing
elif attr == "test":
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
Reported by Pylint.
Line: 184
Column: 13
return f2py_testing
elif attr == "test":
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
return test
else:
raise AttributeError("module {!r} has no attribute "
Reported by Pylint.
Line: 185
Column: 13
elif attr == "test":
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
return test
else:
raise AttributeError("module {!r} has no attribute "
"{!r}".format(__name__, attr))
Reported by Pylint.
Line: 196
Column: 5
return list(globals().keys() | {"f2py_testing", "test"})
else:
from . import f2py_testing
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
Reported by Pylint.
Line: 8
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
__all__ = ['run_main', 'compile', 'get_include']
import sys
import subprocess
import os
from . import f2py2e
from . import diagnose
Reported by Bandit.
Line: 18
Column: 1
main = f2py2e.main
def compile(source,
modulename='untitled',
extra_args='',
verbose=True,
source_fn=None,
extension='.f',
Reported by Pylint.
numpy/distutils/conv_template.py
22 issues
Line: 241
Column: 17
envlist = parse_loop_header(head)
except ValueError as e:
msg = "line %d: %s" % (newline, e)
raise ValueError(msg)
for newenv in envlist :
newenv.update(env)
newcode = parse_string(text, newenv, newlevel, newline)
code.extend(newcode)
suff = astr[oldend:]
Reported by Pylint.
Line: 316
Column: 16
outfile = sys.stdout
else:
fid = open(file, 'r')
(base, ext) = os.path.splitext(file)
newname = base
outfile = open(newname, 'w')
allstr = fid.read()
try:
Reported by Pylint.
Line: 92
Column: 1
global_names = {}
# header placed at the front of head processed file
header =\
"""
/*
*****************************************************************************
** This file was autogenerated from a template DO NOT EDIT!!!! **
** Changes should be made to the original source (.src) file **
Reported by Pylint.
Line: 135
Column: 1
return spanlist
def paren_repl(obj):
torep = obj.group(1)
numrep = obj.group(2)
return ','.join([torep]*int(numrep))
parenrep = re.compile(r"\(([^)]*)\)\*(\d+)")
Reported by Pylint.
Line: 142
Column: 1
parenrep = re.compile(r"\(([^)]*)\)\*(\d+)")
plainrep = re.compile(r"([^*]+)\*(\d+)")
def parse_values(astr):
# replaces all occurrences of '(a,b,c)*4' in astr
# with 'a,b,c,a,b,c,a,b,c,a,b,c'. Empty braces generate
# empty values, i.e., ()*4 yields ',,,'. The result is
# split at ',' and a list of values returned.
astr = parenrep.sub(paren_repl, astr)
Reported by Pylint.
Line: 158
Column: 1
named_re = re.compile(r"#\s*(\w*)\s*=([^#]*)#")
exclude_vars_re = re.compile(r"(\w*)=(\w*)")
exclude_re = re.compile(":exclude:")
def parse_loop_header(loophead) :
"""Find all named replacements in the header
Returns a list of dictionaries, one for each loop iteration,
where each key is a name to be substituted and the corresponding
value is the replacement string.
Reported by Pylint.
Line: 211
Column: 1
return dlist
replace_re = re.compile(r"@(\w+)@")
def parse_string(astr, env, level, line) :
lineno = "#line %d\n" % line
# local function for string replacement, uses env
def replace(match):
name = match.group(1)
Reported by Pylint.
Line: 211
Column: 1
return dlist
replace_re = re.compile(r"@(\w+)@")
def parse_string(astr, env, level, line) :
lineno = "#line %d\n" % line
# local function for string replacement, uses env
def replace(match):
name = match.group(1)
Reported by Pylint.
Line: 239
Column: 13
code.append(replace_re.sub(replace, pref))
try :
envlist = parse_loop_header(head)
except ValueError as e:
msg = "line %d: %s" % (newline, e)
raise ValueError(msg)
for newenv in envlist :
newenv.update(env)
newcode = parse_string(text, newenv, newlevel, newline)
Reported by Pylint.
Line: 254
Column: 1
code.append('\n')
return ''.join(code)
def process_str(astr):
code = [header]
code.extend(parse_string(astr, global_names, 0, 1))
return ''.join(code)
Reported by Pylint.
numpy/linalg/lapack_lite/fortran.py
22 issues
Line: 110
Column: 13
external_pat = re.compile(r'^\s*EXTERNAL\s', re.I)
routines = []
with open(filename) as fo:
for lineno, line in fortranSourceLines(fo):
m = external_pat.match(line)
if m:
names = line[m.end():].strip().split(',')
names = [n.strip().lower() for n in names]
names = [n for n in names if n]
Reported by Pylint.
Line: 1
Column: 1
import re
import itertools
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
Reported by Pylint.
Line: 4
Column: 1
import re
import itertools
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
Reported by Pylint.
Line: 4
Column: 1
import re
import itertools
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
Reported by Pylint.
Line: 6
Column: 1
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
Reported by Pylint.
Line: 6
Column: 1
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
Reported by Pylint.
Line: 8
Column: 1
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1, 2
Reported by Pylint.
Line: 8
Column: 1
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1, 2
Reported by Pylint.
Line: 10
Column: 1
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1, 2
def lineType(line):
"""Return the type of a line of Fortran code."""
Reported by Pylint.
Line: 10
Column: 1
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1, 2
def lineType(line):
"""Return the type of a line of Fortran code."""
Reported by Pylint.
numpy/distutils/tests/test_shell_utils.py
22 issues
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html
return lambda cmd: subprocess.check_output(cmd)
elif Parser == _shell_utils.PosixParser:
# posix has no non-shell string parsing
return lambda cmd: subprocess.check_output(cmd, shell=True)
else:
raise NotImplementedError
@pytest.mark.parametrize('argv', argv_cases)
Reported by Bandit.
Line: 1
Column: 1
import pytest
import subprocess
import json
import sys
from numpy.distutils import _shell_utils
argv_cases = [
[r'exe'],
Reported by Pylint.
Line: 39
Column: 12
@pytest.fixture
def runner(Parser):
if Parser != _shell_utils.NativeParser:
pytest.skip('Unable to run with non-native parser')
if Parser == _shell_utils.WindowsParser:
return lambda cmd: subprocess.check_output(cmd)
Reported by Pylint.
Line: 44
Column: 16
pytest.skip('Unable to run with non-native parser')
if Parser == _shell_utils.WindowsParser:
return lambda cmd: subprocess.check_output(cmd)
elif Parser == _shell_utils.PosixParser:
# posix has no non-shell string parsing
return lambda cmd: subprocess.check_output(cmd, shell=True)
else:
raise NotImplementedError
Reported by Pylint.
Line: 53
Column: 42
@pytest.mark.parametrize('argv', argv_cases)
def test_join_matches_subprocess(Parser, runner, argv):
"""
Test that join produces strings understood by subprocess
"""
# invoke python to return its arguments as json
cmd = [
Reported by Pylint.
Line: 53
Column: 34
@pytest.mark.parametrize('argv', argv_cases)
def test_join_matches_subprocess(Parser, runner, argv):
"""
Test that join produces strings understood by subprocess
"""
# invoke python to return its arguments as json
cmd = [
Reported by Pylint.
Line: 68
Column: 20
@pytest.mark.parametrize('argv', argv_cases)
def test_roundtrip(Parser, argv):
"""
Test that split is the inverse operation of join
"""
try:
joined = Parser.join(argv)
Reported by Pylint.
Line: 1
Column: 1
import pytest
import subprocess
import json
import sys
from numpy.distutils import _shell_utils
argv_cases = [
[r'exe'],
Reported by Pylint.
Line: 2
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import pytest
import subprocess
import json
import sys
from numpy.distutils import _shell_utils
argv_cases = [
[r'exe'],
Reported by Bandit.
Line: 2
Column: 1
import pytest
import subprocess
import json
import sys
from numpy.distutils import _shell_utils
argv_cases = [
[r'exe'],
Reported by Pylint.
numpy/lib/stride_tricks.py
21 issues
Line: 98
Column: 22
"""
# first convert input to array, possibly keeping subclass
x = np.array(x, copy=False, subok=subok)
interface = dict(x.__array_interface__)
if shape is not None:
interface['shape'] = tuple(shape)
if strides is not None:
interface['strides'] = tuple(strides)
Reported by Pylint.
Line: 325
Column: 37
f'axis; got {len(window_shape)} window_shape '
f'elements and {len(axis)} axes elements.')
out_strides = x.strides + tuple(x.strides[ax] for ax in axis)
# note: same axis can be windowed repeatedly
x_shape_trimmed = list(x.shape)
for ax, dim in zip(axis, window_shape):
if x_shape_trimmed[ax] < dim:
Reported by Pylint.
Line: 117
Column: 54
return view
def _sliding_window_view_dispatcher(x, window_shape, axis=None, *,
subok=None, writeable=None):
return (x,)
@array_function_dispatch(_sliding_window_view_dispatcher)
Reported by Pylint.
Line: 117
Column: 40
return view
def _sliding_window_view_dispatcher(x, window_shape, axis=None, *,
subok=None, writeable=None):
return (x,)
@array_function_dispatch(_sliding_window_view_dispatcher)
Reported by Pylint.
Line: 118
Column: 49
def _sliding_window_view_dispatcher(x, window_shape, axis=None, *,
subok=None, writeable=None):
return (x,)
@array_function_dispatch(_sliding_window_view_dispatcher)
def sliding_window_view(x, window_shape, axis=None, *,
Reported by Pylint.
Line: 118
Column: 37
def _sliding_window_view_dispatcher(x, window_shape, axis=None, *,
subok=None, writeable=None):
return (x,)
@array_function_dispatch(_sliding_window_view_dispatcher)
def sliding_window_view(x, window_shape, axis=None, *,
Reported by Pylint.
Line: 356
Column: 25
broadcast = it.itviews[0]
result = _maybe_view_as_subclass(array, broadcast)
# In a future version this will go away
if not readonly and array.flags._writeable_no_warn:
result.flags.writeable = True
result.flags._warn_on_write = True
return result
Reported by Pylint.
Line: 358
Column: 9
# In a future version this will go away
if not readonly and array.flags._writeable_no_warn:
result.flags.writeable = True
result.flags._warn_on_write = True
return result
def _broadcast_to_dispatcher(array, shape, subok=None):
return (array,)
Reported by Pylint.
Line: 362
Column: 37
return result
def _broadcast_to_dispatcher(array, shape, subok=None):
return (array,)
@array_function_dispatch(_broadcast_to_dispatcher, module='numpy')
def broadcast_to(array, shape, subok=False):
Reported by Pylint.
Line: 362
Column: 44
return result
def _broadcast_to_dispatcher(array, shape, subok=None):
return (array,)
@array_function_dispatch(_broadcast_to_dispatcher, module='numpy')
def broadcast_to(array, shape, subok=False):
Reported by Pylint.
doc/cdoc/numpyfilter.py
20 issues
Line: 83
Column: 5
os.rename(CACHE_FILE + '.new', CACHE_FILE)
def render_html(text):
import docutils.parsers.rst
import docutils.writers.html4css1
import docutils.core
docutils.parsers.rst.roles.DEFAULT_INTERPRETED_ROLE = 'title-reference'
writer = docutils.writers.html4css1.Writer()
Reported by Pylint.
Line: 84
Column: 5
def render_html(text):
import docutils.parsers.rst
import docutils.writers.html4css1
import docutils.core
docutils.parsers.rst.roles.DEFAULT_INTERPRETED_ROLE = 'title-reference'
writer = docutils.writers.html4css1.Writer()
parts = docutils.core.publish_parts(
Reported by Pylint.
Line: 85
Column: 5
def render_html(text):
import docutils.parsers.rst
import docutils.writers.html4css1
import docutils.core
docutils.parsers.rst.roles.DEFAULT_INTERPRETED_ROLE = 'title-reference'
writer = docutils.writers.html4css1.Writer()
parts = docutils.core.publish_parts(
text,
Reported by Pylint.
Line: 71
Column: 20
with open(CACHE_FILE, 'rb') as f:
try:
cache = pickle.load(f)
except Exception:
cache = {}
else:
cache = {}
return cache
Reported by Pylint.
Line: 18
Column: 1
CACHE_FILE = 'build/rst-cache.pck'
def main():
import argparse
parser = argparse.ArgumentParser(usage=__doc__.strip())
parser.add_argument('input_file', help='input file')
args = parser.parse_args()
Reported by Pylint.
Line: 19
Column: 5
CACHE_FILE = 'build/rst-cache.pck'
def main():
import argparse
parser = argparse.ArgumentParser(usage=__doc__.strip())
parser.add_argument('input_file', help='input file')
args = parser.parse_args()
Reported by Pylint.
Line: 30
Column: 44
cache = load_cache()
try:
with open(args.input_file, 'r') as f:
text = f.read()
text = comment_re.sub(lambda m: process_match(m, cache), text)
sys.stdout.write(text)
finally:
save_cache(cache)
Reported by Pylint.
Line: 37
Column: 1
finally:
save_cache(cache)
def filter_comment(text):
if text.startswith('NUMPY_API'):
text = text[9:].strip()
if text.startswith('UFUNC_API'):
text = text[9:].strip()
Reported by Pylint.
Line: 46
Column: 1
html = render_html(text)
return html
def process_match(m, cache=None):
pre, rawtext = m.groups()
preline = pre.split("\n")[-1]
if cache is not None and rawtext in cache:
Reported by Pylint.
Line: 46
Column: 1
html = render_html(text)
return html
def process_match(m, cache=None):
pre, rawtext = m.groups()
preline = pre.split("\n")[-1]
if cache is not None and rawtext in cache:
Reported by Pylint.
numpy/typing/tests/test_typing.py
20 issues
Line: 9
Column: 1
from collections import defaultdict
from typing import Optional, IO, Dict, List
import pytest
import numpy as np
from numpy.typing.mypy_plugin import (
_PRECISION_DICT,
_EXTENDED_PRECISION_LIST,
_C_INTP,
Reported by Pylint.
Line: 119
Column: 5
@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
@pytest.mark.parametrize("path", get_test_cases(FAIL_DIR))
def test_fail(path):
__tracebackhide__ = True
with open(path) as fin:
lines = fin.readlines()
errors = defaultdict(lambda: "")
Reported by Pylint.
Line: 165
Column: 16
"""
def _test_fail(path: str, error: str, expected_error: Optional[str], lineno: int) -> None:
if expected_error is None:
raise AssertionError(_FAIL_MSG1.format(lineno, error))
elif error not in expected_error:
raise AssertionError(_FAIL_MSG2.format(lineno, expected_error, error))
Reported by Pylint.
Line: 264
Column: 5
@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
@pytest.mark.parametrize("path", get_test_cases(REVEAL_DIR))
def test_reveal(path):
__tracebackhide__ = True
with open(path) as fin:
lines = _parse_reveals(fin)
output_mypy = OUTPUT_MYPY
Reported by Pylint.
Line: 293
Column: 18
"""
def _test_reveal(path: str, reveal: str, expected_reveal: str, lineno: int) -> None:
if reveal not in expected_reveal:
raise AssertionError(_REVEAL_MSG.format(lineno, expected_reveal, reveal))
@pytest.mark.slow
Reported by Pylint.
Line: 302
Column: 5
@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
@pytest.mark.parametrize("path", get_test_cases(PASS_DIR))
def test_code_runs(path):
path_without_extension, _ = os.path.splitext(path)
dirname, filename = path.split(os.sep)[-2:]
spec = importlib.util.spec_from_file_location(f"{dirname}.{filename}", path)
test_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(test_module)
Reported by Pylint.
Line: 1
Column: 1
import importlib.util
import itertools
import os
import re
import shutil
from collections import defaultdict
from typing import Optional, IO, Dict, List
import pytest
Reported by Pylint.
Line: 88
Column: 1
OUTPUT_MYPY.update((k, list(v)) for k, v in iterator if k)
def get_test_cases(directory):
for root, _, files in os.walk(directory):
for fname in files:
if os.path.splitext(fname)[-1] == ".py":
fullpath = os.path.join(root, fname)
# Use relative path for nice py.test name
Reported by Pylint.
Line: 106
Column: 1
@pytest.mark.slow
@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
@pytest.mark.parametrize("path", get_test_cases(PASS_DIR))
def test_success(path):
# Alias `OUTPUT_MYPY` so that it appears in the local namespace
output_mypy = OUTPUT_MYPY
if path in output_mypy:
msg = "Unexpected mypy output\n\n"
msg += "\n".join(_strip_filename(v) for v in output_mypy[path])
Reported by Pylint.
Line: 118
Column: 1
@pytest.mark.slow
@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
@pytest.mark.parametrize("path", get_test_cases(FAIL_DIR))
def test_fail(path):
__tracebackhide__ = True
with open(path) as fin:
lines = fin.readlines()
Reported by Pylint.
numpy/typing/tests/data/reveal/lib_utils.py
20 issues
Line: 6
Column: 5
import numpy as np
AR: np.ndarray[Any, np.dtype[np.float64]]
AR_DICT: Dict[str, np.ndarray[Any, np.dtype[np.float64]]]
FILE: StringIO
def func(a: int) -> bool: ...
Reported by Pylint.
Line: 7
Column: 20
import numpy as np
AR: np.ndarray[Any, np.dtype[np.float64]]
AR_DICT: Dict[str, np.ndarray[Any, np.dtype[np.float64]]]
FILE: StringIO
def func(a: int) -> bool: ...
reveal_type(np.deprecate(func)) # E: def (a: builtins.int) -> builtins.bool
Reported by Pylint.
Line: 12
Column: 1
def func(a: int) -> bool: ...
reveal_type(np.deprecate(func)) # E: def (a: builtins.int) -> builtins.bool
reveal_type(np.deprecate()) # E: _Deprecate
reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
Reported by Pylint.
Line: 13
Column: 1
def func(a: int) -> bool: ...
reveal_type(np.deprecate(func)) # E: def (a: builtins.int) -> builtins.bool
reveal_type(np.deprecate()) # E: _Deprecate
reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
Reported by Pylint.
Line: 15
Column: 1
reveal_type(np.deprecate(func)) # E: def (a: builtins.int) -> builtins.bool
reveal_type(np.deprecate()) # E: _Deprecate
reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
Reported by Pylint.
Line: 16
Column: 1
reveal_type(np.deprecate()) # E: _Deprecate
reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.who(None)) # E: None
Reported by Pylint.
Line: 18
Column: 1
reveal_type(np.deprecate_with_doc("test")) # E: _Deprecate
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.who(None)) # E: None
reveal_type(np.who(AR_DICT)) # E: None
Reported by Pylint.
Line: 19
Column: 28
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.who(None)) # E: None
reveal_type(np.who(AR_DICT)) # E: None
reveal_type(np.info(1, output=FILE)) # E: None
Reported by Pylint.
Line: 19
Column: 1
reveal_type(np.deprecate_with_doc(None)) # E: _Deprecate
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.who(None)) # E: None
reveal_type(np.who(AR_DICT)) # E: None
reveal_type(np.info(1, output=FILE)) # E: None
Reported by Pylint.
Line: 21
Column: 1
reveal_type(np.byte_bounds(AR)) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.byte_bounds(np.float64())) # E: Tuple[builtins.int, builtins.int]
reveal_type(np.who(None)) # E: None
reveal_type(np.who(AR_DICT)) # E: None
reveal_type(np.info(1, output=FILE)) # E: None
reveal_type(np.source(np.interp, output=FILE)) # E: None
Reported by Pylint.
numpy/distutils/log.py
19 issues
Line: 19
Column: 1
return args
class Log(old_Log):
def _log(self, level, msg, args):
if level >= self.threshold:
if args:
msg = msg % _fix_args(args)
if 0:
Reported by Pylint.
Line: 48
Column: 8
_global_log.__class__ = Log
good = _global_log.good
def set_threshold(level, force=False):
prev_level = _global_log.threshold
if prev_level > DEBUG or force:
# If we're running at DEBUG, don't change the threshold, as there's
Reported by Pylint.
Line: 50
Column: 1
good = _global_log.good
def set_threshold(level, force=False):
prev_level = _global_log.threshold
if prev_level > DEBUG or force:
# If we're running at DEBUG, don't change the threshold, as there's
# likely a good reason why we're running at this level.
_global_log.threshold = level
Reported by Pylint.
Line: 67
Column: 1
def get_threshold():
return _global_log.threshold
def set_verbosity(v, force=False):
prev_level = _global_log.threshold
if v < 0:
set_threshold(ERROR, force)
elif v == 0:
set_threshold(WARN, force)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.
Line: 3
Column: 1
# Colored log
import sys
from distutils.log import * # noqa: F403
from distutils.log import Log as old_Log
from distutils.log import _global_log
from numpy.distutils.misc_util import (red_text, default_text, cyan_text,
green_text, is_sequence, is_string)
Reported by Pylint.