[python-hdf5storage] 123/152: Changed the default marshaller for HDF5 Groups to be NumpyScalarArrayMarshaller as opposed to PythonDictMarshaller.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:41 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 7e261a82918251435822e00affa3f0913bb57279
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Fri Feb 14 17:29:31 2014 -0500
Changed the default marshaller for HDF5 Groups to be NumpyScalarArrayMarshaller as opposed to PythonDictMarshaller.
---
hdf5storage/Marshallers.py | 5 +++--
hdf5storage/lowlevel.py | 13 +++++--------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 72e8828..560b476 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -1208,8 +1208,9 @@ class PythonDictMarshaller(TypeMarshaller):
self.types = [dict]
self.python_type_strings = ['dict']
self.__MATLAB_classes = {dict: 'struct'}
- # Set matlab_classes to the supported classes (the values).
- self.matlab_classes = list(self.__MATLAB_classes.values())
+ # Set matlab_classes to empty since NumpyScalarArrayMarshaller
+ # handles Groups by default now.
+ self.matlab_classes = list()
def write(self, f, grp, name, data, type_string, options):
# If the group doesn't exist, it needs to be created. If it
diff --git a/hdf5storage/lowlevel.py b/hdf5storage/lowlevel.py
index 379dbfa..487670a 100644
--- a/hdf5storage/lowlevel.py
+++ b/hdf5storage/lowlevel.py
@@ -162,10 +162,10 @@ def read_data(f, grp, name, options):
# If the type_string is present, get the marshaller for it. If it is
# not, use the one for the matlab class if it is given. Otherwise,
- # use the fallback (NumpyScalarArrayMarshaller for Datasets and
- # PythonDictMarshaller for Groups). If calls to the marshaller
- # collection to get the right marshaller don't return one (return
- # None), we also go to the default).
+ # use the fallback (NumpyScalarArrayMarshaller for both Datasets and
+ # Groups). If calls to the marshaller collection to get the right
+ # marshaller don't return one (return None), we also go to the
+ # default).
m = None
mc = options.marshaller_collection
@@ -175,10 +175,7 @@ def read_data(f, grp, name, options):
m = mc.get_marshaller_for_matlab_class(matlab_class)
if m is None:
- if isinstance(grp[name], h5py.Dataset):
- m = mc.get_marshaller_for_type(np.uint8)
- else:
- m = mc.get_marshaller_for_type(dict)
+ m = mc.get_marshaller_for_type(np.uint8)
# If a marshaller was found, use it to write the data. Otherwise,
# return an error.
--
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