@@ -76,6 +76,12 @@ def __getitem__(self, name):
76
76
writers = MovieWriterRegistry ()
77
77
78
78
79
+ def _deprecation_message (name ):
80
+ return ('MovieWriter.%s interacts poorly with the saving context-manager '
81
+ 'and has been deprecated in 1.5. This method will be removed in '
82
+ '1.6, please use `with writer.saving(...):` instead' % name )
83
+
84
+
79
85
class MovieWriter (object ):
80
86
'''
81
87
Base class for writing movies. Fundamentally, what a MovieWriter does is
@@ -159,8 +165,7 @@ def setup(self, *args, **kwargs):
159
165
The DPI (or resolution) for the file. This controls the size
160
166
in pixels of the resulting movie file.
161
167
'''
162
- warnings .warn ('setup interacts poorly with the saving context-manager' ,
163
- mplDeprecation )
168
+ warnings .warn (_deprecation_message ('setup' ), mplDeprecation )
164
169
self ._setup (* args , ** kwargs )
165
170
166
171
def _setup (self , fig , outfile , dpi ):
@@ -204,9 +209,7 @@ def _run(self):
204
209
205
210
def finish (self ):
206
211
'Finish any processing for writing the movie.'
207
- warnings .warn (
208
- 'finish interacts poorly with the saving context-manager' ,
209
- mplDeprecation )
212
+ warnings .warn (_deprecation_message ('finish' ), mplDeprecation )
210
213
self .cleanup ()
211
214
212
215
def _finish (self ):
@@ -242,9 +245,7 @@ def _args(self):
242
245
243
246
def cleanup (self ):
244
247
'Clean-up and collect the process used to write the movie file.'
245
- warnings .warn (
246
- 'cleanup interacts poorly with the saving context-manager' ,
247
- mplDeprecation )
248
+ warnings .warn (_deprecation_message ('cleanup' ), mplDeprecation )
248
249
self ._cleanup ()
249
250
250
251
def _cleanup (self ):
@@ -285,7 +286,7 @@ def isAvailable(cls):
285
286
class FileMovieWriter (MovieWriter ):
286
287
'`MovieWriter` subclass that handles writing to a file.'
287
288
def __init__ (self , * args , ** kwargs ):
288
- MovieWriter . __init__ ( self , * args , ** kwargs )
289
+ super ( FileMovieWriter , self ). __init__ ( * args , ** kwargs )
289
290
self .frame_format = rcParams ['animation.frame_format' ]
290
291
291
292
def _setup (self , fig , outfile , dpi , frame_prefix = '_tmp' , clear_temp = True ,
@@ -390,7 +391,7 @@ def _finish(self):
390
391
# Call run here now that all frame grabbing is done. All temp files
391
392
# are available to be assembled.
392
393
self ._run ()
393
- MovieWriter ._finish (self )
394
+ super ( FileMovieWriter , self ) ._finish ()
394
395
395
396
# Check error code for creating file here, since we just run
396
397
# the process here, rather than having an open pipe.
@@ -400,7 +401,7 @@ def _finish(self):
400
401
+ ' Try running with --verbose-debug' )
401
402
402
403
def _cleanup (self ):
403
- MovieWriter ._cleanup (self )
404
+ super ( FileMovieWriter , self ) ._cleanup ()
404
405
405
406
# Delete temporary files
406
407
if self .clear_temp :
0 commit comments