Check if node exists and create parent groups if necessary. Either raise error or delete depending on `delete_existing` attribute.
(self, node_path)
| 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: |
no test coverage detected