[h5py] 24/38: Fix lint issues in _hl/attrs
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:21:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository h5py.
commit 43a50a171bc199c0be395f708dd146016f92993b
Author: Andrew Collette <andrew.collette at gmail.com>
Date: Sat May 30 17:35:31 2015 -0600
Fix lint issues in _hl/attrs
---
h5py/_hl/attrs.py | 16 ++++++++++++----
h5py/_objects.pyx | 7 +++++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/h5py/_hl/attrs.py b/h5py/_hl/attrs.py
index a1c0e41..d0b604b 100644
--- a/h5py/_hl/attrs.py
+++ b/h5py/_hl/attrs.py
@@ -7,10 +7,16 @@
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
+"""
+ Implements high-level operations for attributes.
+
+ Provides the AttributeManager class, available on high-level objects
+ as <obj>.attrs.
+"""
+
from __future__ import absolute_import
import numpy
-import collections
from .. import h5s, h5t, h5a
from . import base
@@ -181,7 +187,7 @@ class AttributeManager(base.MutableMappingWithLock, base.CommonStateObject):
try:
attr.write(data, mtype=htype2)
except:
- attr._close()
+ attr.close()
h5a.delete(self._id, self._e(tempname))
raise
else:
@@ -191,7 +197,7 @@ class AttributeManager(base.MutableMappingWithLock, base.CommonStateObject):
h5a.delete(self._id, self._e(name))
h5a.rename(self._id, self._e(tempname), self._e(name))
except:
- attr._close()
+ attr.close()
h5a.delete(self._id, self._e(tempname))
raise
@@ -230,10 +236,12 @@ class AttributeManager(base.MutableMappingWithLock, base.CommonStateObject):
def __iter__(self):
""" Iterate over the names of attributes. """
with phil:
+
attrlist = []
-
def iter_cb(name, *args):
+ """ Callback to gather attribute names """
attrlist.append(self._d(name))
+
h5a.iterate(self._id, iter_cb)
for name in attrlist:
diff --git a/h5py/_objects.pyx b/h5py/_objects.pyx
index 6c42d43..438572c 100644
--- a/h5py/_objects.pyx
+++ b/h5py/_objects.pyx
@@ -212,6 +212,13 @@ cdef class ObjectID:
self.id = 0
+ def close(self):
+ """ Close this identifier. """
+ # Note this is the default close method. Subclasses, e.g. FileID,
+ # which have nonlocal effects should override this.
+ self._close()
+
+
def __nonzero__(self):
return self.valid
--
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