Identify HDF5 group based on key, delete/create group if needed.
(self, key: str, append: bool)
| 1979 | return s.read() |
| 1980 | |
| 1981 | def _identify_group(self, key: str, append: bool) -> Node: |
| 1982 | """Identify HDF5 group based on key, delete/create group if needed.""" |
| 1983 | group = self.get_node(key) |
| 1984 | |
| 1985 | # we make this assertion for mypy; the get_node call will already |
| 1986 | # have raised if this is incorrect |
| 1987 | assert self._handle is not None |
| 1988 | |
| 1989 | # remove the node if we are not appending |
| 1990 | if group is not None and not append: |
| 1991 | self._handle.remove_node(group, recursive=True) |
| 1992 | group = None |
| 1993 | |
| 1994 | if group is None: |
| 1995 | group = self._create_nodes_and_group(key) |
| 1996 | |
| 1997 | return group |
| 1998 | |
| 1999 | def _create_nodes_and_group(self, key: str) -> Node: |
| 2000 | """Create nodes from key and return group name.""" |
no test coverage detected