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

Function add_callers

Lib/pstats.py:612–627  ·  view source on GitHub ↗

Combine two caller lists in a single list.

(target, source)

Source from the content-addressed store, hash-verified

610 add_callers(t_callers, callers))
611
612def add_callers(target, source):
613 """Combine two caller lists in a single list."""
614 new_callers = {}
615 for func, caller in target.items():
616 new_callers[func] = caller
617 for func, caller in source.items():
618 if func in new_callers:
619 if isinstance(caller, tuple):
620 # format used by cProfile
621 new_callers[func] = tuple(i + j for i, j in zip(caller, new_callers[func]))
622 else:
623 # format used by profile
624 new_callers[func] += caller
625 else:
626 new_callers[func] = caller
627 return new_callers
628
629def count_calls(callers):
630 """Sum the caller statistics to get total number of calls received."""

Callers 1

add_func_statsFunction · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…