From 85fba017db53069a29dc0b8ca230a04251eecd43 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 26 Mar 2019 00:26:38 +0100 Subject: [PATCH] Deprecate verbose-related rcParams. They have no effect ever since we switched to stdlib logging. --- doc/api/next_api_changes/2019-03-26-AL.rst | 8 +++++++ lib/matplotlib/__init__.py | 15 ++----------- .../mpl-data/stylelib/_classic_test.mplstyle | 21 ------------------- .../mpl-data/stylelib/classic.mplstyle | 21 ------------------- lib/matplotlib/rcsetup.py | 15 +++++++++---- 5 files changed, 21 insertions(+), 59 deletions(-) create mode 100644 doc/api/next_api_changes/2019-03-26-AL.rst diff --git a/doc/api/next_api_changes/2019-03-26-AL.rst b/doc/api/next_api_changes/2019-03-26-AL.rst new file mode 100644 index 000000000000..ffeb2ca55bbb --- /dev/null +++ b/doc/api/next_api_changes/2019-03-26-AL.rst @@ -0,0 +1,8 @@ +Deprecations +```````````` + +The ``verbose.fileo`` and ``verbose.level`` rcParams, which have had no effect +ever since the switch from Matplotlib's old custom Verbose logging to the +stdlib's `logging` module, are deprecated. + +The ``rcsetup.validate_verbose`` function is deprecated. diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index bc1f0d999331..80588e97a0c6 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -705,6 +705,8 @@ def gen_candidates(): _deprecated_remain_as_none = { 'text.latex.unicode': ('3.0',), 'savefig.frameon': ('3.1',), + 'verbose.fileo': ('3.1',), + 'verbose.level': ('3.1',), } @@ -928,19 +930,6 @@ def _rc_params_in_file(fname, fail_on_error=False): config = RcParams() - for key in ('verbose.level', 'verbose.fileo'): - if key in rc_temp: - val, line, cnt = rc_temp.pop(key) - 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) - _log.warning('Bad val %r on %s\n\t%s', - val, error_details, msg) - for key, (val, line, cnt) in rc_temp.items(): if key in defaultParams: if fail_on_error: diff --git a/lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle b/lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle index 5ae7b7a39e56..a92280276d9d 100644 --- a/lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle @@ -448,27 +448,6 @@ svg.fonttype : path # How to handle SVG fonts: # 'none': Assume fonts are installed on the machine where the SVG will be viewed. # 'path': Embed characters as paths -- supported by most SVG renderers - -# Set the verbose flags. This controls how much information -# matplotlib gives you at runtime and where it goes. The verbosity -# levels are: silent, helpful, debug, debug-annoying. Any level is -# inclusive of all the levels below it. If your setting is "debug", -# you'll get all the debug and helpful messages. When submitting -# problems to the mailing-list, please set verbose to "helpful" or "debug" -# and paste the output into your report. -# -# The "fileo" gives the destination for any calls to verbose.report. -# These objects can a filename, or a filehandle like sys.stdout. -# -# You can override the rc default verbosity from the command line by -# giving the flags --verbose-LEVEL where LEVEL is one of the legal -# levels, e.g., --verbose-helpful. -# -# You can access the verbose instance in your code -# from matplotlib import verbose. -verbose.level : silent # one of silent, helpful, debug, debug-annoying -verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr - # Event keys to interact with figures/plots via keyboard. # Customize these settings according to your needs. # Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') diff --git a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle index f52170541c81..70b44aaab9fe 100644 --- a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle @@ -452,27 +452,6 @@ svg.fonttype : path # How to handle SVG fonts: # 'none': Assume fonts are installed on the machine where the SVG will be viewed. # 'path': Embed characters as paths -- supported by most SVG renderers - -# Set the verbose flags. This controls how much information -# matplotlib gives you at runtime and where it goes. The verbosity -# levels are: silent, helpful, debug, debug-annoying. Any level is -# inclusive of all the levels below it. If your setting is "debug", -# you'll get all the debug and helpful messages. When submitting -# problems to the mailing-list, please set verbose to "helpful" or "debug" -# and paste the output into your report. -# -# The "fileo" gives the destination for any calls to verbose.report. -# These objects can a filename, or a filehandle like sys.stdout. -# -# You can override the rc default verbosity from the command line by -# giving the flags --verbose-LEVEL where LEVEL is one of the legal -# levels, e.g., --verbose-helpful. -# -# You can access the verbose instance in your code -# from matplotlib import verbose. -verbose.level : silent # one of silent, helpful, debug, debug-annoying -verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr - # Event keys to interact with figures/plots via keyboard. # Customize these settings according to your needs. # Leave the field(s) empty if you don't need a key-map. (i.e., fullscreen : '') diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index dd1f08120038..1ecf4443ab1b 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -472,15 +472,22 @@ def validate_font_properties(s): validate_mathtext_default = ValidateInStrings( 'default', "rm cal it tt sf bf default bb frak circled scr regular".split()) -validate_verbose = ValidateInStrings( - 'verbose', - ['silent', 'helpful', 'debug', 'debug-annoying']) _validate_alignment = ValidateInStrings( 'alignment', ['center', 'top', 'bottom', 'baseline', 'center_baseline']) +_validate_verbose = ValidateInStrings( + 'verbose', + ['silent', 'helpful', 'debug', 'debug-annoying']) + + +@cbook.deprecated("3.1") +def validate_verbose(s): + return _validate_verbose(s) + + def validate_whiskers(s): if s == 'range': return 'range' @@ -1006,7 +1013,7 @@ def _validate_linestyle(ls): 'timezone': ['UTC', validate_string], # the verbosity setting - 'verbose.level': ['silent', validate_verbose], + 'verbose.level': ['silent', _validate_verbose], 'verbose.fileo': ['sys.stdout', validate_string], # line props