[python-hdf5storage] 105/152: Renamed the store_type_information option to store_python_metadata.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:39 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 5bd9cfe294ac8fa2e89d0f7c4eadcc00d79fb5d8
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Tue Feb 11 23:54:43 2014 -0500

    Renamed the store_type_information option to store_python_metadata.
---
 doc/source/introduction.rst   | 22 +++++++++++-----------
 doc/source/storage_format.rst |  2 +-
 hdf5storage/Marshallers.py    | 18 +++++++++---------
 hdf5storage/__init__.py       | 30 +++++++++++++++---------------
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/doc/source/introduction.rst b/doc/source/introduction.rst
index 2d3dbc7..96a31c2 100644
--- a/doc/source/introduction.rst
+++ b/doc/source/introduction.rst
@@ -62,13 +62,13 @@ give precedence to the given :py:class:`Options` object).
    Functions in the various submodules only support the
    :py:class:`Options` object method of passing options.
 
-The two main options are :py:attr:`Options.store_type_information` and
+The two main options are :py:attr:`Options.store_python_metadata` and
 :py:attr:`Options.matlab_compatible`. A more minor option is
 :py:attr:`Options.oned_as`.
 
 
-store_type_information
-----------------------
+store_python_metadata
+---------------------
 
 ``bool``
 
@@ -140,10 +140,10 @@ compatible MAT file. The `format` keyword sets the MAT file format, with
 ``'7.3'`` being the HDF5 based format supported by this package and
 ``'5'`` and ``'4'`` being the non HDF5 based formats supported by
 SciPy. If you want the data to be able to be read accurately back into
-Python, you should set ``store_type_information=True``. Writing a couple
+Python, you should set ``store_python_metadata=True``. Writing a couple
 variables to a file looks like ::
 
-    hdf5storage.savemat('data.mat', {'foo': 2.3, 'bar': (1+2j)}, format='7.3', oned_as='column', store_type_information=True)
+    hdf5storage.savemat('data.mat', {'foo': 2.3, 'bar': (1+2j)}, format='7.3', oned_as='column', store_python_metadata=True)
 
 Then, to read variables back, we can either explicitly name the
 variables we want ::
@@ -196,7 +196,7 @@ other types must be converted to these types before being written to the
 HDF5 file, and without metadata, the conversion cannot be reversed.
 
     >>> hdf5storage.write(data=a, name='/', filename='data.h5',
-    ...                   store_type_information=False,
+    ...                   store_python_metadata=False,
     ...                   matlab_compatible=False)
     >>> hdf5storage.read(name='/', filename='data.h5')
     {'a': array(True, dtype=bool),
@@ -235,11 +235,11 @@ Including Python Metadata
 -------------------------
 
 Do the same thing, but now include Python metadata
-(``store_type_information == True``). This time, everything is read back
+(``store_python_metadata == True``). This time, everything is read back
 the same (or at least, it should) as it was written.
 
     >>> hdf5storage.write(data=a, name='/', filename='data_typeinfo.h5',
-    ...                   store_type_information=True,
+    ...                   store_python_metadata=True,
     ...                   matlab_compatible=False)
     >>> hdf5storage.read(name='/', filename='data_typeinfo.h5')
     {'a': True,
@@ -277,7 +277,7 @@ ordering instead of C ordering like Python does, and strings are stored
 in a subset of UTF-16 (no doublets) in the version 7.3 MAT files.
 
     >>> hdf5storage.write(data=a, name='/', filename='data.mat',
-    ...                   store_type_information=False,
+    ...                   store_python_metadata=False,
     ...                   matlab_compatible=True)
     >>> hdf5storage.read(name='/', filename='data.mat')
     {'a': array([[ True]], dtype=bool),
@@ -316,14 +316,14 @@ Including both Python And MATLAB Metadata
 -----------------------------------------
 
 Do the same thing, but now include both Python metadata
-(``store_type_information == True``) and MATLAB metadata
+(``store_python_metadata == True``) and MATLAB metadata
 (``matlab_compatible == True``). This time, everything is read back
 the same (or at least, it should) as it was written. The Python metadata
 allows the transformations done by making the stored data MATLAB
 compatible reversible.
 
     >>> hdf5storage.write(data=a, name='/', filename='data_typeinfo.mat',
-    ...                   store_type_information=True,
+    ...                   store_python_metadata=True,
     ...                   matlab_compatible=True)
     >>> hdf5storage.read(name='/', filename='data_typeinfo.mat')
     {'a': True,
diff --git a/doc/source/storage_format.rst b/doc/source/storage_format.rst
index 7a13946..e71fd47 100644
--- a/doc/source/storage_format.rst
+++ b/doc/source/storage_format.rst
@@ -106,7 +106,7 @@ Attributes
 ==========
 
 Many different HDF5 Attributes are set for each object written if the
-:py:attr:`Options.store_type_information` and/or
+:py:attr:`Options.store_python_metadata` and/or
 :py:attr:`Options.matlab_compatible` options are set. The attributes
 associated with each will be referred to as "Python Attributes" and
 "MATLAB Attributes" respectively. If neither of them are set, then no
diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 528ec31..a302c97 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -87,7 +87,7 @@ class TypeMarshaller(object):
         #: set of str
         #:
         #: ``set`` of attribute names the marshaller uses when
-        #: an ``Option.store_type_information`` is ``True``.
+        #: an ``Option.store_python_metadata`` is ``True``.
         self.python_attributes = {'Python.Type'}
 
         #: Attributes used for MATLAB compatibility.
@@ -242,16 +242,16 @@ class TypeMarshaller(object):
 
         # The metadata that is written depends on the format.
 
-        if options.store_type_information:
+        if options.store_python_metadata:
             set_attribute_string(grp[name], 'Python.Type', type_string)
 
-        # If we are not storing type information or doing MATLAB
+        # If we are not storing python information or doing MATLAB
         # compatibility, then attributes not in the python and/or
         # MATLAB lists need to be removed.
 
         attributes_used = set()
 
-        if options.store_type_information:
+        if options.store_python_metadata:
             attributes_used |= self.python_attributes
 
         if options.matlab_compatible:
@@ -524,14 +524,14 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
         TypeMarshaller.write_metadata(self, f, grp, name, data,
                                       type_string, options)
 
-        # Write the underlying numpy type if we are storing type
+        # Write the underlying numpy type if we are storing python
         # information.
 
-        # If we are storing type information; the shape, underlying
+        # If we are storing python information; the shape, underlying
         # numpy type, and its type of container ('scalar', 'ndarray', or
         # 'matrix') need to be stored.
 
-        if options.store_type_information:
+        if options.store_python_metadata:
             set_attribute(grp[name], 'Python.Shape',
                           np.uint64(data.shape))
             set_attribute_string(grp[name],
@@ -554,7 +554,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
         if data.size == 0  or ((data.dtype.type == np.bytes_ \
                 or data.dtype.type == np.str_)
                 and data.nbytes == 0):
-            if options.store_type_information:
+            if options.store_python_metadata:
                 set_attribute(grp[name], 'Python.Empty',
                                           np.uint8(1))
             else:
@@ -944,7 +944,7 @@ class PythonDictMarshaller(TypeMarshaller):
         # existing ones must be deleted.
 
         if options.store_shape_for_empty and len(data) == 0:
-            if options.store_type_information:
+            if options.store_python_metadata:
                 set_attribute(grp[name], 'Python.Empty',
                                           np.uint8(1))
             else:
diff --git a/hdf5storage/__init__.py b/hdf5storage/__init__.py
index 7209bf2..1f29927 100644
--- a/hdf5storage/__init__.py
+++ b/hdf5storage/__init__.py
@@ -77,7 +77,7 @@ class Options(object):
 
     Parameters
     ----------
-    store_type_information : bool, optional
+    store_python_metadata : bool, optional
         See Attributes.
     matlab_compatible : bool, optional
         See Attributes.
@@ -106,7 +106,7 @@ class Options(object):
 
     Attributes
     ----------
-    store_type_information : bool
+    store_python_metadata : bool
     matlab_compatible : bool
     delete_unused_variables : bool
     make_atleast_2d : bool
@@ -126,7 +126,7 @@ class Options(object):
         Collection of marshallers to disk.
 
     """
-    def __init__(self, store_type_information=True,
+    def __init__(self, store_python_metadata=True,
                  matlab_compatible=True,
                  delete_unused_variables=False,
                  make_atleast_2d=False,
@@ -141,7 +141,7 @@ class Options(object):
                  marshaller_collection=None):
         # Set the defaults.
 
-        self._store_type_information = True
+        self._store_python_metadata = True
         self._delete_unused_variables = False
         self._make_atleast_2d = False
         self._convert_numpy_bytes_to_utf16 = False
@@ -158,7 +158,7 @@ class Options(object):
         # do matlab_compatible last since it will override most of the
         # other ones.
 
-        self.store_type_information = store_type_information
+        self.store_python_metadata = store_python_metadata
         self.delete_unused_variables = delete_unused_variables
         self.make_atleast_2d = make_atleast_2d
         self.convert_numpy_bytes_to_utf16 = convert_numpy_bytes_to_utf16
@@ -192,8 +192,8 @@ class Options(object):
             self.marshaller_collection = MarshallerCollection()
 
     @property
-    def store_type_information(self):
-        """ Whether or not to store Python type information.
+    def store_python_metadata(self):
+        """ Whether or not to store Python metadata.
 
         bool
 
@@ -202,14 +202,14 @@ class Options(object):
         be read back into Python as the same type.
 
         """
-        return self._store_type_information
+        return self._store_python_metadata
 
-    @store_type_information.setter
-    def store_type_information(self, value):
+    @store_python_metadata.setter
+    def store_python_metadata(self, value):
         # Check that it is a bool, and then set it. This option does not
         # effect MATLAB compatibility
         if isinstance(value, bool):
-            self._store_type_information = value
+            self._store_python_metadata = value
 
     @property
     def matlab_compatible(self):
@@ -778,7 +778,7 @@ def write(data, path='/', filename='data.h5', truncate_existing=False,
     into `options` or as additional keywords that will be used to make
     one by ``options = Options(**keywords)``.
 
-    Two very important options are ``store_type_information`` and
+    Two very important options are ``store_python_metadata`` and
     ``matlab_compatible``, which are ``bool``. The first makes it so
     that enough metadata (HDF5 Attributes) are written that `data` can
     be read back accurately without it (or its contents if it is a
@@ -1036,7 +1036,7 @@ def read(path='/', filename='data.h5',
 
 
 def savemat(file_name, mdict, appendmat=True, format='7.3',
-            oned_as='row', store_type_information=True,
+            oned_as='row', store_python_metadata=True,
             marshaller_collection=None, truncate_existing=False,
             truncate_invalid_matlab=False, **keywords):
     """ Save a dictionary of python types to a MATLAB MAT file.
@@ -1069,7 +1069,7 @@ def savemat(file_name, mdict, appendmat=True, format='7.3',
         SciPy.
     oned_as : {'row', 'column'}, optional
         Whether 1D arrays should be turned into row or column vectors.
-    store_type_information : bool, optional
+    store_python_metadata : bool, optional
         Whether or not to store Python type information. Doing so allows
         most types to be read back perfectly. Only applicable if not
         dispatching to SciPy (`format` >= 7.3).
@@ -1126,7 +1126,7 @@ def savemat(file_name, mdict, appendmat=True, format='7.3',
         file_name = file_name + '.mat'
 
     # Make the options with matlab compatibility forced.
-    options = Options(store_type_information=store_type_information,
+    options = Options(store_python_metadata=store_python_metadata,
                       matlab_compatible=True, oned_as=oned_as,
                       marshaller_collection=marshaller_collection)
 

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