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 cce8690

Browse filesBrowse files
committed
MNT: de-jargon hard-coded warning and deprecation decorator
1 parent 53a2807 commit cce8690
Copy full SHA for cce8690

File tree

Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed

‎lib/matplotlib/_api/deprecation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_api/deprecation.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ def _generate_deprecation_warning(
2929
raise ValueError(
3030
"A pending deprecation cannot have a scheduled removal")
3131
else:
32-
removal = f"in {removal}" if removal else "two meso releases later"
32+
if not removal:
33+
macro, meso, *_ = since.split('.')
34+
removal = f'{macro}.{int(meso) + 2}'
35+
removal = f"in {removal}"
3336
if not message:
3437
message = (
3538
("The %(name)s %(obj_type)s" if obj_type else "%(name)s")
3639
+ (" will be deprecated in a future version"
3740
if pending else
38-
(" was deprecated in Matplotlib %(since)s"
39-
+ (" and will be removed %(removal)s" if removal else "")))
41+
" was deprecated in Matplotlib %(since)s and will be removed %(removal)s"
42+
)
4043
+ "."
4144
+ (" Use %(alternative)s instead." if alternative else "")
4245
+ (" %(addendum)s" if addendum else ""))

‎lib/matplotlib/tests/test_pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_pyplot.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def test_pyplot_up_to_date(tmp_path):
4343

4444

4545
def test_copy_docstring_and_deprecators(recwarn):
46-
@mpl._api.rename_parameter("(version)", "old", "new")
47-
@mpl._api.make_keyword_only("(version)", "kwo")
46+
@mpl._api.rename_parameter(mpl.__version__, "old", "new")
47+
@mpl._api.make_keyword_only(mpl.__version__, "kwo")
4848
def func(new, kwo=None):
4949
pass
5050

‎src/ft2font_wrapper.cpp

Copy file name to clipboardExpand all lines: src/ft2font_wrapper.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ static PyObject *PyFT2Image_draw_rect(PyFT2Image *self, PyObject *args)
7575
{
7676
char const* msg =
7777
"FT2Image.draw_rect is deprecated since Matplotlib 3.8 and will be removed "
78-
"two meso releases later as it is not used in the library. If you rely on "
79-
"it, please let us know.";
78+
"in Matplotlib 3.10 releases later as it is not used in the library. "
79+
"If you rely on it, please let us know.";
8080
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) {
8181
return NULL;
8282
}

0 commit comments

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