8000 Link to matplotlibrc of used version by timhoffm · Pull Request #14548 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Link to matplotlibrc of used version #14548

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
Jun 14, 2019
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
25 changes: 12 additions & 13 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,22 +874,22 @@ def _rc_params_in_file(fname, fail_on_error=False):
rc_temp = {}
with _open_file_or_url(fname) as fd:
try:
for cnt, line in enumerate(fd, 1):
for line_no, line in enumerate(fd, 1):
strippedline = line.split('#', 1)[0].strip()
if not 8000 strippedline:
continue
tup = strippedline.split(':', 1)
if len(tup) != 2:
error_details = _error_details_fmt % (cnt, line, fname)
error_details = _error_details_fmt % (line_no, line, fname)
_log.warning('Illegal %s', error_details)
continue
key, val = tup
key = key.strip()
val = val.strip()
if key in rc_temp:
_log.warning('Duplicate key in file %r line #%d.',
fname, cnt)
rc_temp[key] = (val, line, cnt)
fname, line_no)
rc_temp[key] = (val, line, line_no)
except UnicodeDecodeError:
_log.warning('Cannot decode configuration file %s with encoding '
'%s, check LANG and LC_* variables.',
Expand All @@ -900,15 +900,15 @@ def _rc_params_in_file(fname, fail_on_error=False):

config = RcParams()

for key, (val, line, cnt) in rc_temp.items():
for key, (val, line, line_no) in rc_temp.items():
if key in defaultParams:
if fail_on_error:
config[key] = val # try to convert to proper type or raise
else:
try:
config[key] = val # try to convert to proper type or skip
except Exception as msg:
error_details = _error_details_fmt % (cnt, line, fname)
error_details = _error_details_fmt % (line_no, line, fname)
_log.warning('Bad val %r on %s\n\t%s',
val, error_details, msg)
elif key in _deprecated_ignore_map:
Expand All @@ -917,14 +917,13 @@ def _rc_params_in_file(fname, fail_on_error=False):
version, name=key, alternative=alt_key,
addendum="Please update your matplotlibrc.")
else:
print("""
Bad key "%s" on line %d in
%s.
version = 'master' if '.post' in __version__ else f'v{__version__}'
print(f"""
Bad key "{key}" on line {line_no} in
{fname}.
You probably need to get an updated matplotlibrc file from
http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template
or from the matplotlib source distribution""" % (key, cnt, fname),
file=sys.stderr)

https://github.com/matplotlib/matplotlib/blob/{version}/matplotlibrc.template
or from the matplotlib source distribution""", file=sys.stderr)
return config


Expand Down
0