8000 MNT: expire mpl3.5 deprecation · matplotlib/matplotlib@8ecc8f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8ecc8f2

Browse files
committed
MNT: expire mpl3.5 deprecation
1 parent 6af009c commit 8ecc8f2

File tree

3 files changed

+13
-48
lines changed

3 files changed

+13
-48
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plot directive removals
2+
~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The public methods:
5+
6+
- ``matplotlib.sphinxext.split_code_at_show``
7+
- ``matplotlib.sphinxext.unescape_doctest``
8+
- ``matplotlib.sphinxext.run_code``
9+
10+
have been removed.
11+
12+
The deprecating *encoding* option to the plot directive has been removed.

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
changed using the ``plot_html_show_source_link`` variable in
6161
:file:`conf.py` (which itself defaults to True).
6262
63-
``:encoding:`` : str
64-
If this source file is in a non-UTF8 or non-ASCII encoding, the
65-
encoding must be specified using the ``:encoding:`` option. The
66-
encoding will not be inferred using the ``-*- coding -*-`` metacomment.
67-
6863
``:context:`` : bool or str
6964
If provided, the code will be run in the context of all previous plot
7065
directives for which the ``:context:`` option was specified. This only
@@ -166,7 +161,7 @@
166161
import matplotlib
167162
from matplotlib.backend_bases import FigureManagerBase
168163
import matplotlib.pyplot as plt
169-
from matplotlib import _api, _pylab_helpers, cbook
164+
from matplotlib import _pylab_helpers, cbook
170165

171166
matplotlib.use("agg")
172167

@@ -200,11 +195,6 @@ def _option_format(arg):
200195
return directives.choice(arg, ('python', 'doctest'))
201196

202197

203-
def _deprecated_option_encoding(arg):
204-
_api.warn_deprecated("3.5", name="encoding", obj_type="option")
205-
return directives.encoding(arg)
206-
207-
208198
def mark_plot_labels(app, document):
209199
"""
210200
To make plots referenceable, we need to move the reference from the
@@ -254,7 +244,6 @@ class PlotDirective(Directive):
254244
'format': _option_format,
255245
'context': _option_context,
256246
'nofigs': directives.flag,
257-
'encoding': _deprecated_option_encoding,
258247
'caption': directives.unchanged,
259248
}
260249

@@ -316,32 +305,6 @@ def contains_doctest(text):
316305
return bool(m)
317306

318307

319-
@_api.deprecated("3.5", alternative="doctest.script_from_examples")
320-
def unescape_doctest(text):
321-
"""
322-
Extract code from a piece of text, which contains either Python code
323-
or doctests.
324-
"""
325-
if not contains_doctest(text):
326-
return text
327-
code = ""
328-
for line in text.split("\n"):
329-
m = re.match(r'^\s*(>>>|\.\.\.) (.*)$', line)
330-
if m:
331-
code += m.group(2) + "\n"
332-
elif line.strip():
333-
code += "# " + line.strip() + "\n"
334-
else:
335-
code += "\n"
336-
return code
337-
338-
339-
@_api.deprecated("3.5")
340-
def split_code_at_show(text):
341-
"""Split code at plt.show()."""
342-
return _split_code_at_show(text)[1]
343-
344-
345308
def _split_code_at_show(text, function_name):
346309
"""Split code at plt.show()."""
347310

@@ -473,15 +436,6 @@ class PlotError(RuntimeError):
473436
pass
474437

475438

476-
@_api.deprecated("3.5")
477-
def run_code(code, code_path, ns=None, function_name=None):
478-
"""
479-
Import a Python module from a path, and run the function given by
480-
name, if function_name is not None.
481-
"""
482-
_run_code(unescape_doctest(code), code_path, ns, function_name)
483-
484-
485439
def _run_code(code, code_path, ns=None, function_name=None):
486440
"""
487441
Import a Python module from a path, and run the function given by

lib/matplotlib/tests/tinypages/some_plots.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ Plot 15 uses an external file with the plot commands and a caption (the
124124
encoding is ignored and just verifies the deprecation is not broken):
125125

126126
.. plot:: range4.py
127-
:encoding: utf-8
128127

129128
This is the caption for plot 15.
130129

0 commit comments

Comments
 (0)
0