Get the given `path` or create it if `create` is true. If `create` is true, `path` *must* be a string path and not a node, otherwise a `TypeError`will be raised.
(
self, path: Node | str, create: bool
)
| 900 | return RootGroup(self, root_uep, title=title, new=new, filters=filters) |
| 901 | |
| 902 | def _get_or_create_path( |
| 903 | self, path: Node | str, create: bool |
| 904 | ) -> Group | Node | RootGroup: |
| 905 | """Get the given `path` or create it if `create` is true. |
| 906 | |
| 907 | If `create` is true, `path` *must* be a string path and not a |
| 908 | node, otherwise a `TypeError`will be raised. |
| 909 | |
| 910 | """ |
| 911 | if create: |
| 912 | path = path._v_pathname if hasattr(path, "_v_pathname") else path |
| 913 | return self._create_path(path) |
| 914 | else: |
| 915 | return self.get_node(path) |
| 916 | |
| 917 | def _create_path(self, path: str) -> Group: |
| 918 | """Create the groups needed for the `path` to exist. |
no test coverage detected