10000 Link to matplotlibrc of used version · matplotlib/matplotlib@27a9a04 · GitHub
[go: up one dir, main page]

Skip to content

Commit 27a9a04

Browse files
committed
Link to matplotlibrc of used version
1 parent e1f0101 commit 27a9a04

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/matplotlib/__init__.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -874,22 +874,22 @@ def _rc_params_in_file(fname, fail_on_error=False):
874874
rc_temp = {}
875875
with _open_file_or_url(fname) as fd:
876876
try:
877-
for cnt, line in enumerate(fd, 1):
877+
for line_no, line in enumerate(fd, 1):
878878
strippedline = line.split('#', 1)[0].strip()
879879
if not strippedline:
880880
continue
881881
tup = strippedline.split(':', 1)
882882
if len(tup) != 2:
883-
error_details = _error_details_fmt % (cnt, line, fname)
883+
error_details = _error_details_fmt % (line_no, line, fname)
884884
_log.warning('Illegal %s', error_details)
885885
continue
886886
key, val = tup
887887
key = key.strip()
888888
val = val.strip()
889889
if key in rc_temp:
890890
_log.warning('Duplicate key in file %r line #%d.',
891-
fname, cnt)
892-
rc_temp[key] = (val, line, cnt)
891+
fname, line_no)
892+
rc_temp[key] = (val, line, line_no)
893893
except UnicodeDecodeError:
894894
_log.warning('Cannot decode configuration file %s with encoding '
895895
'%s, check LANG and LC_* variables.',
@@ -900,15 +900,15 @@ def _rc_params_in_file(fname, fail_on_error=False):
900900

901901
config = RcParams()
902902

903-
for key, (val, line, cnt) in rc_temp.items():
903+
for key, (val, line, line_no) in rc_temp.items():
904904
if key in defaultParams:
905905
if fail_on_error:
906906
config[key] = val # try to convert to proper type or raise
907907
else:
908908
try:
909909
config[key] = val # try to convert to proper type or skip
910910
except Exception as msg:
911-
error_details = _error_details_fmt % (cnt, line, fname)
911+
error_details = _error_details_fmt % (line_no, line, fname)
912912
_log.warning('Bad val %r on %s\n\t%s',
913913
val, error_details, msg)
914914
elif key in _deprecated_ignore_map:
@@ -917,14 +917,13 @@ def _rc_params_in_file(fname, fail_on_error=False):
917917
version, name=key, alternative=alt_key,
918918
addendum="Please update your matplotlibrc.")
919919
else:
920-
print("""
921-
Bad key "%s" on line %d in
922-
%s.
920+
version = 'master' if '.post' in __version__ else f'v{__version__}'
921+
print(f"""
922+
Bad key "{key}" on line {line_no} in
923+
{fname}.
923924
You probably need to get an updated matplotlibrc file from
924-
http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template
925-
or from the matplotlib source distribution""" % (key, cnt, fname),
926-
file=sys.stderr)
927-
925+
https://github.com/matplotlib/matplotlib/blob/{version}/matplotlibrc.template
926+
or from the matplotlib source distribution""", file=sys.stderr)
928927
return config
929928

930929

0 commit comments

Comments
 (0)
0