From 07d8a51b75ea9c7e143d86831e600e6d638a686d Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 20 Sep 2019 02:56:57 +0200 Subject: [PATCH] Deprecate unused rcParams["animation.html_args"]. I guess it was intended as a parallel for e.g. `animation.ffmpeg_args` -- a list of command-line arguments additionally passed to ffmpeg -- but no external program is used by the html animation writer. --- doc/api/next_api_changes/deprecations.rst | 5 +++++ lib/matplotlib/__init__.py | 1 + lib/matplotlib/animation.py | 16 +++++++++++----- matplotlibrc.template | 1 - 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/api/next_api_changes/deprecations.rst b/doc/api/next_api_changes/deprecations.rst index e57bfc60c263..663d51341be9 100644 --- a/doc/api/next_api_changes/deprecations.rst +++ b/doc/api/next_api_changes/deprecations.rst @@ -381,3 +381,8 @@ Path helpers in :mod:`.bezier` ``bezier.concatenate_paths`` is deprecated. Use ``Path.make_compound_path()`` instead. + +``animation.html_args`` rcParam +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The unused ``animation.html_args`` rcParam and ``animation.HTMLWriter.args_key`` +attribute are deprecated. diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 9486610da69f..f52d6d9f7e45 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -619,6 +619,7 @@ def gen_candidates(): 'datapath': ('3.2.1',), 'animation.avconv_path': ('3.3',), 'animation.avconv_args': ('3.3',), + 'animation.html_args': ('3.3',), 'mathtext.fallback_to_cm': ('3.3',), 'keymap.all_axes': ('3.3',), 'savefig.jpeg_quality': ('3.3',), diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 2534868751d5..51e5a5582ec5 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -784,7 +784,11 @@ class HTMLWriter(FileMovieWriter): """Writer for JavaScript-based HTML movies.""" supported_formats = ['png', 'jpeg', 'tiff', 'svg'] - _args_key = 'animation.html_args' + + @cbook.deprecated("3.3") + @property + def args_key(self): + return 'animation.html_args' @classmethod def isAvailable(cls): @@ -793,21 +797,23 @@ def isAvailable(cls): def __init__(self, fps=30, codec=None, bitrate=None, extra_args=None, metadata=None, embed_frames=False, default_mode='loop', embed_limit=None): + + if extra_args: + _log.warning("HTMLWriter ignores 'extra_args'") + extra_args = () # Don't lookup nonexistent rcParam[args_key]. self.embed_frames = embed_frames self.default_mode = default_mode.lower() + cbook._check_in_list(['loop', 'once', 'reflect'], + default_mode=self.default_mode) # Save embed limit, which is given in MB if embed_limit is None: self._bytes_limit = mpl.rcParams['animation.embed_limit'] else: self._bytes_limit = embed_limit - # Convert from MB to bytes self._bytes_limit *= 1024 * 1024 - cbook._check_in_list(['loop', 'once', 'reflect'], - default_mode=self.default_mode) - super().__init__(fps, codec, bitrate, extra_args, metadata) def setup(self, fig, outfile, dpi, frame_dir=None): diff --git a/matplotlibrc.template b/matplotlibrc.template index 999806d5f43c..b5076038a35d 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -728,7 +728,6 @@ #animation.bitrate: -1 # Controls size/quality tradeoff for movie. # -1 implies let utility auto-determine #animation.frame_format: png # Controls frame format used by temp files -#animation.html_args: # Additional arguments to pass to html writer #animation.ffmpeg_path: ffmpeg # Path to ffmpeg binary. Without full path # $PATH is searched #animation.ffmpeg_args: # Additional arguments to pass to ffmpeg