Пример #1
0
 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
Пример #2
0
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
Пример #3
0
 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
Пример #4
0
 def _matches_expansions(self, edge):
     for expansion in self.expansions:
         if edge_matches_pattern(edge, expansion):
             return True
     return False