[python-hdf5storage] 133/152: Renamed all the different string converters in utilities from starting with decode_to to convert_to

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:42 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 e3fa8a10bb2ef60f99b518211d53f8eca9ae70eb
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Sat Feb 15 21:57:04 2014 -0500

    Renamed all the different string converters in utilities from starting with decode_to to convert_to
---
 doc/source/hdf5storage.utilities.rst | 24 ++++++++++++------------
 hdf5storage/Marshallers.py           |  8 ++++----
 hdf5storage/utilities.py             | 32 ++++++++++++++++----------------
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/doc/source/hdf5storage.utilities.rst b/doc/source/hdf5storage.utilities.rst
index 91ee266..ca2f72d 100644
--- a/doc/source/hdf5storage.utilities.rst
+++ b/doc/source/hdf5storage.utilities.rst
@@ -10,9 +10,9 @@ hdf5storage.utilities
    next_unused_name_in_group
    convert_numpy_str_to_uint16
    convert_numpy_str_to_uint32
-   decode_to_str
-   decode_to_numpy_str
-   decode_to_numpy_bytes
+   convert_to_str
+   convert_to_numpy_str
+   convert_to_numpy_bytes
    decode_complex
    encode_complex
    get_attribute
@@ -42,22 +42,22 @@ convert_numpy_str_to_uint32
 .. autofunction:: convert_numpy_str_to_uint32
 
 
-decode_to_str
--------------
+convert_to_str
+--------------
 
-.. autofunction:: decode_to_str
+.. autofunction:: convert_to_str
 
 
-decode_to_numpy_str
--------------------
+convert_to_numpy_str
+--------------------
 
-.. autofunction:: decode_to_numpy_str
+.. autofunction:: convert_to_numpy_str
 
 
-decode_to_numpy_bytes
----------------------
+convert_to_numpy_bytes
+----------------------
 
-.. autofunction:: decode_to_numpy_bytes
+.. autofunction:: convert_to_numpy_bytes
 
 
 decode_complex
diff --git a/hdf5storage/Marshallers.py b/hdf5storage/Marshallers.py
index 59bb813..859de1c 100644
--- a/hdf5storage/Marshallers.py
+++ b/hdf5storage/Marshallers.py
@@ -1037,17 +1037,17 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
                 if underlying_type == 'bytes':
                     data = np.bytes_(b'')
                 else:
-                    data = decode_to_numpy_bytes(data, \
+                    data = convert_to_numpy_bytes(data, \
                         length=int(underlying_type[5:])//8)
             elif underlying_type.startswith('str') \
                     or matlab_class == 'char':
                 if underlying_type == 'str':
                     data = np.str_('')
                 elif underlying_type.startswith('str'):
-                    data = decode_to_numpy_str(data, \
+                    data = convert_to_numpy_str(data, \
                         length=int(underlying_type[3:])//32)
                 else:
-                    data = decode_to_numpy_str(data)
+                    data = convert_to_numpy_str(data)
 
             # If the shape of data and the shape attribute are
             # different but give the same number of elements, then data
@@ -1115,7 +1115,7 @@ class NumpyScalarArrayMarshaller(TypeMarshaller):
             # If it is a 'char' type, the proper conversion to
             # numpy.unicode needs to be done.
             if matlab_class == 'char':
-                data = decode_to_numpy_str(data)
+                data = convert_to_numpy_str(data)
 
         # Done adjusting data, so it can be returned.
         return data
diff --git a/hdf5storage/utilities.py b/hdf5storage/utilities.py
index 21571a8..fed65c5 100644
--- a/hdf5storage/utilities.py
+++ b/hdf5storage/utilities.py
@@ -182,7 +182,7 @@ def convert_numpy_str_to_uint32(data):
         shape[-1] *= data.dtype.itemsize//4
         return data.flatten().view(np.uint32).reshape(tuple(shape))
 
-def decode_to_str(data):
+def convert_to_str(data):
     """ Decodes data to the Python str type.
 
     Decodes `data` to a Python str, which is. If it can't be decoded, it
@@ -202,8 +202,8 @@ def decode_to_str(data):
 
     See Also
     --------
-    decode_to_numpy_str
-    decode_to_numpy_bytes
+    convert_to_numpy_str
+    convert_to_numpy_bytes
 
     """
     # How the conversion is done depends on the exact  underlying
@@ -238,7 +238,7 @@ def decode_to_str(data):
         return data
 
 
-def decode_to_numpy_str(data, length=None):
+def convert_to_numpy_str(data, length=None):
     """ Decodes data to Numpy unicode string (str_).
 
     Decodes `data` to Numpy unicode string (UTF-32), which is
@@ -279,8 +279,8 @@ def decode_to_numpy_str(data, length=None):
 
     See Also
     --------
-    decode_to_str
-    decode_to_numpy_bytes
+    convert_to_str
+    convert_to_numpy_bytes
     numpy.str_
 
     """
@@ -301,7 +301,7 @@ def decode_to_numpy_str(data, length=None):
         # They are single ASCII or UTF-16 scalars, and are easily
         # converted to a UTF-8 string and then passed through the
         # constructor.
-        return np.str_(decode_to_str(data))
+        return np.str_(convert_to_str(data))
     elif isinstance(data, np.uint32):
         # It is just the uint32 version of the character, so it just
         # needs to be have the dtype essentially changed by having its
@@ -323,7 +323,7 @@ def decode_to_numpy_str(data, length=None):
         # recursing the scalar value back into this function.
         shape = list(data.shape)
         if len(shape) == 0:
-            return decode_to_numpy_str(data[()])
+            return convert_to_numpy_str(data[()])
 
         # As there are more than one element, it gets a bit more
         # complicated. We need to take the subarrays of the specified
@@ -364,7 +364,7 @@ def decode_to_numpy_str(data, length=None):
                                          dtype=new_data.dtype,
                                          buffer=chunk.tostring())[()]
             else:
-                new_data[i] = np.str_(decode_to_str(chunk))
+                new_data[i] = np.str_(convert_to_str(chunk))
 
         # Only thing is left is to reshape it.
         return new_data.reshape(tuple(new_shape))
@@ -374,7 +374,7 @@ def decode_to_numpy_str(data, length=None):
         return data
 
 
-def decode_to_numpy_bytes(data, length=None):
+def convert_to_numpy_bytes(data, length=None):
     """ Decodes data to Numpy ASCII string (bytes_).
 
     Decodes `data` to a  Numpy ASCII string, which is
@@ -413,8 +413,8 @@ def decode_to_numpy_bytes(data, length=None):
 
     See Also
     --------
-    decode_to_str
-    decode_to_numpy_str
+    convert_to_str
+    convert_to_numpy_str
     numpy.bytes_
 
     """
@@ -431,7 +431,7 @@ def decode_to_numpy_bytes(data, length=None):
         # They are single UTF-16 or UTF-32 scalars, and are easily
         # converted to a UTF-8 string and then passed through the
         # constructor.
-        return np.bytes_(decode_to_str(data))
+        return np.bytes_(convert_to_str(data))
     elif isinstance(data, np.uint8):
         # It is just the uint8 version of the character, so it just
         # needs to be have the dtype essentially changed by having its
@@ -454,7 +454,7 @@ def decode_to_numpy_bytes(data, length=None):
         # recursing the scalar value back into this function.
         shape = list(data.shape)
         if len(shape) == 0:
-            return decode_to_numpy_bytes(data[()])
+            return convert_to_numpy_bytes(data[()])
 
         # As there are more than one element, it gets a bit more
         # complicated. We need to take the subarrays of the specified
@@ -495,7 +495,7 @@ def decode_to_numpy_bytes(data, length=None):
                                          dtype=new_data.dtype,
                                          buffer=chunk.tostring())[()]
             else:
-                new_data[i] = np.bytes_(decode_to_str(chunk))
+                new_data[i] = np.bytes_(convert_to_str(chunk))
 
         # Only thing is left is to reshape it.
         return new_data.reshape(tuple(new_shape))
@@ -714,7 +714,7 @@ def get_attribute_string_array(target, name):
     value = get_attribute(target, name)
     if value is None:
         return value
-    return [decode_to_str(x) for x in value]
+    return [convert_to_str(x) for x in value]
 
 
 def set_attribute(target, name, value):

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