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

Method __getitem__

tables/link.py:302–313  ·  view source on GitHub ↗

Getitem magic method. The __getitem__ must be defined in the SoftLink class in order for array indexing syntax to work.

(self, key: str)

Source from the content-addressed store, hash-verified

300 self.dereference().__setattr__(attrname, value)
301
302 def __getitem__(self, key: str) -> Any:
303 """Getitem magic method.
304
305 The __getitem__ must be defined in the SoftLink class in order
306 for array indexing syntax to work.
307 """
308 if not self._v_isopen:
309 raise tb.ClosedNodeError("the node object is closed")
310 elif self.is_dangling():
311 raise ValueError("softlink target does not exist")
312 else:
313 return self.dereference().__getitem__(key)
314
315 def __setitem__(self, key: str, value: Any) -> None:
316 """Setitem magic method.

Callers

nothing calls this directly

Calls 2

is_danglingMethod · 0.95
dereferenceMethod · 0.95

Tested by

no test coverage detected