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

Class RootGroup

tables/group.py:1136–1247  ·  view source on GitHub ↗

Root Group.

Source from the content-addressed store, hash-verified

1134
1135# Special definition for group root
1136class RootGroup(Group):
1137 """Root Group."""
1138
1139 def __init__(
1140 self, ptfile: File, name: str, title: str, new: bool, filters: Filters
1141 ) -> None:
1142 mydict = self.__dict__
1143
1144 # Set group attributes.
1145 self._v_version = obversion
1146 self._v_new = new
1147 if new:
1148 self._v_new_title = title
1149 self._v_new_filters = filters
1150 else:
1151 self._v_new_title = None
1152 self._v_new_filters = None
1153
1154 # Set node attributes.
1155 self._v_file = ptfile
1156 self._v_isopen = True # root is always open
1157 self._v_pathname = "/"
1158 self._v_name = "/"
1159 self._v_depth = 0
1160 self._v_max_group_width = ptfile.params["MAX_GROUP_WIDTH"]
1161 self._v__deleting = False
1162 self._v_objectid: int | None = None # later
1163
1164 # Only the root node has the file as a parent.
1165 # Bypass __setattr__ to avoid the ``Node._v_parent`` property.
1166 mydict["_v_parent"] = ptfile
1167 ptfile._node_manager.register_node(self, "/")
1168
1169 # hdf5extension operations (do before setting an AttributeSet):
1170 # Update node attributes.
1171 self._g_new(ptfile, name, init=True)
1172 # Open the node and get its object ID.
1173 self._v_objectid = self._g_open()
1174
1175 # Set disk attributes and read children names.
1176 #
1177 # This *must* be postponed because this method needs the root node
1178 # to be created and bound to ``File.root``.
1179 # This is an exception to the rule, handled by ``File.__init()__``.
1180 #
1181 # self._g_post_init_hook()
1182
1183 def _g_load_child(
1184 self,
1185 childname: str,
1186 ) -> ExternalLink | Group | Node | SoftLink | UnImplemented | Unknown:
1187 """Load a child node from disk.
1188
1189 The child node `childname` is loaded from disk and an adequate
1190 `Node` object is created and returned. If there is no such
1191 child, a `NoSuchNodeError` is raised.
1192
1193 """

Callers 1

__get_root_groupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected