Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples.
(klass, a_list)
| 524 | |
| 525 | @classmethod |
| 526 | def from_list(klass, a_list): |
| 527 | """ |
| 528 | Create a StackSummary object from a supplied list of |
| 529 | FrameSummary objects or old-style list of tuples. |
| 530 | """ |
| 531 | # While doing a fast-path check for isinstance(a_list, StackSummary) is |
| 532 | # appealing, idlelib.run.cleanup_traceback and other similar code may |
| 533 | # break this by making arbitrary frames plain tuples, so we need to |
| 534 | # check on a frame by frame basis. |
| 535 | result = StackSummary() |
| 536 | for frame in a_list: |
| 537 | if isinstance(frame, FrameSummary): |
| 538 | result.append(frame) |
| 539 | else: |
| 540 | filename, lineno, name, line = frame |
| 541 | result.append(FrameSummary(filename, lineno, name, line=line)) |
| 542 | return result |
| 543 | |
| 544 | def format_frame_summary(self, frame_summary, **kwargs): |
| 545 | """Format the lines for a single FrameSummary. |