From a3440816f64416cb1a9bd487ca4b5e87baf859d2 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Thu, 3 Aug 2017 10:35:28 +0200 Subject: [PATCH 1/7] workaround for islice int error --- lib/matplotlib/animation.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index ad3db64b5280..a40b902d1866 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1585,6 +1585,10 @@ def new_saved_frame_seq(self): # Generate an iterator for the sequence of saved data. If there are # no saved frames, generate a new frame sequence and take the first # save_count entries in it. + # itertools.islice can return an error when passed a numpy int instead + # of a native python int. This is a known issue:http://bugs.python.org/issue30537 + # As a workaround, enforce conversion to native python int + self.save_count = int(self.save_count) if self._save_seq: # While iterating we are going to update _save_seq # so make a copy to safely iterate over From 044ed3b35efa280a12c13cdef8b4468ba9777202 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Thu, 3 Aug 2017 13:18:48 +0200 Subject: [PATCH 2/7] changed position of int conversion --- lib/matplotlib/animation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index a40b902d1866..2b64d5fb23ed 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1543,7 +1543,6 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # Amount of framedata to keep around for saving movies. This is only # used if we don't know how many frames there will be: in the case # of no generator or in the case of a callable. - self.save_count = save_count # Set up a function that creates a new iterable when needed. If nothing # is passed in for frames, just use itertools.count, which will just @@ -1565,6 +1564,11 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # If we're passed in and using the default, set it to 100. if self.save_count is None: self.save_count = 100 + # itertools.islice can return an error when passed a numpy int instead + # of a native python int. This is a known issue: + # http://bugs.python.org/issue30537 + # As a workaround, enforce conversion to native python int. + self.save_count = int(save_count) self._init_func = init_func @@ -1585,10 +1589,6 @@ def new_saved_frame_seq(self): # Generate an iterator for the sequence of saved data. If there are # no saved frames, generate a new frame sequence and take the first # save_count entries in it. - # itertools.islice can return an error when passed a numpy int instead - # of a native python int. This is a known issue:http://bugs.python.org/issue30537 - # As a workaround, enforce conversion to native python int - self.save_count = int(self.save_count) if self._save_seq: # While iterating we are going to update _save_seq # so make a copy to safely iterate over From 1c60f48ce82bea4f8df9572b3350d848e0b8bf28 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Fri, 4 Aug 2017 14:09:52 +0200 Subject: [PATCH 3/7] added self --- lib/matplotlib/animation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 2b64d5fb23ed..1fd07c00530f 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1568,7 +1568,7 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # of a native python int. This is a known issue: # http://bugs.python.org/issue30537 # As a workaround, enforce conversion to native python int. - self.save_count = int(save_count) + self.save_count = int(self.save_count) self._init_func = init_func From 27e248acf9c49327a7f85ab20b039611e9beef27 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Mon, 7 Aug 2017 09:49:25 +0200 Subject: [PATCH 4/7] move into if statement --- lib/matplotlib/animation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 1fd07c00530f..a53e8c61b41c 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1562,13 +1562,14 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, self.save_count = frames # If we're passed in and using the default, set it to 100. - if self.save_count is None: - self.save_count = 100 # itertools.islice can return an error when passed a numpy int instead # of a native python int. This is a known issue: # http://bugs.python.org/issue30537 # As a workaround, enforce conversion to native python int. - self.save_count = int(self.save_count) + if self.save_count is None: + self.save_count = 100 + else: + self.save_count = int(self.save_count) self._init_func = init_func From 7d9a685a3cde921a5a53a54e492f43e0ca967196 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Tue, 8 Aug 2017 10:28:49 +0200 Subject: [PATCH 5/7] added save_count assignment back in --- lib/matplotlib/animation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index a53e8c61b41c..b338d1234710 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1543,7 +1543,7 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # Amount of framedata to keep around for saving movies. This is only # used if we don't know how many frames there will be: in the case # of no generator or in the case of a callable. - + self.save_count = save_count # Set up a function that creates a new iterable when needed. If nothing # is passed in for frames, just use itertools.count, which will just # keep counting from 0. A callable passed in for frames is assumed to @@ -1561,11 +1561,11 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, self._iter_gen = lambda: iter(xrange(frames)) self.save_count = frames - # If we're passed in and using the default, set it to 100. + # If we're passed in and using the default, set save_count to 100. # itertools.islice can return an error when passed a numpy int instead # of a native python int. This is a known issue: # http://bugs.python.org/issue30537 - # As a workaround, enforce conversion to native python int. + # As a workaround, enforce conversion of save_count to native python int. if self.save_count is None: self.save_count = 100 else: From a97567737c422ba683f07955bf7ce98b543fcd75 Mon Sep 17 00:00:00 2001 From: braaannigan Date: Tue, 8 Aug 2017 11:57:28 +0200 Subject: [PATCH 6/7] remove period --- lib/matplotlib/animation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index b338d1234710..a5f91df49c42 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1565,7 +1565,7 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # itertools.islice can return an error when passed a numpy int instead # of a native python int. This is a known issue: # http://bugs.python.org/issue30537 - # As a workaround, enforce conversion of save_count to native python int. + # As a workaround, enforce conversion of save_count to native python int if self.save_count is None: self.save_count = 100 else: From a4f93e9e95ce9f13472cefec575b83170bdfa01d Mon Sep 17 00:00:00 2001 From: braaannigan Date: Tue, 8 Aug 2017 14:24:08 +0200 Subject: [PATCH 7/7] shorten line to < 80 --- lib/matplotlib/animation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index a5f91df49c42..e12b7829b07b 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1565,7 +1565,7 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # itertools.islice can return an error when passed a numpy int instead # of a native python int. This is a known issue: # http://bugs.python.org/issue30537 - # As a workaround, enforce conversion of save_count to native python int + # As a workaround, convert save_count to native python int if self.save_count is None: self.save_count = 100 else: