MCPcopy Create free account
hub / github.com/PyTables/PyTables / _create_path

Method _create_path

tables/file.py:917–936  ·  view source on GitHub ↗

Create the groups needed for the `path` to exist. The group associated with the given `path` is returned.

(self, path: str)

Source from the content-addressed store, hash-verified

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,

Callers 1

_get_or_create_pathMethod · 0.95

Calls 1

_f_get_childMethod · 0.80

Tested by

no test coverage detected