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

Method __init__

tables/attributeset.py:216–267  ·  view source on GitHub ↗

Create the basic structures to keep the attribute information. Reads all the HDF5 attributes (if any) on disk for the node "node". Parameters ---------- node The parent node

(self, node: Node)

Source from the content-addressed store, hash-verified

214 return self._g_getnode()
215
216 def __init__(self, node: Node) -> None:
217 """Create the basic structures to keep the attribute information.
218
219 Reads all the HDF5 attributes (if any) on disk for the node "node".
220
221 Parameters
222 ----------
223 node
224 The parent node
225
226 """
227 # Refuse to create an instance of an already closed node
228 if not node._v_isopen:
229 raise ClosedNodeError("the node for attribute set is closed")
230
231 dict_ = self.__dict__
232
233 self._g_new(node)
234 dict_["_v__nodefile"] = node._v_file
235 dict_["_v__nodepath"] = node._v_pathname
236 dict_["_v_attrnames"] = self._g_list_attr(node)
237 # The list of unimplemented attribute names
238 dict_["_v_unimplemented"] = []
239
240 # Get the file version format. This is an optimization
241 # in order to avoid accessing it too much.
242 try:
243 format_version = node._v_file.format_version
244 except AttributeError:
245 parsed_version = None
246 else:
247 if format_version == "unknown":
248 parsed_version = None
249 else:
250 parsed_version = tuple(map(int, format_version.split(".")))
251 dict_["_v__format_version"] = parsed_version
252 # Split the attribute list in system and user lists
253 dict_["_v_attrnamessys"] = []
254 dict_["_v_attrnamesuser"] = []
255 for attr in self._v_attrnames:
256 # put the attributes on the local dictionary to allow
257 # tab-completion
258 self.__getattr__(attr)
259 if issysattrname(attr):
260 self._v_attrnamessys.append(attr)
261 else:
262 self._v_attrnamesuser.append(attr)
263
264 # Sort the attributes
265 self._v_attrnames.sort()
266 self._v_attrnamessys.sort()
267 self._v_attrnamesuser.sort()
268
269 def _g_update_node_location(self, node: Node) -> None:
270 """Update the location information about the associated `node`."""

Callers

nothing calls this directly

Calls 5

__getattr__Method · 0.95
ClosedNodeErrorClass · 0.85
issysattrnameFunction · 0.85
_g_newMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected