[h5py] 385/455: Allow anonymous group creation
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:53 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 8d7672e4d862f7b00526a07486f7c5bb756e210c
Author: andrewcollette <andrew.collette at gmail.com>
Date: Sun Feb 7 23:47:46 2010 +0000
Allow anonymous group creation
---
h5py/h5g.pyx | 19 +++++++++++++------
h5py/tests/low/test_h5g.py | 21 +++++++++++++++++++++
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/h5py/h5g.pyx b/h5py/h5g.pyx
index bbccf45..ef2ec9b 100644
--- a/h5py/h5g.pyx
+++ b/h5py/h5g.pyx
@@ -126,16 +126,23 @@ def open(ObjectID loc not None, char* name):
IF H5PY_18API:
- def create(ObjectID loc not None, char* name, PropID lcpl=None,
+ def create(ObjectID loc not None, char* name=NULL, PropID lcpl=None,
PropID gcpl=None):
- """(ObjectID loc, STRING name, PropLCID lcpl=None, PropGCID gcpl=None)
+ """(ObjectID loc, [STRING name,] PropLCID lcpl=None, PropGCID gcpl=None)
=> GroupID
- Create a new group, under a given parent group.
+ Create a new group, under a given parent group. If name is omitted,
+ an anonymous group will be created in the file.
"""
- return GroupID(H5Gcreate2(loc.id, name, pdefault(lcpl),
- pdefault(gcpl),
- H5P_DEFAULT))
+ cdef hid_t gid
+
+ if name != NULL:
+ gid = H5Gcreate2(loc.id, name, pdefault(lcpl), pdefault(gcpl), H5P_DEFAULT)
+ else:
+ gid = H5Gcreate_anon(loc.id, pdefault(gcpl), H5P_DEFAULT)
+
+ return GroupID(gid)
+
ELSE:
def create(ObjectID loc not None, char* name):
diff --git a/h5py/tests/low/test_h5g.py b/h5py/tests/low/test_h5g.py
new file mode 100644
index 0000000..19d7ae9
--- /dev/null
+++ b/h5py/tests/low/test_h5g.py
@@ -0,0 +1,21 @@
+
+from h5py import tests
+from h5py import *
+
+class TestCreate(tests.HTest):
+
+ def setUp(self):
+ self.fid, self.name = tests.gettemp()
+
+ def tearDown(self):
+ import os
+ self.fid.close()
+ os.unlink(self.name)
+
+ @tests.require(api=18)
+ def test_create_anon(self):
+ """ (H5G) Anonymous group creation """
+ gid = h5g.create(self.fid)
+ self.assert_(gid)
+ self.assertIsInstance(gid, h5g.GroupID)
+
--
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