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

Method _get_or_create_path

tables/file.py:902–915  ·  view source on GitHub ↗

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
    )

Source from the content-addressed store, hash-verified

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.

Callers 12

create_groupMethod · 0.95
create_tableMethod · 0.95
create_arrayMethod · 0.95
create_carrayMethod · 0.95
create_earrayMethod · 0.95
create_vlarrayMethod · 0.95
create_hard_linkMethod · 0.95
create_soft_linkMethod · 0.95
create_external_linkMethod · 0.95
_f_moveMethod · 0.80
_f_copyMethod · 0.80
_f_copy_childrenMethod · 0.80

Calls 2

_create_pathMethod · 0.95
get_nodeMethod · 0.95

Tested by

no test coverage detected