MCPcopy Create free account
hub / github.com/enthought/apptools / _check_node

Method _check_node

apptools/io/h5/file.py:272–289  ·  view source on GitHub ↗

Check if node exists and create parent groups if necessary. Either raise error or delete depending on `delete_existing` attribute.

(self, node_path)

Source from the content-addressed store, hash-verified

270 return self[node_path]
271
272 def _check_node(self, node_path):
273 """Check if node exists and create parent groups if necessary.
274
275 Either raise error or delete depending on `delete_existing` attribute.
276 """
277 if self.auto_groups:
278 path, name = self.split_path(node_path)
279 self._create_required_groups(path)
280
281 if node_path in self:
282 if self.delete_existing:
283 if isinstance(self[node_path], H5Group):
284 self.remove_group(node_path, recursive=True)
285 else:
286 self.remove_node(node_path)
287 else:
288 msg = self.exists_error.format(node_path, self.filename)
289 raise ValueError(msg)
290
291 def _create_required_groups(self, path):
292 if path not in self:

Callers 4

create_arrayMethod · 0.95
create_groupMethod · 0.95
create_dictMethod · 0.95
create_tableMethod · 0.95

Calls 4

split_pathMethod · 0.95
remove_groupMethod · 0.95
remove_nodeMethod · 0.95

Tested by

no test coverage detected