Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WIP don't leave h5py open between method calls


lara object needs to read from archive. But when
you index into lara archive has already been closed.

lara would need to keep track of filename of archive.
  • Loading branch information...
commit bfbe783cfb19423bd60f3ae54eab8171828373a0 1 parent f080d27
@kwgoodman authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 la/
10 la/
@@ -178,13 +178,14 @@ def __getitem__(self, key):
f = h5py.File(self.filename, 'r')
if key in f:
if _is_archived_larry(f[key]):
- return lara(f[key])
+ x = lara(f[key])
+ f.close()
+ return x
msg = "%s is in the archive but it is not a larry."
raise KeyError(msg % key)
raise KeyError("A larry named %s is not in the archive." % key)
- f.close()
def __setitem__(self, key, value):
@@ -210,6 +211,11 @@ def __setitem__(self, key, value):
def __delitem__(self, key):
delete(self.filename, key)
+ def __contains__(self, key):
+ if key in self.keys():
+ return True
+ return False
def __repr__(self):
table = [['larry', 'dtype', 'shape']]
keys = self.keys()
Please sign in to comment.
Something went wrong with that request. Please try again.