lines.append(' '*depth + str(value))
return lines
+def h5_create_group(cwg, path):
+ "Create the group where the settings are stored (if necessary)."
+ gpath = ['']
+ for group in path.strip('/').split('/'):
+ gpath.append(group)
+ if group not in cwg.keys():
+ _LOG.debug('creating group %s in %s'
+ % ('/'.join(gpath), cwg.file))
+ cwg.create_group(group)
+ cwg = cwg[group]
class _HDF5Config (_BackedConfig):
"""Mixin to back a `_Config` class with an HDF5 file.
def _setup_file(self):
f = _h5py.File(self.filename, 'a')
cwg = f # current working group
-
- # Create the group where the settings are stored (if necessary)
- gpath = ['']
- for group in self.group.strip('/').split('/'):
- gpath.append(group)
- if group not in cwg.keys():
- _LOG.debug('creating group %s in %s'
- % ('/'.join(gpath), self.filename))
- cwg.create_group(group)
- cwg = cwg[group]
+ h5_create_group(cwg, self.group)
f.close()
def dump(self, help=False, from_file=False):