[h5py] 258/455: Re-export new vlen/enum type functions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:39 UTC 2015


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

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit ed43d0c7166b0adf45f3fa3c22399af2918b3318
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Jun 1 20:51:07 2009 +0000

    Re-export new vlen/enum type functions
---
 h5py/__init__.py  |  8 +++-----
 h5py/highlevel.py | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/h5py/__init__.py b/h5py/__init__.py
index 355d392..8ed6e8d 100644
--- a/h5py/__init__.py
+++ b/h5py/__init__.py
@@ -31,16 +31,14 @@ except ImportError, e:
 
 import utils, h5, h5a, h5d, h5f, h5fd, h5g, h5i, h5p, h5r, h5s, h5t, h5z, highlevel, version
 
-from highlevel import File, Group, Dataset, Datatype, AttributeManager, is_hdf5, CoordsList
+from highlevel import File, Group, Dataset, Datatype, AttributeManager, \
+                      is_hdf5, CoordsList, new_vlen, new_enum, get_vlen, get_enum
+
 from h5 import get_config
 from h5e import H5Error
 
 import filters, selections
 
-# re-export custom vlen routines
-new_vlen = h5t.py_new_vlen
-get_vlen = h5t.py_get_vlen
-
 __doc__ = __doc__ % (version.version, version.hdf5_version, version.api_version)
 
 __all__ = ['h5', 'h5f', 'h5g', 'h5s', 'h5t', 'h5d', 'h5a', 'h5p', 'h5r',
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index 9fbf111..88f5f7e 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -1216,5 +1216,42 @@ class Datatype(HLObject):
                 return "<Closed HDF5 named type>"
 
 
+# Re-export functions for new type infrastructure
+
+def new_vlen(basetype):
+    """ Create a NumPy dtype representing a variable-length type.
+
+    Currently only the native string type (str) is allowed.
+
+    The kind of the returned dtype is always "O"; metadata attached to the
+    dtype allows h5py to perform translation between HDF5 VL types and
+    native Python objects.
+    """
+    return h5t.py_new_vlen(basetype)
+
+def get_vlen(dtype):
+    """ Return the "base" type from a NumPy dtype which represents a 
+    variable-length type, or None if the type is not of variable length.
+
+    Currently only variable-length strings, created with new_vlen(), are
+    supported.
+    """
+    return h5t.py_get_vlen(dtype)
+
+def new_enum(dtype, values):
+    """ Create a new enumerated type, from an integer base type and dictionary
+    of values.
+
+    The values dict should contain string keys and int/long values.
+    """
+    return h5t.py_new_enum(numpy.dtype(dtype), values)
+
+def get_enum(dtype):
+    """ Extract the values dictionary from an enumerated type, returning None
+    if the given dtype does not represent an enum.
+    """
+    return h5t.py_get_enum(dtype)
+
+
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list