diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-06-14 14:07:18 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-06-14 14:07:18 -0600 |
commit | 8c78b84968e580f24b3705378fb35705a434cdf1 (patch) | |
tree | c9f82beeb5a2c3f0301f7984d4b6d19539c35d23 /numpy/core/_internal.py | |
parent | 8bf3a4618f1de951c7a4ccdb8bc3e36825a1b744 (diff) | |
parent | 75f852edf94a7293e7982ad516bee314d7187c2d (diff) | |
download | numpy-8c78b84968e580f24b3705378fb35705a434cdf1.tar.gz |
Merge branch 'main' into matrix_rank-doc-fix
Diffstat (limited to 'numpy/core/_internal.py')
-rw-r--r-- | numpy/core/_internal.py | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py index 449926f58..3b0c46467 100644 --- a/numpy/core/_internal.py +++ b/numpy/core/_internal.py @@ -8,6 +8,7 @@ import ast import re import sys import platform +import warnings from .multiarray import dtype, array, ndarray try: @@ -350,11 +351,45 @@ class _ctypes: """ return self.data_as(ctypes.c_void_p) - # kept for compatibility - get_data = data.fget - get_shape = shape.fget - get_strides = strides.fget - get_as_parameter = _as_parameter_.fget + # Numpy 1.21.0, 2021-05-18 + + def get_data(self): + """Deprecated getter for the `_ctypes.data` property. + + .. deprecated:: 1.21 + """ + warnings.warn('"get_data" is deprecated. Use "data" instead', + DeprecationWarning, stacklevel=2) + return self.data + + def get_shape(self): + """Deprecated getter for the `_ctypes.shape` property. + + .. deprecated:: 1.21 + """ + warnings.warn('"get_shape" is deprecated. Use "shape" instead', + DeprecationWarning, stacklevel=2) + return self.shape + + def get_strides(self): + """Deprecated getter for the `_ctypes.strides` property. + + .. deprecated:: 1.21 + """ + warnings.warn('"get_strides" is deprecated. Use "strides" instead', + DeprecationWarning, stacklevel=2) + return self.strides + + def get_as_parameter(self): + """Deprecated getter for the `_ctypes._as_parameter_` property. + + .. deprecated:: 1.21 + """ + warnings.warn( + '"get_as_parameter" is deprecated. Use "_as_parameter_" instead', + DeprecationWarning, stacklevel=2, + ) + return self._as_parameter_ def _newnames(datatype, order): @@ -808,11 +843,13 @@ def _ufunc_doc_signature_formatter(ufunc): ", order='K'" ", dtype=None" ", subok=True" - "[, signature" - ", extobj]" ) + + # NOTE: gufuncs may or may not support the `axis` parameter if ufunc.signature is None: - kwargs = ", where=True" + kwargs + kwargs = f", where=True{kwargs}[, signature, extobj]" + else: + kwargs += "[, signature, extobj, axes, axis]" # join all the parts together return '{name}({in_args}{out_args}, *{kwargs})'.format( |