The following issues were found

doc/source/user/plot_face.py
2 issues
Unable to import 'scipy'
Error

Line: 1 Column: 1

              from scipy import misc
import matplotlib.pyplot as plt

img = misc.face()
plt.imshow(img)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from scipy import misc
import matplotlib.pyplot as plt

img = misc.face()
plt.imshow(img)

            

Reported by Pylint.

numpy/linalg/lapack_lite/f2c_lapack.c
2 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 481 Column: 12 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
    /* Local variables */
    static integer i__;
    static char c1[1], c2[2], c3[3], c4[2];
    static integer ic, nb, iz, nx;
    static logical cname;
    static integer nbmin;
    static logical sname;
    extern integer ieeeck_(integer *, real *, real *);

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 487 Column: 12 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  static integer nbmin;
    static logical sname;
    extern integer ieeeck_(integer *, real *, real *);
    static char subnam[6];
    extern integer iparmq_(integer *, char *, char *, integer *, integer *,
	    integer *, integer *, ftnlen, ftnlen);


/*

            

Reported by FlawFinder.

doc/source/user/plot_approx.py
2 issues
Unable to import 'scipy'
Error

Line: 1 Column: 1

              from scipy import misc
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg

img = misc.face()
img_array = img / 255
img_gray = img_array @ [0.2126, 0.7152, 0.0722]


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from scipy import misc
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg

img = misc.face()
img_array = img / 255
img_gray = img_array @ [0.2126, 0.7152, 0.0722]


            

Reported by Pylint.

numpy/core/include/numpy/npy_3kcompat.h
2 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 419 Column: 15 CWE codes: 362

              static NPY_INLINE PyObject*
npy_PyFile_OpenFile(PyObject *filename, const char *mode)
{
    PyObject *open;
    open = PyDict_GetItemString(PyEval_GetBuiltins(), "open");
    if (open == NULL) {
        return NULL;
    }
    return PyObject_CallFunction(open, "Os", filename, mode);

            

Reported by FlawFinder.

open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 424 Column: 34 CWE codes: 362

                  if (open == NULL) {
        return NULL;
    }
    return PyObject_CallFunction(open, "Os", filename, mode);
}

static NPY_INLINE int
npy_PyFile_CloseFile(PyObject *file)
{

            

Reported by FlawFinder.

numpy/typing/tests/data/reveal/ctypeslib.py
2 issues
Undefined variable 'reveal_type'
Error

Line: 3 Column: 1

              import numpy as np

reveal_type(np.ctypeslib.c_intp())  # E: {c_intp}

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np

reveal_type(np.ctypeslib.c_intp())  # E: {c_intp}

            

Reported by Pylint.

numpy/random/tests/test_seed_sequence.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
from numpy.testing import assert_array_equal, assert_array_compare

from numpy.random import SeedSequence


def test_reference_data():
    """ Check that SeedSequence generates data the same as the C++ reference.


            

Reported by Pylint.

Variable name "ss" doesn't conform to snake_case naming style
Error

Line: 50 Column: 9

                  ]
    for seed, expected, expected64 in zip(inputs, outputs, outputs64):
        expected = np.array(expected, dtype=np.uint32)
        ss = SeedSequence(seed)
        state = ss.generate_state(len(expected))
        assert_array_equal(state, expected)
        state64 = ss.generate_state(len(expected64), dtype=np.uint64)
        assert_array_equal(state64, expected64)


            

Reported by Pylint.

numpy/core/src/npysort/npysort_common.h
2 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 260 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              NPY_INLINE static void
STRING_COPY(char *s1, char *s2, size_t len)
{
    memcpy(s1, s2, len);
}


NPY_INLINE static void
STRING_SWAP(char *s1, char *s2, size_t len)

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 362 Column: 5 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              NPY_INLINE static void
GENERIC_COPY(char *a, char *b, size_t len)
{
    memcpy(a, b, len);
}


NPY_INLINE static void
GENERIC_SWAP(char *a, char *b, size_t len)

            

Reported by FlawFinder.

doc/source/user/plots/matplotlib3.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(projection='3d')
X = np.arange(-5, 5, 0.15)
Y = np.arange(-5, 5, 0.15)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)

            

Reported by Pylint.

Final newline missing
Error

Line: 14 Column: 1

              
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap='viridis')

plt.show()
            

Reported by Pylint.

doc/source/user/plots/matplotlib2.py
2 issues
Missing module docstring
Error

Line: 1 Column: 1

              import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 5, 20)
y = np.linspace(0, 10, 20)
plt.plot(x, y, 'purple') # line
plt.plot(x, y, 'o')      # dots
plt.show()
            

Reported by Pylint.

Final newline missing
Error

Line: 8 Column: 1

              y = np.linspace(0, 10, 20)
plt.plot(x, y, 'purple') # line
plt.plot(x, y, 'o')      # dots
plt.show()
            

Reported by Pylint.

numpy/typing/tests/data/fail/array_pad.py
2 issues
Module 'numpy.typing' has no 'NDArray' member
Error

Line: 4 Column: 8

              import numpy as np
import numpy.typing as npt

AR_i8: npt.NDArray[np.int64]

np.pad(AR_i8, 2, mode="bob")  # E: No overload variant

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import numpy.typing as npt

AR_i8: npt.NDArray[np.int64]

np.pad(AR_i8, 2, mode="bob")  # E: No overload variant

            

Reported by Pylint.