MCPcopy Index your code
hub / github.com/python/cpython / function_as_string

Function function_as_string

Modules/_decimal/tests/deccheck.py:579–615  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

577 pass
578
579def function_as_string(t):
580 if t.contextfunc:
581 cargs = t.cop
582 pargs = t.pop
583 maxargs = t.maxop
584 cfunc = "c_func: %s(" % t.funcname
585 pfunc = "p_func: %s(" % t.funcname
586 maxfunc = "max_func: %s(" % t.funcname
587 else:
588 cself, cargs = t.cop[0], t.cop[1:]
589 pself, pargs = t.pop[0], t.pop[1:]
590 maxself, maxargs = t.maxop[0], t.maxop[1:]
591 cfunc = "c_func: %s.%s(" % (repr(cself), t.funcname)
592 pfunc = "p_func: %s.%s(" % (repr(pself), t.funcname)
593 maxfunc = "max_func: %s.%s(" % (repr(maxself), t.funcname)
594
595 err = cfunc
596 for arg in cargs:
597 err += "%s, " % repr(arg)
598 err = err.rstrip(", ")
599 err += ")\n"
600
601 err += pfunc
602 for arg in pargs:
603 err += "%s, " % repr(arg)
604 err = err.rstrip(", ")
605 err += ")"
606
607 if t.with_maxcontext:
608 err += "\n"
609 err += maxfunc
610 for arg in maxargs:
611 err += "%s, " % repr(arg)
612 err = err.rstrip(", ")
613 err += ")"
614
615 return err
616
617def raise_error(t):
618 global EXIT_STATUS

Callers 1

raise_errorFunction · 0.85

Calls 1

rstripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…