diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-10-26 08:20:26 -0700 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-10-26 08:20:31 -0700 |
commit | 786cfa0d0d914c1438aa176b3d990d6cf75ea837 (patch) | |
tree | 15b9328cfa85d5a3ce463c6bc0299781ed3a4401 /numpy/core/numeric.py | |
parent | 3debe9772ea1b68d997dba3440929a467ad11c52 (diff) | |
download | numpy-786cfa0d0d914c1438aa176b3d990d6cf75ea837.tar.gz |
MAINT: set __module__ for more array_function_dispatch uses
I noticed a few more functions using ``array_function_dispatch`` where I had
not set the module, using this script::
import types
def check_module(module):
for name in dir(module):
item = getattr(module, name)
if isinstance(item, types.FunctionType):
print(f'{item.__module__}.{item.__name__}')
>>> import numpy
>>> check_module(numpy)
...
Note that functions without overrides like ``numpy.ones`` still display the
module in which they are defined, e.g., ``numpy.core.numeric.ones``. We should
probably fix that, too, probably most cleanly adding a decorator that sets
``__module__``, e.g.,
def set_module(module):
def decorator(func):
func.__module__ = module
return func
return decorator
...
@set_module('numpy')
def ones(shape, dtype=None, order='C'):
...
Diffstat (limited to 'numpy/core/numeric.py')
0 files changed, 0 insertions, 0 deletions