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/lib/_datasource.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/lib/_datasource.py')
-rw-r--r-- | numpy/lib/_datasource.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py index ab00b1444..e34c376e5 100644 --- a/numpy/lib/_datasource.py +++ b/numpy/lib/_datasource.py @@ -41,8 +41,12 @@ import warnings import shutil import io +from numpy.core.overrides import set_module + + _open = open + def _check_mode(mode, encoding, newline): """Check mode and that encoding and newline are compatible. @@ -262,7 +266,8 @@ def open(path, mode='r', destpath=os.curdir, encoding=None, newline=None): return ds.open(path, mode, encoding=encoding, newline=newline) -class DataSource (object): +@set_module('numpy') +class DataSource(object): """ DataSource(destpath='.') |