Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WIP fix io.__repr__

  • Loading branch information...
commit 3102d445647e066c2eea6227b20092c866674c1a 1 parent bfbe783
@kwgoodman authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 la/io.py
View
8 la/io.py
@@ -220,12 +220,15 @@ def __repr__(self):
table = [['larry', 'dtype', 'shape']]
keys = self.keys()
keys.sort() # Display in alphabetical order
+ f = h5py.File(self.filename, 'r')
for key in keys:
# Code would be neater if I wrote shape = str(self[key].shape)
# but I don't want to load the array, I just want the shape
- shape = str(self.f[key]['x'].shape)
- dtype = str(self.f[key]['x'].dtype)
+ x = f[key]['x']
+ shape = str(x.shape)
+ dtype = str(x.dtype)
table.append([key, dtype, shape])
+ f.close()
return indent(table, hasHeader=True, delim=' ')
@property
@@ -317,6 +320,7 @@ def __init__(self, group):
<class 'la.deflarry.larry'>
"""
+
self.x = group['x']
self.label = _load_label(group, len(self.x.shape))
Please sign in to comment.
Something went wrong with that request. Please try again.