The following issues were found
numpy/typing/tests/test_runtime.py
16 issues
Line: 8
Column: 1
import sys
from typing import get_type_hints, Union, Tuple, NamedTuple
import pytest
import numpy as np
import numpy.typing as npt
try:
from typing_extensions import get_args, get_origin
Reported by Pylint.
Line: 40
Column: 19
@pytest.mark.parametrize("name,tup", TYPES.items(), ids=TYPES.keys())
@pytest.mark.skipif(SKIP, reason="requires typing-extensions")
def test_get_args(name: type, tup: TypeTup) -> None:
"""Test `typing.get_args`."""
typ, ref = tup.typ, tup.args
out = get_args(typ)
assert out == ref
Reported by Pylint.
Line: 49
Column: 21
@pytest.mark.parametrize("name,tup", TYPES.items(), ids=TYPES.keys())
@pytest.mark.skipif(SKIP, reason="requires typing-extensions")
def test_get_origin(name: type, tup: TypeTup) -> None:
"""Test `typing.get_origin`."""
typ, ref = tup.typ, tup.origin
out = get_origin(typ)
assert out == ref
Reported by Pylint.
Line: 57
Column: 25
@pytest.mark.parametrize("name,tup", TYPES.items(), ids=TYPES.keys())
def test_get_type_hints(name: type, tup: TypeTup) -> None:
"""Test `typing.get_type_hints`."""
typ = tup.typ
# Explicitly set `__annotations__` in order to circumvent the
# stringification performed by `from __future__ import annotations`
Reported by Pylint.
Line: 63
Column: 14
# Explicitly set `__annotations__` in order to circumvent the
# stringification performed by `from __future__ import annotations`
def func(a): pass
func.__annotations__ = {"a": typ, "return": None}
out = get_type_hints(func)
ref = {"a": typ, "return": type(None)}
assert out == ref
Reported by Pylint.
Line: 78
Column: 14
# Explicitly set `__annotations__` in order to circumvent the
# stringification performed by `from __future__ import annotations`
def func(a): pass
func.__annotations__ = {"a": typ_str, "return": None}
out = get_type_hints(func)
ref = {"a": typ, "return": type(None)}
assert out == ref
Reported by Pylint.
Line: 19
Column: 1
SKIP = True
class TypeTup(NamedTuple):
typ: type
args: Tuple[type, ...]
origin: None | type
Reported by Pylint.
Line: 44
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
"""Test `typing.get_args`."""
typ, ref = tup.typ, tup.args
out = get_args(typ)
assert out == ref
@pytest.mark.parametrize("name,tup", TYPES.items(), ids=TYPES.keys())
@pytest.mark.skipif(SKIP, reason="requires typing-extensions")
def test_get_origin(name: type, tup: TypeTup) -> None:
Reported by Bandit.
Line: 53
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
"""Test `typing.get_origin`."""
typ, ref = tup.typ, tup.origin
out = get_origin(typ)
assert out == ref
@pytest.mark.parametrize("name,tup", TYPES.items(), ids=TYPES.keys())
def test_get_type_hints(name: type, tup: TypeTup) -> None:
"""Test `typing.get_type_hints`."""
Reported by Bandit.
Line: 63
Column: 18
# Explicitly set `__annotations__` in order to circumvent the
# stringification performed by `from __future__ import annotations`
def func(a): pass
func.__annotations__ = {"a": typ, "return": None}
out = get_type_hints(func)
ref = {"a": typ, "return": type(None)}
assert out == ref
Reported by Pylint.
numpy/typing/tests/data/pass/dtype.py
16 issues
Line: 41
Column: 1
np.dtype(Test())
# Methods and attributes
dtype_obj.base
dtype_obj.subdtype
dtype_obj.newbyteorder()
dtype_obj.type
dtype_obj.name
dtype_obj.names
Reported by Pylint.
Line: 42
Column: 1
# Methods and attributes
dtype_obj.base
dtype_obj.subdtype
dtype_obj.newbyteorder()
dtype_obj.type
dtype_obj.name
dtype_obj.names
Reported by Pylint.
Line: 44
Column: 1
dtype_obj.base
dtype_obj.subdtype
dtype_obj.newbyteorder()
dtype_obj.type
dtype_obj.name
dtype_obj.names
dtype_obj * 0
dtype_obj * 2
Reported by Pylint.
Line: 45
Column: 1
dtype_obj.subdtype
dtype_obj.newbyteorder()
dtype_obj.type
dtype_obj.name
dtype_obj.names
dtype_obj * 0
dtype_obj * 2
Reported by Pylint.
Line: 46
Column: 1
dtype_obj.newbyteorder()
dtype_obj.type
dtype_obj.name
dtype_obj.names
dtype_obj * 0
dtype_obj * 2
0 * dtype_obj
Reported by Pylint.
Line: 48
Column: 1
dtype_obj.name
dtype_obj.names
dtype_obj * 0
dtype_obj * 2
0 * dtype_obj
2 * dtype_obj
Reported by Pylint.
Line: 49
Column: 1
dtype_obj.names
dtype_obj * 0
dtype_obj * 2
0 * dtype_obj
2 * dtype_obj
void_dtype_obj["f0"]
Reported by Pylint.
Line: 51
Column: 1
dtype_obj * 0
dtype_obj * 2
0 * dtype_obj
2 * dtype_obj
void_dtype_obj["f0"]
void_dtype_obj[0]
void_dtype_obj[["f0", "f1"]]
Reported by Pylint.
Line: 52
Column: 1
dtype_obj * 2
0 * dtype_obj
2 * dtype_obj
void_dtype_obj["f0"]
void_dtype_obj[0]
void_dtype_obj[["f0", "f1"]]
void_dtype_obj[["f0"]]
Reported by Pylint.
Line: 54
Column: 1
0 * dtype_obj
2 * dtype_obj
void_dtype_obj["f0"]
void_dtype_obj[0]
void_dtype_obj[["f0", "f1"]]
void_dtype_obj[["f0"]]
Reported by Pylint.
numpy/distutils/line_endings.py
16 issues
Line: 39
Column: 5
def dos2unix_dir(dir_name):
modified_files = []
os.path.walk(dir_name, dos2unix_one_dir, modified_files)
return modified_files
#----------------------------------
def unix2dos(file):
"Replace LF with CRLF in argument files. Print names of changed files."
Reported by Pylint.
Line: 39
Column: 5
def dos2unix_dir(dir_name):
modified_files = []
os.path.walk(dir_name, dos2unix_one_dir, modified_files)
return modified_files
#----------------------------------
def unix2dos(file):
"Replace LF with CRLF in argument files. Print names of changed files."
Reported by Pylint.
Line: 73
Column: 5
def unix2dos_dir(dir_name):
modified_files = []
os.path.walk(dir_name, unix2dos_one_dir, modified_files)
return modified_files
if __name__ == "__main__":
dos2unix_dir(sys.argv[1])
Reported by Pylint.
Line: 73
Column: 5
def unix2dos_dir(dir_name):
modified_files = []
os.path.walk(dir_name, unix2dos_one_dir, modified_files)
return modified_files
if __name__ == "__main__":
dos2unix_dir(sys.argv[1])
Reported by Pylint.
Line: 9
Column: 1
import sys
def dos2unix(file):
"Replace CRLF with LF in argument files. Print names of changed files."
if os.path.isdir(file):
print(file, "Directory!")
return
Reported by Pylint.
Line: 15
Column: 30
print(file, "Directory!")
return
with open(file, "rb") as fp:
data = fp.read()
if '\0' in data:
print(file, "Binary!")
return
Reported by Pylint.
Line: 22
Column: 5
return
newdata = re.sub("\r\n", "\n", data)
if newdata != data:
print('dos2unix:', file)
with open(file, "wb") as f:
f.write(newdata)
return file
else:
Reported by Pylint.
Line: 24
Column: 34
newdata = re.sub("\r\n", "\n", data)
if newdata != data:
print('dos2unix:', file)
with open(file, "wb") as f:
f.write(newdata)
return file
else:
print(file, 'ok')
Reported by Pylint.
Line: 30
Column: 1
else:
print(file, 'ok')
def dos2unix_one_dir(modified_files, dir_name, file_names):
for file in file_names:
full_path = os.path.join(dir_name, file)
file = dos2unix(full_path)
if file is not None:
modified_files.append(file)
Reported by Pylint.
Line: 37
Column: 1
if file is not None:
modified_files.append(file)
def dos2unix_dir(dir_name):
modified_files = []
os.path.walk(dir_name, dos2unix_one_dir, modified_files)
return modified_files
#----------------------------------
Reported by Pylint.
numpy/tests/test_warnings.py
16 issues
Line: 5
Column: 1
Tests which scan for certain occurrences in the code, they may not find
all of these occurrences but should catch almost all.
"""
import pytest
from pathlib import Path
import ast
import tokenize
import numpy
Reported by Pylint.
Line: 7
Column: 1
"""
import pytest
from pathlib import Path
import ast
import tokenize
import numpy
class ParseCall(ast.NodeVisitor):
Reported by Pylint.
Line: 8
Column: 1
import pytest
from pathlib import Path
import ast
import tokenize
import numpy
class ParseCall(ast.NodeVisitor):
def __init__(self):
Reported by Pylint.
Line: 9
Column: 1
from pathlib import Path
import ast
import tokenize
import numpy
class ParseCall(ast.NodeVisitor):
def __init__(self):
self.ls = []
Reported by Pylint.
Line: 12
Column: 1
import tokenize
import numpy
class ParseCall(ast.NodeVisitor):
def __init__(self):
self.ls = []
def visit_Attribute(self, node):
ast.NodeVisitor.generic_visit(self, node)
Reported by Pylint.
Line: 14
Column: 9
class ParseCall(ast.NodeVisitor):
def __init__(self):
self.ls = []
def visit_Attribute(self, node):
ast.NodeVisitor.generic_visit(self, node)
self.ls.append(node.attr)
Reported by Pylint.
Line: 16
Column: 5
def __init__(self):
self.ls = []
def visit_Attribute(self, node):
ast.NodeVisitor.generic_visit(self, node)
self.ls.append(node.attr)
def visit_Name(self, node):
self.ls.append(node.id)
Reported by Pylint.
Line: 16
Column: 5
def __init__(self):
self.ls = []
def visit_Attribute(self, node):
ast.NodeVisitor.generic_visit(self, node)
self.ls.append(node.attr)
def visit_Name(self, node):
self.ls.append(node.id)
Reported by Pylint.
Line: 20
Column: 5
ast.NodeVisitor.generic_visit(self, node)
self.ls.append(node.attr)
def visit_Name(self, node):
self.ls.append(node.id)
class FindFuncs(ast.NodeVisitor):
def __init__(self, filename):
Reported by Pylint.
Line: 20
Column: 5
ast.NodeVisitor.generic_visit(self, node)
self.ls.append(node.attr)
def visit_Name(self, node):
self.ls.append(node.id)
class FindFuncs(ast.NodeVisitor):
def __init__(self, filename):
Reported by Pylint.
numpy/f2py/use_rules.py
16 issues
Line: 23
Column: 1
f2py_version = 'See `f2py -v`'
from .auxfuncs import (
applyrules, dictappend, gentitle, hasnote, outmess
)
usemodule_rules = {
Reported by Pylint.
Line: 88
Column: 33
return ret
def buildusevar(name, realname, vars, usemodulename):
outmess('\t\t\tConstructing wrapper function for variable "%s=>%s"...\n' % (
name, realname))
ret = {}
vrd = {'name': name,
'realname': realname,
Reported by Pylint.
Line: 20
Column: 1
"""
__version__ = "$Revision: 1.3 $"[10:-1]
f2py_version = 'See `f2py -v`'
from .auxfuncs import (
applyrules, dictappend, gentitle, hasnote, outmess
)
Reported by Pylint.
Line: 23
Column: 1
f2py_version = 'See `f2py -v`'
from .auxfuncs import (
applyrules, dictappend, gentitle, hasnote, outmess
)
usemodule_rules = {
Reported by Pylint.
Line: 52
Column: 1
################
def buildusevars(m, r):
ret = {}
outmess(
'\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name']))
varsmap = {}
revmap = {}
Reported by Pylint.
Line: 52
Column: 1
################
def buildusevars(m, r):
ret = {}
outmess(
'\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name']))
varsmap = {}
revmap = {}
Reported by Pylint.
Line: 52
Column: 1
################
def buildusevars(m, r):
ret = {}
outmess(
'\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name']))
varsmap = {}
revmap = {}
Reported by Pylint.
Line: 52
Column: 1
################
def buildusevars(m, r):
ret = {}
outmess(
'\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name']))
varsmap = {}
revmap = {}
Reported by Pylint.
Line: 55
Column: 1
def buildusevars(m, r):
ret = {}
outmess(
'\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name']))
varsmap = {}
revmap = {}
if 'map' in r:
for k in r['map'].keys():
if r['map'][k] in revmap:
Reported by Pylint.
Line: 66
Column: 13
else:
revmap[r['map'][k]] = k
if 'only' in r and r['only']:
for v in r['map'].keys():
if r['map'][v] in m['vars']:
if revmap[r['map'][v]] == v:
varsmap[v] = r['map'][v]
else:
Reported by Pylint.
numpy/typing/tests/data/fail/scalars.py
16 issues
Line: 31
Column: 1
np.float32([1.0, 0.0, 0.0]) # E: incompatible type
np.complex64([]) # E: incompatible type
np.complex64(1, 2) # E: Too many arguments
# TODO: protocols (can't check for non-existent protocols w/ __getattr__)
np.datetime64(0) # E: non-matching overload
class A:
Reported by Pylint.
Line: 67
Column: 1
np.bytes_(value=b'test') # E: No overload variant
np.void(value=b'test') # E: Unexpected keyword argument
np.bool_(value=True) # E: Unexpected keyword argument
np.datetime64(value="2019") # E: No overload variant
np.timedelta64(value=0) # E: Unexpected keyword argument
np.bytes_(b"hello", encoding='utf-8') # E: No overload variant
np.str_("hello", encoding='utf-8') # E: No overload variant
Reported by Pylint.
Line: 67
Column: 1
np.bytes_(value=b'test') # E: No overload variant
np.void(value=b'test') # E: Unexpected keyword argument
np.bool_(value=True) # E: Unexpected keyword argument
np.datetime64(value="2019") # E: No overload variant
np.timedelta64(value=0) # E: Unexpected keyword argument
np.bytes_(b"hello", encoding='utf-8') # E: No overload variant
np.str_("hello", encoding='utf-8') # E: No overload variant
Reported by Pylint.
Line: 68
Column: 1
np.void(value=b'test') # E: Unexpected keyword argument
np.bool_(value=True) # E: Unexpected keyword argument
np.datetime64(value="2019") # E: No overload variant
np.timedelta64(value=0) # E: Unexpected keyword argument
np.bytes_(b"hello", encoding='utf-8') # E: No overload variant
np.str_("hello", encoding='utf-8') # E: No overload variant
complex(np.bytes_("1")) # E: No overload variant
Reported by Pylint.
Line: 68
Column: 1
np.void(value=b'test') # E: Unexpected keyword argument
np.bool_(value=True) # E: Unexpected keyword argument
np.datetime64(value="2019") # E: No overload variant
np.timedelta64(value=0) # E: Unexpected keyword argument
np.bytes_(b"hello", encoding='utf-8') # E: No overload variant
np.str_("hello", encoding='utf-8') # E: No overload variant
complex(np.bytes_("1")) # E: No overload variant
Reported by Pylint.
Line: 92
Column: 1
f2.__getnewargs__() # E: Invalid self argument
f2.is_integer() # E: Invalid self argument
f2.hex() # E: Invalid self argument
np.float16.fromhex("0x0.0p+0") # E: Invalid self argument
f2.__trunc__() # E: Invalid self argument
f2.__getformat__("float") # E: Invalid self argument
Reported by Pylint.
Line: 1
Column: 1
import sys
import numpy as np
f2: np.float16
f8: np.float64
c8: np.complex64
# Construction
Reported by Pylint.
Line: 32
Column: 3
np.complex64([]) # E: incompatible type
np.complex64(1, 2) # E: Too many arguments
# TODO: protocols (can't check for non-existent protocols w/ __getattr__)
np.datetime64(0) # E: non-matching overload
class A:
def __float__(self):
Reported by Pylint.
Line: 81
Column: 10
f8.squeeze(axis=(0, 1)) # E: incompatible type
f8.transpose(1) # E: incompatible type
def func(a: np.float32) -> None: ...
func(f2) # E: incompatible type
func(f8) # E: incompatible type
round(c8) # E: No overload variant
Reported by Pylint.
Line: 1
Column: 1
import sys
import numpy as np
f2: np.float16
f8: np.float64
c8: np.complex64
# Construction
Reported by Pylint.
numpy/f2py/tests/test_regression.py
16 issues
Line: 2
Column: 1
import os
import pytest
import numpy as np
from numpy.testing import assert_, assert_raises, assert_equal, assert_string_equal
from . import util
Reported by Pylint.
Line: 7
Column: 1
import numpy as np
from numpy.testing import assert_, assert_raises, assert_equal, assert_string_equal
from . import util
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
Reported by Pylint.
Line: 39
Column: 9
def test_numpy_version_attribute(self):
# Check that self.module has an attribute named "__f2py_numpy_version__"
assert_(hasattr(self.module, "__f2py_numpy_version__"),
msg="Fortran module does not have __f2py_numpy_version__")
# Check that the attribute __f2py_numpy_version__ is a string
assert_(isinstance(self.module.__f2py_numpy_version__, str),
msg="__f2py_numpy_version__ is not a string")
Reported by Pylint.
Line: 43
Column: 9
msg="Fortran module does not have __f2py_numpy_version__")
# Check that the attribute __f2py_numpy_version__ is a string
assert_(isinstance(self.module.__f2py_numpy_version__, str),
msg="__f2py_numpy_version__ is not a string")
# Check that __f2py_numpy_version__ has the value numpy.__version__
assert_string_equal(np.__version__, self.module.__f2py_numpy_version__)
Reported by Pylint.
Line: 1
Column: 1
import os
import pytest
import numpy as np
from numpy.testing import assert_, assert_raises, assert_equal, assert_string_equal
from . import util
Reported by Pylint.
Line: 14
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestIntentInOut(util.F2PyTest):
# Check that intent(in out) translates as intent(inout)
sources = [_path('src', 'regression', 'inout.f90')]
@pytest.mark.slow
def test_inout(self):
Reported by Pylint.
Line: 14
Column: 1
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestIntentInOut(util.F2PyTest):
# Check that intent(in out) translates as intent(inout)
sources = [_path('src', 'regression', 'inout.f90')]
@pytest.mark.slow
def test_inout(self):
Reported by Pylint.
Line: 19
Column: 5
sources = [_path('src', 'regression', 'inout.f90')]
@pytest.mark.slow
def test_inout(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float32)[::2]
assert_raises(ValueError, self.module.foo, x)
# check values with contiguous array
Reported by Pylint.
Line: 21
Column: 9
@pytest.mark.slow
def test_inout(self):
# non-contiguous should raise error
x = np.arange(6, dtype=np.float32)[::2]
assert_raises(ValueError, self.module.foo, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float32)
self.module.foo(x)
Reported by Pylint.
Line: 25
Column: 9
assert_raises(ValueError, self.module.foo, x)
# check values with contiguous array
x = np.arange(3, dtype=np.float32)
self.module.foo(x)
assert_equal(x, [3, 1, 2])
class TestNumpyVersionAttribute(util.F2PyTest):
Reported by Pylint.
numpy/typing/tests/data/fail/comparisons.py
16 issues
Line: 4
Column: 7
from typing import Any
import numpy as np
AR_i: np.ndarray[Any, np.dtype[np.int64]]
AR_f: np.ndarray[Any, np.dtype[np.float64]]
AR_c: np.ndarray[Any, np.dtype[np.complex128]]
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
Reported by Pylint.
Line: 5
Column: 7
import numpy as np
AR_i: np.ndarray[Any, np.dtype[np.int64]]
AR_f: np.ndarray[Any, np.dtype[np.float64]]
AR_c: np.ndarray[Any, np.dtype[np.complex128]]
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
Reported by Pylint.
Line: 6
Column: 7
AR_i: np.ndarray[Any, np.dtype[np.int64]]
AR_f: np.ndarray[Any, np.dtype[np.float64]]
AR_c: np.ndarray[Any, np.dtype[np.complex128]]
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
Reported by Pylint.
Line: 7
Column: 7
AR_i: np.ndarray[Any, np.dtype[np.int64]]
AR_f: np.ndarray[Any, np.dtype[np.float64]]
AR_c: np.ndarray[Any, np.dtype[np.complex128]]
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
Reported by Pylint.
Line: 8
Column: 7
AR_f: np.ndarray[Any, np.dtype[np.float64]]
AR_c: np.ndarray[Any, np.dtype[np.complex128]]
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
AR_m > AR_f # E: Unsupported operand types
Reported by Pylint.
Line: 10
Column: 1
AR_m: np.ndarray[Any, np.dtype[np.timedelta64]]
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
AR_m > AR_f # E: Unsupported operand types
AR_m > AR_c # E: Unsupported operand types
Reported by Pylint.
Line: 11
Column: 1
AR_M: np.ndarray[Any, np.dtype[np.datetime64]]
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
AR_m > AR_f # E: Unsupported operand types
AR_m > AR_c # E: Unsupported operand types
AR_i > AR_M # E: Unsupported operand types
Reported by Pylint.
Line: 13
Column: 1
AR_f > AR_m # E: Unsupported operand types
AR_c > AR_m # E: Unsupported operand types
AR_m > AR_f # E: Unsupported operand types
AR_m > AR_c # E: Unsupported operand types
AR_i > AR_M # E: Unsupported operand types
AR_f > AR_M # E: Unsupported operand types
AR_m > AR_M # E: Unsupported operand types
Reported by Pylint.
Line: 14
Column: 1
AR_c > AR_m # E: Unsupported operand types
AR_m > AR_f # E: Unsupported operand types
AR_m > AR_c # E: Unsupported operand types
AR_i > AR_M # E: Unsupported operand types
AR_f > AR_M # E: Unsupported operand types
AR_m > AR_M # E: Unsupported operand types
Reported by Pylint.
Line: 16
Column: 1
AR_m > AR_f # E: Unsupported operand types
AR_m > AR_c # E: Unsupported operand types
AR_i > AR_M # E: Unsupported operand types
AR_f > AR_M # E: Unsupported operand types
AR_m > AR_M # E: Unsupported operand types
AR_M > AR_i # E: Unsupported operand types
AR_M > AR_f # E: Unsupported operand types
Reported by Pylint.
numpy/typing/tests/data/reveal/arrayterator.py
16 issues
Line: 4
Column: 8
from typing import Any
import numpy as np
AR_i8: np.ndarray[Any, np.dtype[np.int64]]
ar_iter = np.lib.Arrayterator(AR_i8)
reveal_type(ar_iter.var) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
Reported by Pylint.
Line: 7
Column: 1
AR_i8: np.ndarray[Any, np.dtype[np.int64]]
ar_iter = np.lib.Arrayterator(AR_i8)
reveal_type(ar_iter.var) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
Reported by Pylint.
Line: 8
Column: 1
ar_iter = np.lib.Arrayterator(AR_i8)
reveal_type(ar_iter.var) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
Reported by Pylint.
Line: 9
Column: 1
reveal_type(ar_iter.var) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
Reported by Pylint.
Line: 10
Column: 1
reveal_type(ar_iter.var) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 11
Column: 1
reveal_type(ar_iter.buf_size) # E: Union[None, builtins.int]
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 12
Column: 1
reveal_type(ar_iter.start) # E: builtins.list[builtins.int]
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
for i in ar_iter:
Reported by Pylint.
Line: 13
Column: 1
reveal_type(ar_iter.stop) # E: builtins.list[builtins.int]
reveal_type(ar_iter.step) # E: builtins.list[builtins.int]
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
for i in ar_iter:
reveal_type(i) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 15
Column: 1
reveal_type(ar_iter.shape) # E: builtins.tuple[builtins.int]
reveal_type(ar_iter.flat) # E: typing.Generator[{int64}, None, None]
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
for i in ar_iter:
reveal_type(i) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter[0]) # E: numpy.lib.arrayterator.Arrayterator[Any, numpy.dtype[{int64}]]
Reported by Pylint.
Line: 18
Column: 5
reveal_type(ar_iter.__array__()) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
for i in ar_iter:
reveal_type(i) # E: numpy.ndarray[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter[0]) # E: numpy.lib.arrayterator.Arrayterator[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter[...]) # E: numpy.lib.arrayterator.Arrayterator[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter[:]) # E: numpy.lib.arrayterator.Arrayterator[Any, numpy.dtype[{int64}]]
reveal_type(ar_iter[0, 0, 0]) # E: numpy.lib.arrayterator.Arrayterator[Any, numpy.dtype[{int64}]]
Reported by Pylint.
numpy/typing/tests/data/misc/extended_precision.py
15 issues
Line: 3
Column: 1
import numpy as np
reveal_type(np.uint128())
reveal_type(np.uint256())
reveal_type(np.int128())
reveal_type(np.int256())
reveal_type(np.float80())
Reported by Pylint.
Line: 4
Column: 1
import numpy as np
reveal_type(np.uint128())
reveal_type(np.uint256())
reveal_type(np.int128())
reveal_type(np.int256())
reveal_type(np.float80())
Reported by Pylint.
Line: 6
Column: 1
reveal_type(np.uint128())
reveal_type(np.uint256())
reveal_type(np.int128())
reveal_type(np.int256())
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
Reported by Pylint.
Line: 7
Column: 1
reveal_type(np.uint256())
reveal_type(np.int128())
reveal_type(np.int256())
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
Reported by Pylint.
Line: 9
Column: 1
reveal_type(np.int128())
reveal_type(np.int256())
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
Reported by Pylint.
Line: 10
Column: 13
reveal_type(np.int256())
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
reveal_type(np.complex192())
Reported by Pylint.
Line: 10
Column: 1
reveal_type(np.int256())
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
reveal_type(np.complex192())
Reported by Pylint.
Line: 11
Column: 1
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
reveal_type(np.complex192())
reveal_type(np.complex256())
Reported by Pylint.
Line: 12
Column: 1
reveal_type(np.float80())
reveal_type(np.float96())
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
reveal_type(np.complex192())
reveal_type(np.complex256())
reveal_type(np.complex512())
Reported by Pylint.
Line: 14
Column: 1
reveal_type(np.float128())
reveal_type(np.float256())
reveal_type(np.complex160())
reveal_type(np.complex192())
reveal_type(np.complex256())
reveal_type(np.complex512())
Reported by Pylint.