def _force_root_expansion(self, edge): force_root = False force_expansion = False for root_pattern in self.match_roots: if edge_matches_pattern(edge, root_pattern): force_root = True force_expansion = True elif inner_edge_matches_pattern(edge, root_pattern): force_expansion = True return force_root, force_expansion
def inner_edge_matches_pattern(edge, pattern): if edge.is_atom(): return False for subedge in edge: if edge_matches_pattern(subedge, pattern): return True for subedge in edge: if inner_edge_matches_pattern(subedge, pattern): return True return False
def _force_subtypes(self, edge): force_subtypes = False for st_pattern in self.match_subtypes: if edge_matches_pattern(edge, st_pattern): force_subtypes = True return force_subtypes
def _matches_expansions(self, edge): for expansion in self.expansions: if edge_matches_pattern(edge, expansion): return True return False