summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/overrides.py18
-rw-r--r--numpy/core/shape_base.py8
-rw-r--r--numpy/core/tests/test_overrides.py14
3 files changed, 1 insertions, 39 deletions
diff --git a/numpy/core/overrides.py b/numpy/core/overrides.py
index c55174ecd..46097f39c 100644
--- a/numpy/core/overrides.py
+++ b/numpy/core/overrides.py
@@ -8,10 +8,6 @@ from numpy.core._multiarray_umath import (
from numpy.compat._inspect import getargspec
-ENABLE_ARRAY_FUNCTION = bool(
- int(os.environ.get('NUMPY_EXPERIMENTAL_ARRAY_FUNCTION', 0)))
-
-
add_docstring(
implement_array_function,
"""
@@ -141,16 +137,6 @@ def array_function_dispatch(dispatcher, module=None, verify=True,
Function suitable for decorating the implementation of a NumPy function.
"""
- if not ENABLE_ARRAY_FUNCTION:
- # __array_function__ requires an explicit opt-in for now
- def decorator(implementation):
- if module is not None:
- implementation.__module__ = module
- if docs_from_dispatcher:
- add_docstring(implementation, dispatcher.__doc__)
- return implementation
- return decorator
-
def decorator(implementation):
if verify:
verify_matching_signatures(implementation, dispatcher)
@@ -167,10 +153,6 @@ def array_function_dispatch(dispatcher, module=None, verify=True,
if module is not None:
public_api.__module__ = module
- # TODO: remove this when we drop Python 2 support (functools.wraps
- # adds __wrapped__ automatically in later versions)
- public_api.__wrapped__ = implementation
-
return public_api
return decorator
diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py
index f8332c362..08e07bb66 100644
--- a/numpy/core/shape_base.py
+++ b/numpy/core/shape_base.py
@@ -217,11 +217,6 @@ def _arrays_for_stack_dispatcher(arrays, stacklevel=4):
return arrays
-def _warn_for_nonsequence(arrays):
- if not overrides.ENABLE_ARRAY_FUNCTION:
- _arrays_for_stack_dispatcher(arrays, stacklevel=4)
-
-
def _vhstack_dispatcher(tup):
return _arrays_for_stack_dispatcher(tup)
@@ -279,7 +274,6 @@ def vstack(tup):
[4]])
"""
- _warn_for_nonsequence(tup)
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
@@ -331,7 +325,6 @@ def hstack(tup):
[3, 4]])
"""
- _warn_for_nonsequence(tup)
arrs = [atleast_1d(_m) for _m in tup]
# As a special case, dimension 0 of 1-dimensional arrays is "horizontal"
if arrs and arrs[0].ndim == 1:
@@ -406,7 +399,6 @@ def stack(arrays, axis=0, out=None):
[3, 4]])
"""
- _warn_for_nonsequence(arrays)
arrays = [asanyarray(arr) for arr in arrays]
if not arrays:
raise ValueError('need at least one array to stack')
diff --git a/numpy/core/tests/test_overrides.py b/numpy/core/tests/test_overrides.py
index 8f1c16539..4d1844b8d 100644
--- a/numpy/core/tests/test_overrides.py
+++ b/numpy/core/tests/test_overrides.py
@@ -8,16 +8,11 @@ from numpy.testing import (
assert_, assert_equal, assert_raises, assert_raises_regex)
from numpy.core.overrides import (
_get_implementing_args, array_function_dispatch,
- verify_matching_signatures, ENABLE_ARRAY_FUNCTION)
+ verify_matching_signatures)
from numpy.core.numeric import pickle
import pytest
-requires_array_function = pytest.mark.skipif(
- not ENABLE_ARRAY_FUNCTION,
- reason="__array_function__ dispatch not enabled.")
-
-
def _return_not_implemented(self, *args, **kwargs):
return NotImplemented
@@ -35,7 +30,6 @@ def dispatched_two_arg(array1, array2):
return 'original'
-@requires_array_function
class TestGetImplementingArgs(object):
def test_ndarray(self):
@@ -147,7 +141,6 @@ class TestGetImplementingArgs(object):
_get_implementing_args(relevant_args)
-@requires_array_function
class TestNDArrayArrayFunction(object):
def test_method(self):
@@ -206,7 +199,6 @@ class TestNDArrayArrayFunction(object):
args=(array,), kwargs={})
-@requires_array_function
class TestArrayFunctionDispatch(object):
def test_pickle(self):
@@ -246,7 +238,6 @@ class TestArrayFunctionDispatch(object):
dispatched_one_arg(array)
-@requires_array_function
class TestVerifyMatchingSignatures(object):
def test_verify_matching_signatures(self):
@@ -299,7 +290,6 @@ def _new_duck_type_and_implements():
return (MyArray, implements)
-@requires_array_function
class TestArrayFunctionImplementation(object):
def test_one_arg(self):
@@ -376,12 +366,10 @@ class TestNumPyFunctions(object):
assert_equal(np.fft.fft.__module__, 'numpy.fft')
assert_equal(np.linalg.solve.__module__, 'numpy.linalg')
- @pytest.mark.skipif(sys.version_info[0] < 3, reason="Python 3 only")
def test_inspect_sum(self):
signature = inspect.signature(np.sum)
assert_('axis' in signature.parameters)
- @requires_array_function
def test_override_sum(self):
MyArray, implements = _new_duck_type_and_implements()