Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6e9c59

Browse files
committed
Remove privatized or unused helper functions
1 parent 3021e0d commit f6e9c59

File tree

4 files changed

+2
-116
lines changed

4 files changed

+2
-116
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@
9292
# * draw_quad_mesh
9393

9494

95-
@_api.deprecated("3.6", alternative="a vendored copy of _fill")
96-
def fill(strings, linelen=75):
97-
return _fill(strings, linelen=linelen)
98-
99-
10095
def _fill(strings, linelen=75):
10196
"""
10297
Make one string from sequence of strings, with whitespace in between.
@@ -442,29 +437,10 @@ def __lt__(self, other):
442437
def __hash__(self):
443438
return hash(self.name)
444439

445-
@staticmethod
446-
@_api.deprecated("3.6")
447-
def hexify(match):
448-
return '#%02x' % ord(match.group())
449-
450440
def pdfRepr(self):
451441
return b'/' + self.name
452442

453443

454-
@_api.deprecated("3.6")
455-
class Operator:
456-
__slots__ = ('op',)
457-
458-
def __init__(self, op):
459-
self.op = op
460-
461-
def __repr__(self):
462-
return '<Operator %s>' % self.op
463-
464-
def pdfRepr(self):
465-
return self.op
466-
467-
468444
class Verbatim:
469445
"""Store verbatim PDF command content for later inclusion in the stream."""
470446
def __init__(self, x):
@@ -515,8 +491,6 @@ class Op(Enum):
515491
clip = b'W'
516492
shading = b'sh'
517493

518-
op = _api.deprecated('3.6')(property(lambda self: self.value))
519-
520494
def pdfRepr(self):
521495
return self.value
522496

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from PIL import Image
1616

1717
import matplotlib as mpl
18-
from matplotlib import _api, cbook, font_manager as fm
18+
from matplotlib import cbook, font_manager as fm
1919
from matplotlib.backend_bases import (
2020
_Backend, FigureCanvasBase, FigureManagerBase, RendererBase
2121
)
@@ -34,27 +34,6 @@
3434
# which is not recognized by TeX.
3535

3636

37-
@_api.caching_module_getattr
38-
class __getattr__:
39-
NO_ESCAPE = _api.deprecated("3.6", obj_type="")(
40-
property(lambda self: _NO_ESCAPE))
41-
re_mathsep = _api.deprecated("3.6", obj_type="")(
42-
property(lambda self: _split_math.__self__))
43-
44-
45-
@_api.deprecated("3.6")
46-
def get_fontspec():
47-
"""Build fontspec preamble from rc."""
48-
with mpl.rc_context({"pgf.preamble": ""}):
49-
return _get_preamble()
50-
51-
52-
@_api.deprecated("3.6")
53-
def get_preamble():
54-
"""Get LaTeX preamble from rc."""
55-
return mpl.rcParams["pgf.preamble"]
56-
57-
5837
def _get_preamble():
5938
"""Prepare a LaTeX preamble based on the rcParams configuration."""
6039
preamble = [mpl.rcParams["pgf.preamble"]]
@@ -92,11 +71,6 @@ def _get_preamble():
9271
re.compile(_NO_ESCAPE + r"(\\mathdefault)").sub, "")
9372

9473

95-
@_api.deprecated("3.6")
96-
def common_texification(text):
97-
return _tex_escape(text)
98-
99-
10074
def _tex_escape(text):
10175
r"""
10276
Do some necessary and/or useful substitutions for texts to be included in
@@ -125,11 +99,6 @@ def _tex_escape(text):
12599
return "".join(parts)
126100

127101

128-
@_api.deprecated("3.6")
129-
def writeln(fh, line):
130-
return _writeln(fh, line)
131-
132-
133102
def _writeln(fh, line):
134103
# Ending lines with a % prevents TeX from inserting spurious spaces
135104
# (https://tex.stackexchange.com/questions/7453).
@@ -308,11 +277,6 @@ def __init__(self):
308277
# Per-instance cache.
309278
self._get_box_metrics = functools.lru_cache()(self._get_box_metrics)
310279

311-
texcommand = _api.deprecated("3.6")(
312-
property(lambda self: mpl.rcParams["pgf.texsystem"]))
313-
latex_header = _api.deprecated("3.6")(
314-
property(lambda self: self._build_latex_header()))
315-
316280
def _setup_latex_process(self, *, expect_reply=True):
317281
# Open LaTeX process for real work; register it for deletion. On
318282
# Windows, we must ensure that the subprocess has quit before being

lib/matplotlib/backends/backend_ps.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import logging
1212
import os
1313
import pathlib
14-
import re
1514
import shutil
1615
from tempfile import TemporaryDirectory
1716
import time
@@ -92,20 +91,6 @@ def _nums_to_str(*args):
9291
return " ".join(f"{arg:1.3f}".rstrip("0").rstrip(".") for arg in args)
9392

9493

95-
@_api.deprecated("3.6", alternative="a vendored copy of this function")
96-
def quote_ps_string(s):
97-
"""
98-
Quote dangerous characters of S for use in a PostScript string constant.
99-
"""
100-
s = s.replace(b"\\", b"\\\\")
101-
s = s.replace(b"(", b"\\(")
102-
s = s.replace(b")", b"\\)")
103-
s = s.replace(b"'", b"\\251")
104-
s = s.replace(b"`", b"\\301")
105-
s = re.sub(br"[^ -~\n]", lambda x: br"\%03o" % ord(x.group()), s)
106-
return s.decode('ascii')
107-
108-
10994
def _move_path_to_path_or_stream(src, dst):
11095
"""
11196
Move the contents of file at *src* to path-or-filelike *dst*.
@@ -1095,13 +1080,6 @@ def draw(self):
10951080
return super().draw()
10961081

10971082

1098-
@_api.deprecated("3.6")
1099-
def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
1100-
paper_width, paper_height, orientation):
1101-
return _convert_psfrags(
1102-
pathlib.Path(tmpfile), psfrags, paper_width, paper_height, orientation)
1103-
1104-
11051083
def _convert_psfrags(tmppath, psfrags, paper_width, paper_height, orientation):
11061084
"""
11071085
When we want to use the LaTeX backend with postscript, we write PSFrag tags

lib/matplotlib/backends/backend_svg.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from PIL import Image
1515

1616
import matplotlib as mpl
17-
from matplotlib import _api, cbook, font_manager as fm
17+
from matplotlib import cbook, font_manager as fm
1818
from matplotlib.backend_bases import (
1919
_Backend, FigureCanvasBase, FigureManagerBase, RendererBase)
2020
from matplotlib.backends.backend_mixed import MixedModeRenderer
@@ -66,11 +66,6 @@
6666
# --------------------------------------------------------------------
6767

6868

69-
@_api.deprecated("3.6", alternative="a vendored copy of _escape_cdata")
70-
def escape_cdata(s):
71-
return _escape_cdata(s)
72-
73-
7469
def _escape_cdata(s):
7570
s = s.replace("&", "&amp;")
7671
s = s.replace("<", "&lt;")
@@ -81,21 +76,11 @@ def _escape_cdata(s):
8176
_escape_xml_comment = re.compile(r'-(?=-)')
8277

8378

84-
@_api.deprecated("3.6", alternative="a vendored copy of _escape_comment")
85-
def escape_comment(s):
86-
return _escape_comment.sub(s)
87-
88-
8979
def _escape_comment(s):
9080
s = _escape_cdata(s)
9181
return _escape_xml_comment.sub('- ', s)
9282

9383

94-
@_api.deprecated("3.6", alternative="a vendored copy of _escape_attrib")
95-
def escape_attrib(s):
96-
return _escape_attrib(s)
97-
98-
9984
def _escape_attrib(s):
10085
s = s.replace("&", "&amp;")
10186
s = s.replace("'", "&apos;")
@@ -111,11 +96,6 @@ def _quote_escape_attrib(s):
11196
'"' + _escape_attrib(s) + '"')
11297

11398

114-
@_api.deprecated("3.6", alternative="a vendored copy of _short_float_fmt")
115-
def short_float_fmt(x):
116-
return _short_float_fmt(x)
117-
118-
11999
def _short_float_fmt(x):
120100
"""
121101
Create a short string representation of a float, which is %f
@@ -281,20 +261,10 @@ def _generate_transform(transform_list):
281261
return ' '.join(parts)
282262

283263

284-
@_api.deprecated("3.6")
285-
def generate_transform(transform_list=None):
286-
return _generate_transform(transform_list or [])
287-
288-
289264
def _generate_css(attrib):
290265
return "; ".join(f"{k}: {v}" for k, v in attrib.items())
291266

292267

293-
@_api.deprecated("3.6")
294-
def generate_css(attrib=None):
295-
return _generate_css(attrib or {})
296-
297-
298268
_capstyle_d = {'projecting': 'square', 'butt': 'butt', 'round': 'round'}
299269

300270

0 commit comments

Comments
 (0)