def big_ast(): """Generate a large AST.""" # Trickery to get the path of a near-by file. file_path = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'test_name.py', ) with open(file_path, 'r') as source_file: node = parse.parse(source_file.read()) # Duplicate the body several times. for x in range(5): node.body.extend(node.body) return node
def big_ast(): """Generate a large AST.""" # Trickery to get the path of a near-by file. file_path = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'test_name.py', ) with open(file_path, 'r') as source_file: node = parse.parse(source_file.read()) # Duplicate the body several times. for x in range(5): node.body.extend(node.body) return node
def node(): """Get as AST node from the source.""" return parse.parse(source)
def node(): return parse.parse(names_source)
def node(): return parse.parse(sample_source)