MCPcopy
hub / github.com/psf/black / remove

Method remove

src/blib2to3/pytree.py:167–180  ·  view source on GitHub ↗

Remove the node from the tree. Returns the position of the node in its parent's children before it was removed.

(self)

Source from the content-addressed store, hash-verified

165 self.was_changed = True
166
167 def remove(self) -> int | None:
168 """
169 Remove the node from the tree. Returns the position of the node in its
170 parent's children before it was removed.
171 """
172 if self.parent:
173 for i, node in enumerate(self.parent.children):
174 if node is self:
175 del self.parent.children[i]
176 self.parent.changed()
177 self.parent.invalidate_sibling_maps()
178 self.parent = None
179 return i
180 return None
181
182 @property
183 def next_sibling(self) -> NL | None:

Callers 11

visit_factorMethod · 0.80
insert_str_child_factoryFunction · 0.80
replace_childFunction · 0.80
wrap_in_parenthesesFunction · 0.80
make_grammarMethod · 0.80

Calls 2

changedMethod · 0.80

Tested by

no test coverage detected