From 851b6218cfe7a9b1f53ce3360406f574e643c7ff Mon Sep 17 00:00:00 2001 From: Vishnu9535 <97020373+Vishnu9535@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:19:40 +0000 Subject: [PATCH] removing old and unused API --- doc/api/next_api_changes/removals/26962.rst | 8 +++++ lib/matplotlib/backends/backend_ps.py | 8 ----- lib/matplotlib/backends/backend_webagg.py | 6 ---- src/_backend_agg.cpp | 20 ------------ src/_backend_agg.h | 2 -- src/_backend_agg_wrapper.cpp | 36 --------------------- 6 files changed, 8 insertions(+), 72 deletions(-) create mode 100644 doc/api/next_api_changes/removals/26962.rst diff --git a/doc/api/next_api_changes/removals/26962.rst b/doc/api/next_api_changes/removals/26962.rst new file mode 100644 index 000000000000..ce875ad45d04 --- /dev/null +++ b/doc/api/next_api_changes/removals/26962.rst @@ -0,0 +1,8 @@ +``backend_ps.PsBackendHelper`` and ``backend_webagg.ServerThread`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... are removed .These were mareked as deprecated since 3.7 of Matplpotlib + +``PyBufferRegion_to_string`` and ``PyBufferRegion_to_string_argb`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +... methods are removed from `src/_backend_agg_wrapper.cpp`.These were mareked as + deprecated since 3.7 Matplpotlib \ No newline at end of file diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index dad3049f51da..d760bef04d19 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -39,17 +39,9 @@ debugPS = False -@_api.deprecated("3.7") -class PsBackendHelper: - def __init__(self): - self._cached = {} - - @_api.caching_module_getattr class __getattr__: # module-level deprecations - ps_backend_helper = _api.deprecated("3.7", obj_type="")( - property(lambda self: PsBackendHelper())) psDefs = _api.deprecated("3.8", obj_type="")(property(lambda self: _psDefs)) diff --git a/lib/matplotlib/backends/backend_webagg.py b/lib/matplotlib/backends/backend_webagg.py index 14c0b525fb8f..dfc5747ef77c 100644 --- a/lib/matplotlib/backends/backend_webagg.py +++ b/lib/matplotlib/backends/backend_webagg.py @@ -37,12 +37,6 @@ TimerAsyncio, TimerTornado) -@mpl._api.deprecated("3.7") -class ServerThread(threading.Thread): - def run(self): - tornado.ioloop.IOLoop.instance().start() - - webagg_server_thread = threading.Thread( target=lambda: tornado.ioloop.IOLoop.instance().start()) diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp index aec7676b7951..10a17f2dc9cb 100644 --- a/src/_backend_agg.cpp +++ b/src/_backend_agg.cpp @@ -5,26 +5,6 @@ #include "_backend_agg.h" #include "mplutils.h" -void BufferRegion::to_string_argb(uint8_t *buf) -{ - unsigned char *pix; - unsigned char tmp; - size_t i, j; - - memcpy(buf, data, (size_t) height * stride); - - for (i = 0; i < (size_t)height; ++i) { - pix = buf + i * stride; - for (j = 0; j < (size_t)width; ++j) { - // Convert rgba to argb - tmp = pix[2]; - pix[2] = pix[0]; - pix[0] = tmp; - pix += 4; - } - } -} - RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi) : width(width), height(height), diff --git a/src/_backend_agg.h b/src/_backend_agg.h index 9f67c77eab64..c191f3448144 100644 --- a/src/_backend_agg.h +++ b/src/_backend_agg.h @@ -86,8 +86,6 @@ class BufferRegion return stride; } - void to_string_argb(uint8_t *buf); - private: agg::int8u *data; agg::rect_i rect; diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index d4ce224d93c3..eaf4bf6f5f9d 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -44,18 +44,6 @@ static void PyBufferRegion_dealloc(PyBufferRegion *self) Py_TYPE(self)->tp_free((PyObject *)self); } -static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args) -{ - char const* msg = - "BufferRegion.to_string is deprecated since Matplotlib 3.7 and will " - "be removed two minor releases later; use np.asarray(region) instead."; - if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) { - return NULL; - } - return PyBytes_FromStringAndSize((const char *)self->x->get_data(), - (Py_ssize_t) self->x->get_height() * self->x->get_stride()); -} - /* TODO: This doesn't seem to be used internally. Remove? */ static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args) @@ -87,28 +75,6 @@ static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args return Py_BuildValue("IIII", rect.x1, rect.y1, rect.x2, rect.y2); } -static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args) -{ - char const* msg = - "BufferRegion.to_string_argb is deprecated since Matplotlib 3.7 and " - "will be removed two minor releases later; use " - "np.take(region, [2, 1, 0, 3], axis=2) instead."; - if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) { - return NULL; - } - PyObject *bufobj; - uint8_t *buf; - Py_ssize_t height, stride; - height = self->x->get_height(); - stride = self->x->get_stride(); - bufobj = PyBytes_FromStringAndSize(NULL, height * stride); - buf = (uint8_t *)PyBytes_AS_STRING(bufobj); - - CALL_CPP_CLEANUP("to_string_argb", (self->x->to_string_argb(buf)), Py_DECREF(bufobj)); - - return bufobj; -} - int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags) { Py_INCREF(self); @@ -136,8 +102,6 @@ int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags) static PyTypeObject *PyBufferRegion_init_type() { static PyMethodDef methods[] = { - { "to_string", (PyCFunction)PyBufferRegion_to_string, METH_NOARGS, NULL }, - { "to_string_argb", (PyCFunction)PyBufferRegion_to_string_argb, METH_NOARGS, NULL }, { "set_x", (PyCFunction)PyBufferRegion_set_x, METH_VARARGS, NULL }, { "set_y", (PyCFunction)PyBufferRegion_set_y, METH_VARARGS, NULL }, { "get_extents", (PyCFunction)PyBufferRegion_get_extents, METH_NOARGS, NULL },
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: