8000 MAINT: expire deprecations by mattip · Pull Request #28254 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: expire deprecations #28254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove more 'tostring' from docs and MaskedArray
  • Loading branch information
mattip committed Feb 1, 2025
commit 79698b8f7776dc8168a284238d20d505dd20ece1
10000
1 change: 0 additions & 1 deletion doc/source/reference/arrays.ndarray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ Array conversion

ndarray.item
ndarray.tolist
ndarray.tostring
ndarray.tobytes
ndarray.tofile
ndarray.dump
Expand Down
1 change: 0 additions & 1 deletion doc/source/reference/maskedarray.baseclass.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ Conversion
MaskedArray.toflex
MaskedArray.tolist
MaskedArray.torecords
MaskedArray.tostring
MaskedArray.tobytes


Expand Down
2 changes: 0 additions & 2 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1688,8 +1688,6 @@ class _ArrayOrScalarCommon:
def dump(self, file: StrOrBytesPath | SupportsWrite[bytes]) -> None: ...
def dumps(self) -> bytes: ...
def tobytes(self, order: _OrderKACF = ...) -> bytes: ...
# NOTE: `tostring()` is deprecated and therefore excluded
# def tostring(self, order=...): ...
def tofile(self, fid: StrOrBytesPath | _SupportsFileMethods, sep: str = ..., format: str = ...) -> None: ...
# generics and 0d arrays return builtin scalars
def tolist(self) -> Any: ...
Expand Down
5 changes: 0 additions & 5 deletions numpy/lib/_user_array_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class container:
Methods
-------
copy
tostring
byteswap
astype

Expand Down Expand Up @@ -227,10 +226,6 @@ def copy(self):
""
return self._rc(self.array.copy())

def tostring(self):
""
return self.array.tostring()

def tobytes(self):
""
return self.array.tobytes()
Expand Down
15 changes: 0 additions & 15 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6391,21 +6391,6 @@ def tolist(self, fill_value=None):
result.shape = inishape
return result.tolist()

def tostring(self, fill_value=None, order='C'):
r"""
A compatibility alias for `tobytes`, with exactly the same behavior.

Despite its name, it returns `bytes` not `str`\ s.

.. deprecated:: 1.19.0
"""
# 2020-03-30, Numpy 1.19.0
warnings.warn(
"tostring() is deprecated. Use tobytes() instead.",
DeprecationWarning, stacklevel=2)

return self.tobytes(fill_value, order=order)

def tobytes(self, fill_value=None, order='C'):
"""
Return the array data as a string containing the raw bytes in the array.
Expand Down
2 changes: 0 additions & 2 deletions numpy/ma/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,6 @@ class MaskedArray(ndarray[_ShapeType_co, _DType_co]):
def argmax(self, axis=..., fill_value=..., out=..., *, keepdims=...): ...
def sort(self, axis=..., kind=..., order=..., endwith=..., fill_value=..., stable=...): ...
def min(self, axis=..., out=..., fill_value=..., keepdims=...): ...
# NOTE: deprecated
# def tostring(self, fill_value=..., order=...): ...
def max(self, axis=..., out=..., fill_value=..., keepdims=...): ...
def ptp(self, axis=..., out=..., fill_value=..., keepdims=...): ...
def partition(self, *args, **kwargs): ...
Expand Down
2 changes: 1 addition & 1 deletion numpy/matrixlib/tests/test_defmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_instance_methods(self):
'getA', 'getA1', 'item', 'nonzero', 'put', 'putmask', 'resize',
'searchsorted', 'setflags', 'setfield', 'sort',
'partition', 'argpartition', 'newbyteorder', 'to_device',
'take', 'tofile', 'tolist', 'tostring', 'tobytes', 'all', 'any',
'take', 'tofile', 'tolist', 'tobytes', 'all', 'any',
'sum', 'argmax', 'argmin', 'min', 'max', 'mean', 'var', 'ptp',
'prod', 'std', 'ctypes', 'itemset', 'bitwise_count',
]
Expand Down
1 change: 0 additions & 1 deletion numpy/typing/tests/data/reveal/ndarray_conversion.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ assert_type(cG_4d.tolist(), complex | list[complex] | list[list[complex]] | list
assert_type(i0_nd.tolist(), int | list[int] | list[list[int]] | list[list[list[Any]]])

# itemset does not return a value
# tostring is pretty simple
# tobytes is pretty simple
# tofile does not return a value
# dump does not return a value
Expand Down
Loading
0