[h5py] 182/455: Add is_hdf5

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:31 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 cc5b08fbddc95451232f2a3d92dc2f8d182fd7a0
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Dec 15 06:32:19 2008 +0000

    Add is_hdf5
---
 h5py/__init__.py  | 4 ++--
 h5py/highlevel.py | 9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/h5py/__init__.py b/h5py/__init__.py
index 546734f..7522156 100644
--- a/h5py/__init__.py
+++ b/h5py/__init__.py
@@ -31,14 +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, CoordsList
+from highlevel import File, Group, Dataset, Datatype, AttributeManager, CoordsList, is_hdf5
 from h5 import H5Error, get_config
 
 __doc__ = __doc__ % (version.version, version.hdf5_version, version.api_version)
 
 __all__ = ['h5', 'h5f', 'h5g', 'h5s', 'h5t', 'h5d', 'h5a', 'h5p', 'h5r',
            'h5z', 'h5i', 'version', 'File', 'Group', 'Dataset',
-           'Datatype', 'AttributeManager', 'CoordsList', 'H5Error', 'get_config']
+           'Datatype', 'AttributeManager', 'CoordsList', 'H5Error', 'get_config', 'is_hdf5']
 
 if version.api_version_tuple >= (1,8):
     import h5o, h5l
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index bece59d..3b8d075 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -65,6 +65,15 @@ if config.API_18:
 __all__ = ["File", "Group", "Dataset",
            "Datatype", "AttributeManager", "CoordsList"]
 
+def is_hdf5(fname):
+    fname = os.path.abspath(fname)
+    if os.path.isfile(fname):
+        try:
+            return h5f.is_hdf5(fname)
+        except H5Error:
+            pass
+    return False
+
 # === Base classes ============================================================
 
 class LockableObject(object):

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