Deprecate functions in backends by oscargus · Pull Request #22797 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/api/next_api_changes/deprecations/22797-OG.rst
13 changes: 9 additions & 4 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
# * draw_quad_mesh


@_api.deprecated("3.6", alternative="Vendor the code")
def fill(strings, linelen=75):
return _fill(strings, linelen=linelen)


def _fill(strings, linelen=75):
"""
Make one string from sequence of strings, with whitespace in between.

Expand Down Expand Up @@ -292,15 +297,15 @@ def pdfRepr(obj):
# anything, so the caller must ensure that PDF names are
# represented as Name objects.
elif isinstance(obj, dict):
return fill([
return _fill([
b"<<",
*[Name(k).pdfRepr() + b" " + pdfRepr(v) for k, v in obj.items()],
b">>",
])

# Lists.
elif isinstance(obj, (list, tuple)):
return fill([b"[", *[pdfRepr(val) for val in obj], b"]"])
return _fill([b"[", *[pdfRepr(val) for val in obj], b"]"])

# The null keyword.
elif obj is None:
Expand All @@ -312,7 +317,7 @@ def pdfRepr(obj):

# A bounding box
elif isinstance(obj, BboxBase):
return fill([pdfRepr(val) for val in obj.bounds])
return _fill([pdfRepr(val) for val in obj.bounds])

else:
raise TypeError("Don't know a PDF representation for {} objects"
Expand Down Expand Up @@ -833,7 +838,7 @@ def write(self, data):
self.currentstream.write(data)

def output(self, *data):
self.write(fill([pdfRepr(x) for x in data]))
self.write(_fill([pdfRepr(x) for x in data]))
self.write(b'\n')

def beginStream(self, id, len, extra=None, png=None):
Expand Down
7 changes: 6 additions & 1 deletion lib/matplotlib/backends/backend_ps.py
Loading