Create the groups needed for the `path` to exist. The group associated with the given `path` is returned.
(self, path: str)
| 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. |
| 919 | |
| 920 | The group associated with the given `path` is returned. |
| 921 | |
| 922 | """ |
| 923 | if not hasattr(path, "split"): |
| 924 | raise TypeError("when creating parents, parent must be a path") |
| 925 | |
| 926 | if path == "/": |
| 927 | return self.root |
| 928 | |
| 929 | parent, create_group = self.root, self.create_group |
| 930 | for pcomp in path.split("/")[1:]: |
| 931 | try: |
| 932 | child = parent._f_get_child(pcomp) |
| 933 | except NoSuchNodeError: |
| 934 | child = create_group(parent, pcomp) |
| 935 | parent = child |
| 936 | return parent |
| 937 | |
| 938 | def create_group( |
| 939 | self, |
no test coverage detected