[python-hdf5storage] 64/152: Fixed bugs in numpy bools not being converted back to book from uint8 correctly.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:35 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 0.1
in repository python-hdf5storage.

commit 452ba799c3f0f6ebafbf1ff702ef4bb9368da012
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Thu Jan 30 00:55:05 2014 -0500

    Fixed bugs in numpy bools not being converted back to book from uint8 correctly.
---
 hdf5storage/Marshallers.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 13c6a81..aa44930 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -643,6 +643,12 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
             if underlying_type.startswith('complex'):
                 data = decode_complex(data)
 
+            # If its underlying type is 'bool' but it is something else,
+            # then it needs to be converted (means it was written with
+            # the convert_bools_to_uint8 option).
+            if underlying_type == 'bool' and data.dtype.name != 'bool':
+                data = np.bool_(data)
+
             # If MATLAB attributes are present or the reverse dimension
             # order option was given, the dimension order needs to be
             # reversed. This needs to be done before any reshaping as
@@ -658,12 +664,6 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
                     and np.prod(shape) == np.prod(data.shape):
                 data = data.reshape(tuple(shape))
 
-            # If its underlying type is 'bool' but it is something else,
-            # then it needs to be converted (means it was written with
-            # the convert_bools_to_uint8 option).
-            if underlying_type == 'bool8' and data.dtype.name != 'bool':
-                data = np.bool_(data)
-
             # Convert to scalar, matrix, or ndarray depending on the
             # container type. For an empty scalar string, it needs to be
             # manually set to '' and b'' or there will be problems.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git



More information about the debian-science-commits mailing list