[python-hdf5storage] 12/84: Made it so that the MATLAB_fields Attribute is properly used on structures to order the fields in the right order.

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


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

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

commit 41731cf1c3ecafa194efd940b428244ff29e23e8
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Thu Aug 14 15:11:00 2014 -0400

    Made it so that the MATLAB_fields Attribute is properly used on structures to order the fields in the right order.
---
 hdf5storage/Marshallers.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 52ecb22..44a3c36 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -998,18 +998,20 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
             # not) and determine the dtype and shape of that field to
             # put in the list.
 
-            if python_fields is None:
-                fields = list(struct_data.keys())
-                fields.sort()
-            else:
-                fields = python_fields
+            if python_fields is not None or matlab_fields is not None:
+                if python_fields is not None:
+                    fields = python_fields
+                else:
+                    fields = [k.tostring().decode()
+                              for k in matlab_fields]
                 # Now, there may be fields available that were not
                 # given, but still should be read. Keys that are not in
                 # python_fields need to be added to the list.
                 extra_fields = list(set(struct_data.keys())
                                     - set(fields))
-                extra_fields.sort()
-                fields.extend(extra_fields)
+                fields.extend(sorted(extra_fields))
+            else:
+                fields = sorted(list(struct_data.keys()))
 
             dt_whole = []
             for k in fields:

-- 
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