[python-hdf5storage] 142/152: Fixed bug on Python 2.6 where the encoding to bytes.decode needs to be given as the first positional argument as opposed to as a keyword argument.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:43 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 c0eaddfd083ebedec0f45f5e90a52b1f46cdca1c
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Sun Feb 16 00:53:11 2014 -0500

    Fixed bug on Python 2.6 where the encoding to bytes.decode needs to be given as the first positional argument as opposed to as a keyword argument.
---
 hdf5storage/utilities.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hdf5storage/utilities.py b/hdf5storage/utilities.py
index eb35905..d754f2b 100644
--- a/hdf5storage/utilities.py
+++ b/hdf5storage/utilities.py
@@ -219,23 +219,23 @@ def convert_to_str(data):
     if isinstance(data, (np.ndarray, np.uint8, np.uint16, np.uint32,
                   np.bytes_, np.unicode_)):
         if data.dtype.name == 'uint8':
-            return data.flatten().tostring().decode(encoding='ASCII')
+            return data.flatten().tostring().decode('ASCII')
         elif data.dtype.name == 'uint16':
-            return data.tostring().decode(encoding='UTF-16')
+            return data.tostring().decode('UTF-16')
         elif data.dtype.name == 'uint32':
-            return data.flatten.tostring().decode(encoding='UTF-32')
+            return data.flatten.tostring().decode('UTF-32')
         elif data.dtype.char == 'S':
-            return data.decode(encoding='ASCII')
+            return data.decode('ASCII')
         else:
             if isinstance(data, np.ndarray):
-                return data.flatten.tostring().decode(encoding='UTF-32',
+                return data.flatten.tostring().decode('UTF-32',
                                                       errors='replace')
             else:
                 return data.encode(encoding='UTF-32').decode( \
                     encoding='UTF-32', errors='replace')
 
     if isinstance(data, bytes):
-        return data.decode(encoding='ASCII')
+        return data.decode('ASCII')
     else:
         return data
 

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