|
60 | 60 | changed using the ``plot_html_show_source_link`` variable in |
61 | 61 | :file:`conf.py` (which itself defaults to True). |
62 | 62 |
|
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 | | -
|
68 | 63 | ``:context:`` : bool or str |
69 | 64 | If provided, the code will be run in the context of all previous plot |
70 | 65 | directives for which the ``:context:`` option was specified. This only |
|
166 | 161 | import matplotlib |
167 | 162 | from matplotlib.backend_bases import FigureManagerBase |
168 | 163 | import matplotlib.pyplot as plt |
169 | | -from matplotlib import _api, _pylab_helpers, cbook |
| 164 | +from matplotlib import _pylab_helpers, cbook |
170 | 165 |
|
171 | 166 | matplotlib.use("agg") |
172 | 167 |
|
@@ -200,11 +195,6 @@ def _option_format(arg): |
200 | 195 | return directives.choice(arg, ('python', 'doctest')) |
201 | 196 |
|
202 | 197 |
|
203 | | -def _deprecated_option_encoding(arg): |
204 | | - _api.warn_deprecated("3.5", name="encoding", obj_type="option") |
205 | | - return directives.encoding(arg) |
206 | | - |
207 | | - |
208 | 198 | def mark_plot_labels(app, document): |
209 | 199 | """ |
210 | 200 | To make plots referenceable, we need to move the reference from the |
@@ -254,7 +244,6 @@ class PlotDirective(Directive): |
254 | 244 | 'format': _option_format, |
255 | 245 | 'context': _option_context, |
256 | 246 | 'nofigs': directives.flag, |
257 | | - 'encoding': _deprecated_option_encoding, |
258 | 247 | 'caption': directives.unchanged, |
259 | 248 | } |
260 | 249 |
|
@@ -316,32 +305,6 @@ def contains_doctest(text): |
316 | 305 | return bool(m) |
317 | 306 |
|
318 | 307 |
|
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 | | - |
345 | 308 | def _split_code_at_show(text, function_name): |
346 | 309 | """Split code at plt.show().""" |
347 | 310 |
|
@@ -473,15 +436,6 @@ class PlotError(RuntimeError): |
473 | 436 | pass |
474 | 437 |
|
475 | 438 |
|
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 | | - |
485 | 439 | def _run_code(code, code_path, ns=None, function_name=None): |
486 | 440 | """ |
487 | 441 | Import a Python module from a path, and run the function given by |
|
0 commit comments