From fc0764a6eface68092e2b8ea1e697c901ab9a458 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 16 Apr 2020 20:57:39 -0700 Subject: [PATCH] ENH: add __name__ attribue to ufuncs Follow up to https://github.com/numpy/numpy-stubs/pull/44. SciPy actually uses `__name__`, so add it. --- numpy-stubs/__init__.pyi | 2 ++ tests/pass/ufuncs.py | 1 + 2 files changed, 3 insertions(+) diff --git a/numpy-stubs/__init__.pyi b/numpy-stubs/__init__.pyi index de598f7..960e6e5 100644 --- a/numpy-stubs/__init__.pyi +++ b/numpy-stubs/__init__.pyi @@ -620,6 +620,8 @@ little_endian: int tracemalloc_domain: int class ufunc: + @property + def __name__(self) -> str: ... def __call__( self, *args: _ArrayLike, diff --git a/tests/pass/ufuncs.py b/tests/pass/ufuncs.py index 0d8eae8..3133e65 100644 --- a/tests/pass/ufuncs.py +++ b/tests/pass/ufuncs.py @@ -12,3 +12,4 @@ np.sin(1, extobj=[16, 1, lambda: None]) np.sin(1) + np.sin(1) np.sin.types[0] +np.sin.__name__