Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f80ff65

Browse filesBrowse files
issamarabiksundenQuLogic
authored
Remove backend 3.7-deprecated API (#26962)
* remove deprecated class PsBackendHelper Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * remove deprecated class ServerThread Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * remove deprecated class PsBackendHelper dependency Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * remove blank lines Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * Delete deprecated C++ methods PyBufferRegion_to_string and PyBufferRegion_to_string_argb This commit removes two deprecated methods, PyBufferRegion_to_string and PyBufferRegion_to_string_argb, from src/_backend_agg_wrapper.cpp, deprecated since version 3.7. Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * Update API change notes to document removal of deprecated classes and methods from 3.7 This commit updates the API change notes to reflect the removal of deprecated Python classes and C++ methods. Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * Remove deprecated PyBufferRegion methods from _backend_agg_wrapper.cpp Removed `to_string` and `to_string_argb` methods from `PyBufferRegion_init_type` Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * Update format of API change note Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * remove to_string_argb Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * Update doc format Co-authored-by: Kyle Sunden <git@ksunden.space> * Update doc/api/next_api_changes/removals/26962-IA.rst Update doc format Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> * remove to_string_argb declaration Signed-off-by: Issam Arabi <issam@cs.toronto.edu> * refactor * Update formatting of note Co-authored-by: Kyle Sunden <git@ksunden.space> --------- Signed-off-by: Issam Arabi <issam@cs.toronto.edu> Co-authored-by: Kyle Sunden <git@ksunden.space> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 parent 3b23925 commit f80ff65
Copy full SHA for f80ff65

File tree

6 files changed

+19
-72
lines changed
Filter options

6 files changed

+19
-72
lines changed
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Deprecated Classes Removed
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The following deprecated classes from version 3.7 have been removed:
5+
6+
- ``matplotlib.backends.backend_ps.PsBackendHelper``
7+
- ``matplotlib.backends.backend_webagg.ServerThread``
8+
9+
These classes were previously marked as deprecated and have now been removed in accordance with the deprecation cycle.
10+
11+
Deprecated C++ Methods Removed
12+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13+
14+
The following deprecated C++ methods from :file:`src/_backend_agg_wrapper.cpp`, deprecated since version 3.7, have also been removed:
15+
16+
- ``PyBufferRegion_to_string``
17+
- ``PyBufferRegion_to_string_argb``
18+
19+
These methods were previously marked as deprecated and have now been removed.

‎lib/matplotlib/backends/backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_ps.py
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,9 @@
3939
debugPS = False
4040

4141

42-
@_api.deprecated("3.7")
43-
class PsBackendHelper:
44-
def __init__(self):
45-
self._cached = {}
46-
47-
4842
@_api.caching_module_getattr
4943
class __getattr__:
5044
# module-level deprecations
51-
ps_backend_helper = _api.deprecated("3.7", obj_type="")(
52-
property(lambda self: PsBackendHelper()))
5345
psDefs = _api.deprecated("3.8", obj_type="")(property(lambda self: _psDefs))
5446

5547

‎lib/matplotlib/backends/backend_webagg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg.py
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
TimerAsyncio, TimerTornado)
3838

3939

40-
@mpl._api.deprecated("3.7")
41-
class ServerThread(threading.Thread):
42-
def run(self):
43-
tornado.ioloop.IOLoop.instance().start()
44-
45-
4640
webagg_server_thread = threading.Thread(
4741
target=lambda: tornado.ioloop.IOLoop.instance().start())
4842

‎src/_backend_agg.cpp

Copy file name to clipboardExpand all lines: src/_backend_agg.cpp
-20Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,6 @@
55
#include "_backend_agg.h"
66
#include "mplutils.h"
77

8-
void BufferRegion::to_string_argb(uint8_t *buf)
9-
{
10-
unsigned char *pix;
11-
unsigned char tmp;
12-
size_t i, j;
13-
14-
memcpy(buf, data, (size_t) height * stride);
15-
16-
for (i = 0; i < (size_t)height; ++i) {
17-
pix = buf + i * stride;
18-
for (j = 0; j < (size_t)width; ++j) {
19-
// Convert rgba to argb
20-
tmp = pix[2];
21-
pix[2] = pix[0];
22-
pix[0] = tmp;
23-
pix += 4;
24-
}
25-
}
26-
}
27-
288
RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi)
299
: width(width),
3010
height(height),

‎src/_backend_agg.h

Copy file name to clipboardExpand all lines: src/_backend_agg.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ class BufferRegion
8686
return stride;
8787
}
8888

89-
void to_string_argb(uint8_t *buf);
90-
9189
private:
9290
agg::int8u *data;
9391
agg::rect_i rect;

‎src/_backend_agg_wrapper.cpp

Copy file name to clipboardExpand all lines: src/_backend_agg_wrapper.cpp
-36Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ static void PyBufferRegion_dealloc(PyBufferRegion *self)
4444
Py_TYPE(self)->tp_free((PyObject *)self);
4545
}
4646

47-
static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args)
48-
{
49-
char const* msg =
50-
"BufferRegion.to_string is deprecated since Matplotlib 3.7 and will "
51-
"be removed two minor releases later; use np.asarray(region) instead.";
52-
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) {
53-
return NULL;
54-
}
55-
return PyBytes_FromStringAndSize((const char *)self->x->get_data(),
56-
(Py_ssize_t) self->x->get_height() * self->x->get_stride());
57-
}
58-
5947
/* TODO: This doesn't seem to be used internally. Remove? */
6048

6149
static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args)
@@ -87,28 +75,6 @@ static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args
8775
return Py_BuildValue("IIII", rect.x1, rect.y1, rect.x2, rect.y2);
8876
}
8977

90-
static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args)
91-
{
92-
char const* msg =
93-
"BufferRegion.to_string_argb is deprecated since Matplotlib 3.7 and "
94-
"will be removed two minor releases later; use "
95-
"np.take(region, [2, 1, 0, 3], axis=2) instead.";
96-
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) {
97-
return NULL;
98-
}
99-
PyObject *bufobj;
100-
uint8_t *buf;
101-
Py_ssize_t height, stride;
102-
height = self->x->get_height();
103-
stride = self->x->get_stride();
104-
bufobj = PyBytes_FromStringAndSize(NULL, height * stride);
105-
buf = (uint8_t *)PyBytes_AS_STRING(bufobj);
106-
107-
CALL_CPP_CLEANUP("to_string_argb", (self->x->to_string_argb(buf)), Py_DECREF(bufobj));
108-
109-
return bufobj;
110-
}
111-
11278
int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags)
11379
{
11480
Py_INCREF(self);
@@ -136,8 +102,6 @@ int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags)
136102
static PyTypeObject *PyBufferRegion_init_type()
137103
{
138104
static PyMethodDef methods[] = {
139-
{ "to_string", (PyCFunction)PyBufferRegion_to_string, METH_NOARGS, NULL },
140-
{ "to_string_argb", (PyCFunction)PyBufferRegion_to_string_argb, METH_NOARGS, NULL },
141105
{ "set_x", (PyCFunction)PyBufferRegion_set_x, METH_VARARGS, NULL },
142106
{ "set_y", (PyCFunction)PyBufferRegion_set_y, METH_VARARGS, NULL },
143107
{ "get_extents", (PyCFunction)PyBufferRegion_get_extents, METH_NOARGS, NULL },

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.