MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / prune_tree

Method prune_tree

miniwob++/html_tools/html_parser.py:383–390  ·  view source on GitHub ↗
(self, dfs_count: int=1, max_depth: int=3, max_children: int=30, 
                   max_sibling: int=3, keep_parent: bool=False)

Source from the content-addressed store, hash-verified

381 return tree
382
383 def prune_tree(self, dfs_count: int=1, max_depth: int=3, max_children: int=30,
384 max_sibling: int=3, keep_parent: bool=False) -> None:
385 # clone the tree
386 new_tree = copy.deepcopy(self.dom_tree)
387 nodes_to_keep = self.get_keep_elements(new_tree, self.keep, max_depth, max_children, max_sibling, dfs_count, keep_parent)
388 new_tree = self.prune(new_tree, nodes_to_keep)
389
390 self.dom_tree = new_tree
391
392 def get_segment(self, bid: str) -> str:
393 # clone the tree

Callers

nothing calls this directly

Calls 2

get_keep_elementsMethod · 0.95
pruneMethod · 0.95

Tested by

no test coverage detected