From 299f8af83110eb982fa5d4a64210763cb3fefb4a Mon Sep 17 00:00:00 2001 From: Jacob McDonald Date: Thu, 14 Apr 2016 16:04:41 -0400 Subject: [PATCH 1/2] Updated to allow keyword args to be passed when using the `with saving()` construct --- lib/matplotlib/animation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 0f57bc604a36..34d0c7d3ba18 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -137,7 +137,7 @@ class AbstractMovieWriter(six.with_metaclass(abc.ABCMeta)): ''' @abc.abstractmethod - def setup(self, fig, outfile, dpi, *args): + def setup(self, fig, outfile, dpi, *args, **kwargs): ''' Perform setup for writing the movie file. @@ -163,13 +163,13 @@ def finish(self): 'Finish any processing for writing the movie.' @contextlib.contextmanager - def saving(self, fig, outfile, dpi, *args): + def saving(self, fig, outfile, dpi, *args, **kwargs): ''' Context manager to facilitate writing the movie file. All arguments are passed on to `setup`. ''' - self.setup(fig, outfile, dpi, *args) + self.setup(fig, outfile, dpi, *args, **kwargs) yield self.finish() @@ -246,7 +246,7 @@ def frame_size(self): width_inches, height_inches = self.fig.get_size_inches() return width_inches * self.dpi, height_inches * self.dpi - def setup(self, fig, outfile, dpi, *args): + def setup(self, fig, outfile, dpi, *args, **kwargs): ''' Perform setup for writing the movie file. From 653e240d5c8d4f41f783ac886009127c0ca1cfaf Mon Sep 17 00:00:00 2001 From: Jacob McDonald Date: Mon, 18 Apr 2016 15:05:28 -0400 Subject: [PATCH 2/2] Removed arbitrary argument lists from setup() --- lib/matplotlib/animation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 34d0c7d3ba18..f1e2420499ba 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -137,7 +137,7 @@ class AbstractMovieWriter(six.with_metaclass(abc.ABCMeta)): ''' @abc.abstractmethod - def setup(self, fig, outfile, dpi, *args, **kwargs): + def setup(self, fig, outfile, dpi): ''' Perform setup for writing the movie file. @@ -246,7 +246,7 @@ def frame_size(self): width_inches, height_inches = self.fig.get_size_inches() return width_inches * self.dpi, height_inches * self.dpi - def setup(self, fig, outfile, dpi, *args, **kwargs): + def setup(self, fig, outfile, dpi): ''' Perform setup for writing the movie file.