Combine two caller lists in a single list.
(target, source)
| 576 | add_callers(t_callers, callers)) |
| 577 | |
| 578 | def add_callers(target, source): |
| 579 | """Combine two caller lists in a single list.""" |
| 580 | new_callers = {} |
| 581 | for func, caller in target.items(): |
| 582 | new_callers[func] = caller |
| 583 | for func, caller in source.items(): |
| 584 | if func in new_callers: |
| 585 | if isinstance(caller, tuple): |
| 586 | # format used by cProfile |
| 587 | new_callers[func] = tuple(i + j for i, j in zip(caller, new_callers[func])) |
| 588 | else: |
| 589 | # format used by profile |
| 590 | new_callers[func] += caller |
| 591 | else: |
| 592 | new_callers[func] = caller |
| 593 | return new_callers |
| 594 | |
| 595 | def count_calls(callers): |
| 596 | """Sum the caller statistics to get total number of calls received.""" |
no test coverage detected