MCPcopy Create free account
hub / github.com/ActiveState/code / remove

Method remove

recipes/Python/576966_DnTree/recipe-576966.py:177–201  ·  view source on GitHub ↗

Remove node and its subtree. dn --- distinguished name of node.

(self, dn)

Source from the content-addressed store, hash-verified

175 self.add(new_dn)
176
177 def remove(self, dn):
178 """Remove node and its subtree.
179
180 dn --- distinguished name of node.
181 """
182
183 if dn not in self.dn_set:
184 raise ValueError('A record with dn=%s doesn\'t exists!' % dn)
185
186 parent = self.get_parent_dn(dn)
187 fake_parent = self.get_fake_parent_dn(dn)
188
189 if parent != fake_parent:
190 self.fake_parent[fake_parent].remove(dn)
191
192 self.childs[parent].remove(dn)
193
194 if dn in self.childs.keys():
195 childs = tuple(self.childs[dn])
196 for i in childs:
197 self.remove(i)
198 self.childs.pop(dn)
199
200 self.parent.pop(dn)
201 self.dn_set.remove(dn)
202
203
204if __name__ == '__main__':

Callers 15

renameMethod · 0.95
acquireWriteMethod · 0.45
recipe-576960.pyFile · 0.45
recipe-576581.pyFile · 0.45
build_boidsMethod · 0.45
check_targetMethod · 0.45
relacheeFunction · 0.45
committed_revFunction · 0.45
recipe-576917.pyFile · 0.45
safe_removeFunction · 0.45
save_files_in_zipFunction · 0.45

Calls 4

get_parent_dnMethod · 0.95
get_fake_parent_dnMethod · 0.95
keysMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected