MCPcopy
hub / github.com/Textualize/textual / _append

Method _append

src/textual/_node_list.py:118–131  ·  view source on GitHub ↗

Append a Widget. Args: widget: A widget.

(self, widget: Widget)

Source from the content-addressed store, hash-verified

116 return self._nodes_by_id.get(widget_id)
117
118 def _append(self, widget: Widget) -> None:
119 """Append a Widget.
120
121 Args:
122 widget: A widget.
123 """
124 if widget not in self._nodes_set:
125 self._nodes.append(widget)
126 self._nodes_set.add(widget)
127 widget_id = widget.id
128 if widget_id is not None:
129 self._ensure_unique_id(widget_id)
130 self._nodes_by_id[widget_id] = widget
131 self.updated()
132
133 def _insert(self, index: int, widget: Widget) -> None:
134 """Insert a Widget.

Callers 13

test_add_oneFunction · 0.95
test_length_hintFunction · 0.95
test_repeat_add_oneFunction · 0.95
test_insertFunction · 0.95
test_truthyFunction · 0.95
test_containsFunction · 0.95
test_indexFunction · 0.95
test_removeFunction · 0.95
test_clearFunction · 0.95
test_listyFunction · 0.95
compose_add_childMethod · 0.80
_add_childMethod · 0.80

Calls 4

_ensure_unique_idMethod · 0.95
updatedMethod · 0.95
appendMethod · 0.45
addMethod · 0.45

Tested by 10

test_add_oneFunction · 0.76
test_length_hintFunction · 0.76
test_repeat_add_oneFunction · 0.76
test_insertFunction · 0.76
test_truthyFunction · 0.76
test_containsFunction · 0.76
test_indexFunction · 0.76
test_removeFunction · 0.76
test_clearFunction · 0.76
test_listyFunction · 0.76