8000 Rcparam validation fix by tacaswell · Pull Request #3564 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Rcparam validation fix #3564

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 19 commits into from
Oct 14, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
MNT : no deprecated rcparams in RcParamDefault
suppresses possibly scary warnings
  • Loading branch information
tacaswell committed Oct 1, 2014
commit d9ab665ac98bb51520fad9d63b60379d092b9578
23 changes: 15 additions & 8 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _forward_ilshift(self, other):


8000 from matplotlib.rcsetup import (defaultParams,
validate_backend)
validate_backend, obsolete_rcparams)

major, minor1, minor2, s, tmp = sys.version_info
_python24 = (major == 2 and minor1 >= 4) or major >= 3
Expand Down Expand Up @@ -814,7 +814,8 @@ class RcParams(dict):
"""

validate = dict((key, converter) for key, (default, converter) in
six.iteritems(defaultParams))
six.iteritems(defaultParams)
if key not in obsolete_rcparams)
msg_depr = "%s is deprecated and replaced with %s; please use the latter."
msg_depr_ignore = "%s is deprecated and ignored. Use %s"

Expand Down Expand Up @@ -917,8 +918,9 @@ def rc_params(fail_on_error=False):
if not os.path.exists(fname):
# this should never happen, default in mpl-data should always be found
message = 'could not find rc file; returning defaults'
ret = RcParams([(key, default) for key, (default, _) in \
six.iteritems(defaultParams)])
ret = RcParams([(key, default) for key, (default, _) in
six.iteritems(defaultParams)
if key not in obsolete_rcparams])
warnings.warn(message)
return ret

Expand Down Expand Up @@ -1040,7 +1042,8 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
return config_from_file

iter_params = six.iteritems(defaultParams)
config = RcParams([(key, default) for key, (default, _) in iter_params])
config = RcParams([(key, default) for key, (default, _) in iter_params
if key not in obsolete_rcparams])
config.update(config_from_file)

verbose.set_level(config['verbose.level'])
Expand Down Expand Up @@ -1082,16 +1085,20 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):

rcParamsOrig = rcParams.copy()

rcParamsDefault = RcParams([(key, default) for key, (default, converter) in \
six.iteritems(defaultParams)])
rcParamsDefault = RcParams([(key, default) for key, (default, converter) in
six.iteritems(defaultParams)
if key not in obsolete_rcparams])

rcParams['ps.usedistiller'] = checkdep_ps_distiller(rcParams['ps.usedistiller'])

rcParams['ps.usedistiller'] = checkdep_ps_distiller(
rcParams['ps.usedistiller'])
rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])

if rcParams['axes.formatter.use_locale']:
import locale
locale.setlocale(locale.LC_ALL, '')


def rc(group, **kwargs):
"""
Set the current rc params. Group is the grouping for the rc, e.g.,
Expand Down
4 changes: 3 additions & 1 deletion lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,9 @@ def __call__(self, s):

'animation.convert_args': [[], validate_stringlist]}


obsolete_rcparams = ('tk.pythoninspect', 'savefig.extension',
'svg.embed_char_paths',
'svg.embed_char_paths')
if __name__ == '__main__':
rc = defaultParams
rc['datapath'][0] = '/'
Expand Down
0