def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.FunctionDef: """ Any `def name` definition. """ self.register_docstring(node) node.name = self.add_placeholder(node.name) self.generic_visit(node) return node
def visit_FunctionDef(self, node: ast.FunctionDef) -> Any: if is_name_to_change(node.name): if node.name.startswith('sample'): node.returns = ast.parse('Generator[Union[GExpr,Sample],Sample,None]').body[0].value elif node.name.startswith('evaluate_denotation'): node.returns = ast.parse('Generator[Union[GExpr,Any],Any,None]').body[0].value node.name = 'coro_' + node.name self.generic_visit(node) kw = meta(node)
def visit_FunctionDef(self, node: ast.FunctionDef): for i in range(len(node.args.args)): name = node.args.args[i].arg node.args.args[i].arg = self.get_new_sym(name) node.name = self.get_new_sym(node.name) # recursively change the symbols within the function for i in node.body: self.generic_visit(i) return node
def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.AST: node.name = self._get_replacement_identifier(node.name) return self.generic_visit(node)