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 : re-work obsolete_rcparams
re-use the existing frame work for this
  • Loading branch information
tacaswell committed Oct 1, 2014
commit c93041c49793145e32f3cb10f58d9cd2eff81b9c
15 changes: 10 additions & 5 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import six
import sys
import distutils.version
from itertools import chain

__version__ = '1.4.x'
__version__numpy__ = '1.6' # minimum required numpy version
Expand Down Expand Up @@ -191,7 +192,7 @@ def _forward_ilshift(self, other):


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

major, minor1, minor2, s, tmp = sys.version_info
_python24 = (major == 2 and minor1 >= 4) or major >= 3
Expand Down Expand Up @@ -803,6 +804,10 @@ def matplotlib_fname():
_deprecated_ignore_map = {
}

_obsolete_set = set(['tk.pythoninspect', ])
_all_deprecated = set(chain(_deprecated_ignore_map,
_deprecated_map, _obsolete_set))


class RcParams(dict):

Expand All @@ -815,7 +820,7 @@ class RcParams(dict):

validate = dict((key, converter) for key, (default, converter) in
six.iteritems(defaultParams)
if key not in obsolete_rcparams)
if key not in _all_deprecated)
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 @@ -920,7 +925,7 @@ def rc_params(fail_on_error=False):
message = 'could not find rc file; returning defaults'
ret = RcParams([(key, default) for key, (default, _) in
six.iteritems(defaultParams)
if key not in obsolete_rcparams])
if key not in _all_deprecated])
warnings.warn(message)
return ret

Expand Down Expand Up @@ -1043,7 +1048,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):

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

verbose.set_level(config['verbose.level'])
Expand Down Expand Up @@ -1087,7 +1092,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):

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


rcParams['ps.usedistiller'] = checkdep_ps_distiller(
Expand Down
4 changes: 1 addition & 3 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,7 @@ 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