Combine two caller lists in a single list.
(target, source)
| 610 | add_callers(t_callers, callers)) |
| 611 | |
| 612 | def 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 | |
| 629 | def count_calls(callers): |
| 630 | """Sum the caller statistics to get total number of calls received.""" |
no test coverage detected
searching dependent graphs…