diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/_asarray.py | 20 | ||||
-rw-r--r-- | numpy/core/numeric.py | 30 | ||||
-rw-r--r-- | numpy/lib/npyio.py | 30 | ||||
-rw-r--r-- | numpy/lib/twodim_base.py | 18 |
4 files changed, 27 insertions, 71 deletions
diff --git a/numpy/core/_asarray.py b/numpy/core/_asarray.py index ade53eeaf..a406308f3 100644 --- a/numpy/core/_asarray.py +++ b/numpy/core/_asarray.py @@ -5,7 +5,6 @@ Functions in the ``as*array`` family that promote array-likes into arrays. """ from .overrides import ( array_function_dispatch, - array_function_dispatch_like, set_array_function_like_doc, set_module, ) @@ -98,9 +97,7 @@ def asarray(a, dtype=None, order=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _asarray_with_like, a, dtype=dtype, order=order, like=like - ) + return _asarray_with_like(a, dtype=dtype, order=order, like=like) return array(a, dtype, copy=False, order=order) @@ -169,9 +166,7 @@ def asanyarray(a, dtype=None, order=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _asanyarray_with_like, a, dtype=dtype, order=order, like=like - ) + return _asanyarray_with_like(a, dtype=dtype, order=order, like=like) return array(a, dtype, copy=False, order=order, subok=True) @@ -228,9 +223,7 @@ def ascontiguousarray(a, dtype=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _ascontiguousarray_with_like, a, dtype=dtype, like=like - ) + return _ascontiguousarray_with_like(a, dtype=dtype, like=like) return array(a, dtype, copy=False, order='C', ndmin=1) @@ -283,9 +276,7 @@ def asfortranarray(a, dtype=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _asfortranarray_with_like, a, dtype=dtype, like=like - ) + return _asfortranarray_with_like(a, dtype=dtype, like=like) return array(a, dtype, copy=False, order='F', ndmin=1) @@ -372,8 +363,7 @@ def require(a, dtype=None, requirements=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _require_with_like, + return _require_with_like( a, dtype=dtype, requirements=requirements, diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index f0d1f163a..25235f738 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -21,9 +21,7 @@ from .multiarray import ( from . import overrides from . import umath from . import shape_base -from .overrides import ( - array_function_dispatch_like, set_array_function_like_doc, set_module - ) +from .overrides import set_array_function_like_doc, set_module from .umath import (multiply, invert, sin, PINF, NAN) from . import numerictypes from .numerictypes import longlong, intc, int_, float_, complex_, bool_ @@ -200,9 +198,7 @@ def ones(shape, dtype=None, order='C', *, like=None): """ if like is not None: - return array_function_dispatch_like( - _ones_with_like, shape, dtype=dtype, order=order, like=like - ) + return _ones_with_like(shape, dtype=dtype, order=order, like=like) a = empty(shape, dtype, order) multiarray.copyto(a, 1, casting='unsafe') @@ -338,14 +334,7 @@ def full(shape, fill_value, dtype=None, order='C', *, like=None): """ if like is not None: - return array_function_dispatch_like( - _full_with_like, - shape, - fill_value, - dtype=dtype, - order=order, - like=like, - ) + return _full_with_like(shape, fill_value, dtype=dtype, order=order, like=like) if dtype is None: fill_value = asarray(fill_value) @@ -1858,14 +1847,7 @@ def fromfunction(function, shape, *, dtype=float, like=None, **kwargs): """ if like is not None: - return array_function_dispatch_like( - _fromfunction_with_like, - function, - shape, - dtype=dtype, - like=like, - **kwargs, - ) + return _fromfunction_with_like(function, shape, dtype=dtype, like=like, **kwargs) args = indices(shape, dtype=dtype) return function(*args, **kwargs) @@ -2186,9 +2168,7 @@ def identity(n, dtype=None, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _identity_with_like, n, dtype=dtype, like=like - ) + return _identity_with_like(n, dtype=dtype, like=like) from numpy import eye return eye(n, dtype=dtype, like=like) diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index f6b82dbd3..805e59bc1 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -14,9 +14,7 @@ from . import format from ._datasource import DataSource from numpy.core import overrides from numpy.core.multiarray import packbits, unpackbits -from numpy.core.overrides import ( - array_function_dispatch_like, set_array_function_like_doc, set_module - ) +from numpy.core.overrides import set_array_function_like_doc, set_module from numpy.core._internal import recursive from ._iotools import ( LineSplitter, NameValidator, StringConverter, ConverterError, @@ -901,10 +899,10 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, """ if like is not None: - return array_function_dispatch_like( - _loadtxt_with_like, fname, dtype=dtype, comments=comments, - delimiter=delimiter, converters=converters, skiprows=skiprows, - usecols=usecols, unpack=unpack, ndmin=ndmin, encoding=encoding, + return _loadtxt_with_like( + fname, dtype=dtype, comments=comments, delimiter=delimiter, + converters=converters, skiprows=skiprows, usecols=usecols, + unpack=unpack, ndmin=ndmin, encoding=encoding, max_rows=max_rows, like=like ) @@ -1753,15 +1751,15 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, """ if like is not None: - return array_function_dispatch_like( - _genfromtxt_with_like, fname, dtype=dtype, comments=comments, - delimiter=delimiter, skip_header=skip_header, - skip_footer=skip_footer, converters=converters, - missing_values=missing_values, filling_values=filling_values, - usecols=usecols, names=names, excludelist=excludelist, - deletechars=deletechars, replace_space=replace_space, - autostrip=autostrip, case_sensitive=case_sensitive, - defaultfmt=defaultfmt, unpack=unpack, usemask=usemask, loose=loose, + return _genfromtxt_with_like( + fname, dtype=dtype, comments=comments, delimiter=delimiter, + skip_header=skip_header, skip_footer=skip_footer, + converters=converters, missing_values=missing_values, + filling_values=filling_values, usecols=usecols, names=names, + excludelist=excludelist, deletechars=deletechars, + replace_space=replace_space, autostrip=autostrip, + case_sensitive=case_sensitive, defaultfmt=defaultfmt, + unpack=unpack, usemask=usemask, loose=loose, invalid_raise=invalid_raise, max_rows=max_rows, encoding=encoding, like=like ) diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index 099fb2960..2b4cbdfbb 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -8,9 +8,7 @@ from numpy.core.numeric import ( asarray, where, int8, int16, int32, int64, empty, promote_types, diagonal, nonzero ) -from numpy.core.overrides import ( - array_function_dispatch_like, set_array_function_like_doc, set_module - ) +from numpy.core.overrides import set_array_function_like_doc, set_module from numpy.core import overrides from numpy.core import iinfo @@ -205,15 +203,7 @@ def eye(N, M=None, k=0, dtype=float, order='C', *, like=None): """ if like is not None: - return array_function_dispatch_like( - _eye_with_like, - N, - M=M, - k=k, - dtype=dtype, - order=order, - like=like - ) + return _eye_with_like(N, M=M, k=k, dtype=dtype, order=order, like=like) if M is None: M = N m = zeros((N, M), dtype=dtype, order=order) @@ -415,9 +405,7 @@ def tri(N, M=None, k=0, dtype=float, *, like=None): """ if like is not None: - return array_function_dispatch_like( - _tri_with_like, N, M=M, k=k, dtype=dtype, like=like - ) + return _tri_with_like(N, M=M, k=k, dtype=dtype, like=like) if M is None: M = N |