A minimal MovieWriter. It doesn't actually write anything. It just saves the arguments that were given to the setup() and grab_frame() methods as attributes, and counts how many times grab_frame() is called. This class doesn't have an __init__ method with the appropriate s
| 53 | |
| 54 | |
| 55 | class NullMovieWriter(animation.AbstractMovieWriter): |
| 56 | """ |
| 57 | A minimal MovieWriter. It doesn't actually write anything. |
| 58 | It just saves the arguments that were given to the setup() and |
| 59 | grab_frame() methods as attributes, and counts how many times |
| 60 | grab_frame() is called. |
| 61 | |
| 62 | This class doesn't have an __init__ method with the appropriate |
| 63 | signature, and it doesn't define an isAvailable() method, so |
| 64 | it cannot be added to the 'writers' registry. |
| 65 | """ |
| 66 | |
| 67 | def setup(self, fig, outfile, dpi, *args): |
| 68 | self.fig = fig |
| 69 | self.outfile = outfile |
| 70 | self.dpi = dpi |
| 71 | self.args = args |
| 72 | self._count = 0 |
| 73 | |
| 74 | def grab_frame(self, **savefig_kwargs): |
| 75 | from matplotlib.animation import _validate_grabframe_kwargs |
| 76 | _validate_grabframe_kwargs(savefig_kwargs) |
| 77 | self.savefig_kwargs = savefig_kwargs |
| 78 | self._count += 1 |
| 79 | |
| 80 | def finish(self): |
| 81 | pass |
| 82 | |
| 83 | |
| 84 | def test_null_movie_writer(anim): |
no outgoing calls
searching dependent graphs…