MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / finish

Method finish

lib/matplotlib/animation.py:818–852  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

816 return super().grab_frame(**savefig_kwargs)
817
818 def finish(self):
819 # save the frames to an html file
820 if self.embed_frames:
821 fill_frames = _embedded_frames(self._saved_frames,
822 self.frame_format)
823 frame_count = len(self._saved_frames)
824 else:
825 # temp names is filled by FileMovieWriter
826 frame_count = len(self._temp_paths)
827 fill_frames = _included_frames(
828 frame_count, self.frame_format,
829 self._temp_paths[0].parent.relative_to(self.outfile.parent))
830 mode_dict = dict(once_checked='',
831 loop_checked='',
832 reflect_checked='')
833 mode_dict[self.default_mode + '_checked'] = 'checked'
834
835 interval = 1000 // self.fps
836
837 with open(self.outfile, 'w') as of:
838 of.write(JS_INCLUDE + STYLE_INCLUDE)
839 of.write(DISPLAY_TEMPLATE.format(id=uuid.uuid4().hex,
840 Nframes=frame_count,
841 fill_frames=fill_frames,
842 interval=interval,
843 **mode_dict))
844
845 # Duplicate the temporary file clean up logic from
846 # FileMovieWriter.finish. We cannot call the inherited version of
847 # finish because it assumes that there is a subprocess that we either
848 # need to call to merge many frames together or that there is a
849 # subprocess call that we need to clean up.
850 if self._tmpdir:
851 _log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
852 self._tmpdir.cleanup()
853
854
855class Animation:

Callers 1

finishMethod · 0.45

Calls 3

_embedded_framesFunction · 0.85
_included_framesFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected