diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-11-13 09:38:07 -0800 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-11-13 20:24:31 -0800 |
commit | 4d24bbda32d133d51940b0691bd9b428d4198eaa (patch) | |
tree | c018ac1ada700494f1bb404a8ae9f1346720ebfe /numpy/core/overrides.py | |
parent | cd39348e8593dc2b41e2516fbdd8a69b0f0bda6e (diff) | |
download | numpy-4d24bbda32d133d51940b0691bd9b428d4198eaa.tar.gz |
ENH: set correct __module__ for objects in numpy's public API
Fixes GH-12271
Tests verify that everything in ``dir(numpy)`` either has ``__module__`` set to
``'numpy'``, or appears in an explicit whitelist of undocumented functions and
exported bulitins. These should eventually be documented or removed.
I also identified a handful of functions for which I had accidentally not setup
dispatch for with ``__array_function__`` before, because they were listed under
"ndarray methods" in ``_add_newdocs.py``. I guess that should be a lesson in
trusting code comments :).
Diffstat (limited to 'numpy/core/overrides.py')
-rw-r--r-- | numpy/core/overrides.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py index e4d505f06..1cc1ff8d8 100644 --- a/numpy/core/overrides.py +++ b/numpy/core/overrides.py @@ -150,12 +150,12 @@ def verify_matching_signatures(implementation, dispatcher): 'default argument values') -def override_module(module): +def set_module(module): """Decorator for overriding __module__ on a function or class. Example usage:: - @override_module('numpy') + @set_module('numpy') def example(): pass @@ -198,7 +198,7 @@ def array_function_dispatch(dispatcher, module=None, verify=True): if not ENABLE_ARRAY_FUNCTION: # __array_function__ requires an explicit opt-in for now - return override_module(module) + return set_module(module) def decorator(implementation): if verify: |