Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples.
(klass, a_list)
| 508 | |
| 509 | @classmethod |
| 510 | def from_list(klass, a_list): |
| 511 | """ |
| 512 | Create a StackSummary object from a supplied list of |
| 513 | FrameSummary objects or old-style list of tuples. |
| 514 | """ |
| 515 | # While doing a fast-path check for isinstance(a_list, StackSummary) is |
| 516 | # appealing, idlelib.run.cleanup_traceback and other similar code may |
| 517 | # break this by making arbitrary frames plain tuples, so we need to |
| 518 | # check on a frame by frame basis. |
| 519 | result = StackSummary() |
| 520 | for frame in a_list: |
| 521 | if isinstance(frame, FrameSummary): |
| 522 | result.append(frame) |
| 523 | else: |
| 524 | filename, lineno, name, line = frame |
| 525 | result.append(FrameSummary(filename, lineno, name, line=line)) |
| 526 | return result |
| 527 | |
| 528 | def format_frame_summary(self, frame_summary, **kwargs): |
| 529 | """Format the lines for a single FrameSummary. |