def _(arg, indent, out): out.append((indent, f"Function({_nameof(arg.fn)},")) quote.inplace(arg.output, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," quote.inplace(arg.args, indent + 1, out) i, line = out[-1] out[-1] = i, line + ")"
def _(arg, indent, out): line = f"{type(arg).__name__}({repr(arg.red_op)}, {repr(arg.bin_op)}," out.append((indent, line)) quote.inplace(arg.reduced_vars, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," quote.inplace(arg.terms, indent + 1, out) i, line = out[-1] out[-1] = i, line + ")"
def _(arg, indent, out): line = f"{type(arg).__name__}({repr(arg.sum_op)}, {repr(arg.prod_op)}," out.append((indent, line)) for value in arg._ast_values[2:]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," i, line = out[-1] out[-1] = i, line[:-1] + ")"
def _(arg, indent, out): line = "{}({}, {},".format( type(arg).__name__, repr(arg.red_op), repr(arg.bin_op)) out.append((indent, line)) quote.inplace(arg.reduced_vars, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," quote.inplace(arg.terms, indent + 1, out) i, line = out[-1] out[-1] = i, line + ")"
def _(arg, indent, out): line = "{}({}, {},".format( type(arg).__name__, repr(arg.sum_op), repr(arg.prod_op)) out.append((indent, line)) for value in arg._ast_values[2:]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," i, line = out[-1] out[-1] = i, line[:-1] + ")"
def quote_inplace_first_arg_on_first_line(arg, indent, out): line = f"{type(arg).__name__}({repr(arg._ast_values[0])}," out.append((indent, line)) for value in arg._ast_values[1:-1]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," for value in arg._ast_values[-1:]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + ")"
def _(arg, indent, out): name = type(arg).__name__ if type(arg).__module__ == 'funsor.distributions': name = 'dist.' + name out.append((indent, name + "(")) for value in arg._ast_values[:-1]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + "," for value in arg._ast_values[-1:]: quote.inplace(value, indent + 1, out) i, line = out[-1] out[-1] = i, line + ")"