8000 Clarify deprecation message re: tex/pgf preambles as list-of-strings. by anntzer · Pull Request #17392 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Clarify deprecation message re: tex/pgf preambles as list-of-strings. #17392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2020
Merged
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
16 changes: 9 additions & 7 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,21 @@ def validate_bool_maybe_none(b):


def _validate_tex_preamble(s):
message = (
f"Support for setting the 'text.latex.preamble' and 'pgf.preamble' "
f"rcParams to {s!r} is deprecated since %(since)s and will be "
f"removed %(removal)s; please set them to plain (possibly empty) "
f"strings instead.")
if s is None or s == 'None':
cbook.warn_deprecated("3.3", message=message)
cbook.warn_deprecated(
"3.3", message="Support for setting the 'text.latex.preamble' or "
"'pgf.preamble' rcParam to None is deprecated since %(since)s and "
"will be removed %(removal)s; set it to an empty string instead.")
return ""
try:
if isinstance(s, str):
return s
elif np.iterable(s):
cbook.warn_deprecated("3.3", message=message)
cbook.warn_deprecated(
"3.3", message="Support for setting the 'text.latex.preamble' "
"or 'pgf.preamble' rcParam to a list of strings is deprecated "
"since %(since)s and will be removed %(removal)s; set it to a "
"single string instead.")
return '\n'.join(s)
else:
raise TypeError
Expand Down
0