[h5py] 285/455: Update .create
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:42 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 ca5597555934b2dc08ea82fc36a5927deb5c29ce
Author: andrewcollette <andrew.collette at gmail.com>
Date: Thu Jun 18 20:23:43 2009 +0000
Update .create
---
docs/source/guide/attr.rst | 7 +++----
h5py/highlevel.py | 2 ++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/docs/source/guide/attr.rst b/docs/source/guide/attr.rst
index 1394c81..db9ae5e 100644
--- a/docs/source/guide/attr.rst
+++ b/docs/source/guide/attr.rst
@@ -34,16 +34,15 @@ Reference
Delete an attribute.
- .. method:: create(name, data=None, shape=None, dtype=None)
+ .. method:: create(name, data, shape=None, dtype=None)
- Create an attribute, optionally initializing it.
+ Create an attribute, initializing it to the given value.
name
Name of the new attribute (required)
data
- An array to initialize the attribute.
- Required unless "shape" is given.
+ An array to initialize the attribute. Required.
shape
Shape of the attribute. Overrides data.shape if both are
diff --git a/h5py/highlevel.py b/h5py/highlevel.py
index ec60425..04face9 100644
--- a/h5py/highlevel.py
+++ b/h5py/highlevel.py
@@ -1194,6 +1194,8 @@ class AttributeManager(_LockableObject, _DictCompat):
if shape is None:
raise ValueError('At least one of "shape" or "data" must be given')
+ data = data.reshape(shape)
+
space = h5s.create_simple(shape)
htype = h5t.py_create(dtype, logical=True)
--
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