Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecate clear_temp param/attr of FileMovieWriter. #16092

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 2 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,10 @@ use e.g. ``ax.set_xscale("log", base=10); ax.set_yscale("log", base=2)``.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This method is deprecated. If you previously reimplemented it in a subclass,
set the artist's picker instead with `.Artist.set_picker`.

*clear_temp* parameter and attribute of `.FileMovieWriter`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The *clear_temp* parameter and attribute of `.FileMovieWriter` is
deprecated. In the future, files placed in a temporary directory (using
``frame_prefix=None``, the default) will be cleared; files placed elsewhere
will not.
33 changes: 22 additions & 11 deletions doc/missing-references.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,10 @@
"doc/users/prev_whats_new/whats_new_2.1.0.rst:409"
],
"matplotlib.test": [
"doc/devel/testing.rst:84"
"doc/devel/testing.rst:79"
],
"matplotlib.testing.conftest.mpl_test_settings": [
"doc/devel/testing.rst:111"
"doc/devel/testing.rst:106"
]
},
"py:meth": {
Expand Down Expand Up @@ -624,7 +624,7 @@
"doc/api/prev_api_changes/api_changes_0.91.0.rst:34"
],
"matplotlib.tests.test_basic": [
"doc/devel/testing.rst:98"
"doc/devel/testing.rst:93"
]
},
"py:obj": {
Expand Down Expand Up @@ -816,8 +816,7 @@
],
"Timer": [
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.FigureCanvasBase.new_timer:2",
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.TimerBase:14",
"lib/matplotlib/backends/backend_nbagg.py:docstring of matplotlib.backends.backend_nbagg.FigureCanvasNbAgg.new_timer:2"
"lib/matplotlib/backend_bases.py:docstring of matplotlib.backend_bases.TimerBase:14"
],
"Tool": [
"doc/devel/MEP/MEP22.rst:60",
Expand Down Expand Up @@ -1137,25 +1136,28 @@
"lib/matplotlib/animation.py:docstring of matplotlib.animation.AVConvBase.isAvailable:1:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.args_key": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.bin_path": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.cleanup": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.clear_temp": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.exec_key": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.finish": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.frame_format": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.frame_size": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.grab_frame": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
Expand All @@ -1164,7 +1166,7 @@
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.output_args": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.saving": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
Expand All @@ -1173,7 +1175,7 @@
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.AVConvFileWriter.supported_formats": [
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:38:<autosummary>:1"
"doc/api/_as_gen/matplotlib.animation.AVConvFileWriter.rst:39:<autosummary>:1"
],
"matplotlib.animation.AVConvWriter.args_key": [
"doc/api/_as_gen/matplotlib.animation.AVConvWriter.rst:36:<autosummary>:1"
Expand Down Expand Up @@ -1232,6 +1234,9 @@
"matplotlib.animation.FFMpegFileWriter.cleanup": [
"doc/api/_as_gen/matplotlib.animation.FFMpegFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.FFMpegFileWriter.clear_temp": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FFMpegFileWriter.supported_formats:1:<autosummary>:1"
],
"matplotlib.animation.FFMpegFileWriter.exec_key": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.FFMpegFileWriter.supported_formats:1:<autosummary>:1"
],
Expand Down Expand Up @@ -1328,6 +1333,9 @@
"matplotlib.animation.HTMLWriter.cleanup": [
"doc/api/_as_gen/matplotlib.animation.HTMLWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.HTMLWriter.clear_temp": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.finish:1:<autosummary>:1"
],
"matplotlib.animation.HTMLWriter.exec_key": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.HTMLWriter.finish:1:<autosummary>:1"
],
Expand All @@ -1349,6 +1357,9 @@
"matplotlib.animation.ImageMagickFileWriter.cleanup": [
"doc/api/_as_gen/matplotlib.animation.ImageMagickFileWriter.rst:28:<autosummary>:1"
],
"matplotlib.animation.ImageMagickFileWriter.clear_temp": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.ImageMagickFileWriter.supported_formats:1:<autosummary>:1"
],
"matplotlib.animation.ImageMagickFileWriter.delay": [
"lib/matplotlib/animation.py:docstring of matplotlib.animation.ImageMagickFileWriter.supported_formats:1:<autosummary>:1"
],
Expand Down
17 changes: 14 additions & 3 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ def __init__(self, *args, **kwargs):
MovieWriter.__init__(self, *args, **kwargs)
self.frame_format = mpl.rcParams['animation.frame_format']

@cbook._delete_parameter("3.3", "clear_temp")
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
clear_temp=True):
"""
Expand Down Expand Up @@ -464,11 +465,20 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
else:
self._tmpdir = None
self.temp_prefix = frame_prefix
self.clear_temp = clear_temp
self._clear_temp = clear_temp
self._frame_counter = 0 # used for generating sequential file names
self._temp_paths = list()
self.fname_format_str = '%s%%07d.%s'

@cbook.deprecated("3.3")
@property
def clear_temp(self):
return self._clear_temp

@clear_temp.setter
def clear_temp(self, value):
self._clear_temp = value

@property
def frame_format(self):
"""
Expand Down Expand Up @@ -526,7 +536,7 @@ def cleanup(self):
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
self._tmpdir.cleanup()
else:
if self.clear_temp:
if self._clear_temp:
_log.debug('MovieWriter: clearing temporary paths=%s',
self._temp_paths)
for path in self._temp_paths:
Expand Down Expand Up @@ -824,7 +834,8 @@ def setup(self, fig, outfile, dpi, frame_dir=None):
else:
frame_prefix = None

super().setup(fig, outfile, dpi, frame_prefix, clear_temp=False)
super().setup(fig, outfile, dpi, frame_prefix)
self._clear_temp = False

def grab_frame(self, **savefig_kwargs):
if self.embed_frames:
Expand Down