示例#1
0
 def find_all_include_defs(self) -> List[include_def.IncludeDef]:
     """
     :return: all include_defs function calls.
     For example, for "include_defs("//foo/DEFS")" it will return [
         IncludeDef(
             Call(
                 func=Name(id='include_defs', ctx=Load()),
                 args=[Str(s='//foo/DEFS')], keywords=[])
             )
         )
     ]
     """
     return [
         include_def.from_ast_call(node)
         for node in ast.walk(self.ast_module)
         if isinstance(node, ast.Call) if isinstance(node.func, ast.Name)
         if node.func.id == "include_defs"
     ]
示例#2
0
文件: build_file.py 项目: shs96c/buck
 def find_all_include_defs(self) -> List[include_def.IncludeDef]:
     """
     :return: all include_defs function calls.
     For example, for "include_defs("//foo/DEFS")" it will return [
         IncludeDef(
             Call(
                 func=Name(id='include_defs', ctx=Load()),
                 args=[Str(s='//foo/DEFS')], keywords=[])
             )
         )
     ]
     """
     return [
         include_def.from_ast_call(node)
         for node in ast.walk(self.ast_module)
         if isinstance(node, ast.Call)
         if isinstance(node.func, ast.Name)
         if node.func.id == "include_defs"
     ]
示例#3
0
 def _parse_include_def(self, code: str) -> include_def.IncludeDef:
     return include_def.from_ast_call(ast.parse(code).body[0].value)
示例#4
0
 def _parse_include_def(self, code: str) -> include_def.IncludeDef:
     return include_def.from_ast_call(ast.parse(code).body[0].value)