[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Oct 5 11:10:49 PDT 2015


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/7ef3e3ac4771/
Changeset:   7ef3e3ac4771
Branch:      yt
User:        ngoldbaum
Date:        2015-09-15 04:17:58+00:00
Summary:     [png writer] handle API change in matplotlib 1.5
Affected #:  1 file

diff -r 4979406431c662b038db914287ae227092199b78 -r 7ef3e3ac47715d72fafcb8ca7f06c61835e744e4 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -10,19 +10,29 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
+import matplotlib
 import matplotlib._png as _png
 from yt.extern.six.moves import cStringIO
+from distutils.version import LooseVersion
+
+MPL_VERSION = LooseVersion(matplotlib.__version__)
 
 def write_png(buffer, filename, dpi=100):
     width = buffer.shape[1]
     height = buffer.shape[0]
-    _png.write_png(buffer, width, height, filename, dpi)
+    if MPL_VERSION < LooseVersion("1.5.0"):
+        _png.write_png(buffer, width, height, fileobj, dpi)
+    else:
+        _png.write_png(buffer, filename, dpi)
 
 def write_png_to_string(buffer, dpi=100, gray=0):
     width = buffer.shape[1]
     height = buffer.shape[0]
     fileobj = cStringIO()
-    _png.write_png(buffer, width, height, fileobj, dpi)
+    if MPL_VERSION < LooseVersion("1.5.0"):
+        _png.write_png(buffer, width, height, fileobj, dpi)
+    else:
+        _png.write_png(buffer, filename, dpi)
     png_str = fileobj.getvalue()
     fileobj.close()
     return png_str


https://bitbucket.org/yt_analysis/yt/commits/d54e612ed98c/
Changeset:   d54e612ed98c
Branch:      yt
User:        ngoldbaum
Date:        2015-09-15 04:21:16+00:00
Summary:     [png writer] Use the correct argument names
Affected #:  1 file

diff -r 7ef3e3ac47715d72fafcb8ca7f06c61835e744e4 -r d54e612ed98c69e51d36947f38ee7128b79a7cf2 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -21,7 +21,7 @@
     width = buffer.shape[1]
     height = buffer.shape[0]
     if MPL_VERSION < LooseVersion("1.5.0"):
-        _png.write_png(buffer, width, height, fileobj, dpi)
+        _png.write_png(buffer, width, height, filename, dpi)
     else:
         _png.write_png(buffer, filename, dpi)
 
@@ -32,8 +32,7 @@
     if MPL_VERSION < LooseVersion("1.5.0"):
         _png.write_png(buffer, width, height, fileobj, dpi)
     else:
-        _png.write_png(buffer, filename, dpi)
+        _png.write_png(buffer, fileobj, dpi)
     png_str = fileobj.getvalue()
     fileobj.close()
     return png_str
-


https://bitbucket.org/yt_analysis/yt/commits/c2f95a9aacc6/
Changeset:   c2f95a9aacc6
Branch:      yt
User:        ngoldbaum
Date:        2015-09-21 19:30:37+00:00
Summary:     Refactor MPL version selection to avoid repeat calls to LooseVersion
Affected #:  1 file

diff -r d54e612ed98c69e51d36947f38ee7128b79a7cf2 -r c2f95a9aacc69307f6832607cf8882f069446e79 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -16,23 +16,29 @@
 from distutils.version import LooseVersion
 
 MPL_VERSION = LooseVersion(matplotlib.__version__)
+MPL_API_2_VERSION = LooseVersion("1.5.0")
+
+if MPL_VERSION < MPL_API_2_VERSION:
+    MPL_API_VERSION = 1
+else:
+    MPL_API_VERSION = 2
+
+def call_png_write_png(buffer, width, height, filename, dpi):
+    if MPL_API_VERSION == 1:
+        _png.write_png(buffer, width, height, filename, dpi)
+    else:
+        _png.write_png(buffer, filename, dpi)
 
 def write_png(buffer, filename, dpi=100):
     width = buffer.shape[1]
     height = buffer.shape[0]
-    if MPL_VERSION < LooseVersion("1.5.0"):
-        _png.write_png(buffer, width, height, filename, dpi)
-    else:
-        _png.write_png(buffer, filename, dpi)
+    call_png_write_png(buffer, width, height, filename, dpi)
 
 def write_png_to_string(buffer, dpi=100, gray=0):
     width = buffer.shape[1]
     height = buffer.shape[0]
     fileobj = cStringIO()
-    if MPL_VERSION < LooseVersion("1.5.0"):
-        _png.write_png(buffer, width, height, fileobj, dpi)
-    else:
-        _png.write_png(buffer, fileobj, dpi)
+    call_png_write_png(buffer, width, height, fileobj, dpi)
     png_str = fileobj.getvalue()
     fileobj.close()
     return png_str


https://bitbucket.org/yt_analysis/yt/commits/165c5331859f/
Changeset:   165c5331859f
Branch:      yt
User:        ngoldbaum
Date:        2015-09-21 19:45:48+00:00
Summary:     Select png writer implementation at import time to avoid if statements
Affected #:  1 file

diff -r c2f95a9aacc69307f6832607cf8882f069446e79 -r 165c5331859f4dc5e48be7c7a6a72eacf252b337 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -19,14 +19,10 @@
 MPL_API_2_VERSION = LooseVersion("1.5.0")
 
 if MPL_VERSION < MPL_API_2_VERSION:
-    MPL_API_VERSION = 1
+    def call_png_write_png(buffer, width, height, filename, dpi):
+        _png.write_png(buffer, width, height, filename, dpi)
 else:
-    MPL_API_VERSION = 2
-
-def call_png_write_png(buffer, width, height, filename, dpi):
-    if MPL_API_VERSION == 1:
-        _png.write_png(buffer, width, height, filename, dpi)
-    else:
+    def call_png_write_png(buffer, width, height, filename, dpi):
         _png.write_png(buffer, filename, dpi)
 
 def write_png(buffer, filename, dpi=100):


https://bitbucket.org/yt_analysis/yt/commits/4cbd4de67d20/
Changeset:   4cbd4de67d20
Branch:      yt
User:        atmyers
Date:        2015-10-05 18:10:35+00:00
Summary:     Merged in ngoldbaum/yt (pull request #1752)

[png writer] handle API change in matplotlib 1.5
Affected #:  1 file

diff -r 3f2c5cceb57bcc022dd7a8363c793c09bf89f24d -r 4cbd4de67d20e65e062507ed6fa0dee102ac9ea8 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -10,20 +10,31 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
+import matplotlib
 import matplotlib._png as _png
 from yt.extern.six.moves import cStringIO
+from distutils.version import LooseVersion
+
+MPL_VERSION = LooseVersion(matplotlib.__version__)
+MPL_API_2_VERSION = LooseVersion("1.5.0")
+
+if MPL_VERSION < MPL_API_2_VERSION:
+    def call_png_write_png(buffer, width, height, filename, dpi):
+        _png.write_png(buffer, width, height, filename, dpi)
+else:
+    def call_png_write_png(buffer, width, height, filename, dpi):
+        _png.write_png(buffer, filename, dpi)
 
 def write_png(buffer, filename, dpi=100):
     width = buffer.shape[1]
     height = buffer.shape[0]
-    _png.write_png(buffer, width, height, filename, dpi)
+    call_png_write_png(buffer, width, height, filename, dpi)
 
 def write_png_to_string(buffer, dpi=100, gray=0):
     width = buffer.shape[1]
     height = buffer.shape[0]
     fileobj = cStringIO()
-    _png.write_png(buffer, width, height, fileobj, dpi)
+    call_png_write_png(buffer, width, height, fileobj, dpi)
     png_str = fileobj.getvalue()
     fileobj.close()
     return png_str
-

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list