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

Skip to content

Commit e39d792

Browse files
committed
ps: Deprecate the psDefs module-level variable
This is just a bunch of shortcut procedure definitions for Matplotlib's internal use; there's not much use for them externally.
1 parent b28d757 commit e39d792

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``backend_ps.psDefs``
2+
~~~~~~~~~~~~~~~~~~~~~
3+
4+
The ``psDefs`` module-level variable in ``backend_ps`` is deprecated with no
5+
replacement.

lib/matplotlib/backends/backend_ps.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class __getattr__:
4949
# module-level deprecations
5050
ps_backend_helper = _api.deprecated("3.7", obj_type="")(
5151
property(lambda self: PsBackendHelper()))
52+
psDefs = _api.deprecated("3.8", obj_type="")(property(lambda self: _psDefs))
5253

5354

5455
papersize = {'letter': (8.5, 11),
@@ -921,13 +922,13 @@ def print_figure_impl(fh):
921922
f"%%EndComments\n",
922923
end="", file=fh)
923924

924-
Ndict = len(psDefs)
925+
Ndict = len(_psDefs)
925926
print("%%BeginProlog", file=fh)
926927
if not mpl.rcParams['ps.useafm']:
927928
Ndict += len(ps_renderer._character_tracker.used)
928929
print("/mpldict %d dict def" % Ndict, file=fh)
929930
print("mpldict begin", file=fh)
930-
print("\n".join(psDefs), file=fh)
931+
print("\n".join(_psDefs), file=fh)
931932
if not mpl.rcParams['ps.useafm']:
932933
for font_path, chars \
933934
in ps_renderer._character_tracker.used.items():
@@ -1030,9 +1031,9 @@ def _print_figure_tex(
10301031
{get_bbox_header(bbox)[0]}
10311032
%%EndComments
10321033
%%BeginProlog
1033-
/mpldict {len(psDefs)} dict def
1034+
/mpldict {len(_psDefs)} dict def
10341035
mpldict begin
1035-
{"".join(psDefs)}
1036+
{"".join(_psDefs)}
10361037
end
10371038
%%EndProlog
10381039
mpldict begin
@@ -1297,7 +1298,7 @@ def pstoeps(tmpfile, bbox=None, rotated=False):
12971298

12981299
# The usage comments use the notation of the operator summary
12991300
# in the PostScript Language reference manual.
1300-
psDefs = [
1301+
_psDefs = [
13011302
# name proc *_d* -
13021303
# Note that this cannot be bound to /d, because when embedding a Type3 font
13031304
# we may want to define a "d" glyph using "/d{...} d" which would locally

0 commit comments

Comments
 (0)