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

Method __setitem__

tables/link.py:315–326  ·  view source on GitHub ↗

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

(self, key: str, value: Any)

Source from the content-addressed store, hash-verified

313 return self.dereference().__getitem__(key)
314
315 def __setitem__(self, key: str, value: Any) -> None:
316 """Setitem magic method.
317
318 The __setitem__ method must be defined in the SoftLink class
319 in order for array indexing syntax to work.
320 """
321 if not self._v_isopen:
322 raise tb.ClosedNodeError("the node object is closed")
323 elif self.is_dangling():
324 raise ValueError("softlink target does not exist")
325 else:
326 self.dereference().__setitem__(key, value)
327
328 def is_dangling(self) -> bool:
329 """Return True if the link is dangling."""

Callers

nothing calls this directly

Calls 2

is_danglingMethod · 0.95
dereferenceMethod · 0.95

Tested by

no test coverage detected