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

Method prune_tree

webarena/browser_env/html_tools/html_parser.py:398–405  ·  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

396 return tree
397
398 def prune_tree(self, dfs_count: int=1, max_depth: int=3, max_children: int=30,
399 max_sibling: int=3, keep_parent: bool=False) -> None:
400 # clone the tree
401 new_tree = copy.deepcopy(self.dom_tree)
402 nodes_to_keep = self.get_keep_elements(new_tree, self.keep, max_depth, max_children, max_sibling, dfs_count, keep_parent)
403 new_tree = self.prune(new_tree, nodes_to_keep)
404
405 self.dom_tree = new_tree
406
407 def get_segment(self, bid: str) -> str:
408 # clone the tree

Callers

nothing calls this directly

Calls 2

get_keep_elementsMethod · 0.95
pruneMethod · 0.95

Tested by

no test coverage detected