Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples.
(klass, a_list)
| 435 | |
| 436 | @classmethod |
| 437 | def from_list(klass, a_list): |
| 438 | """ |
| 439 | Create a StackSummary object from a supplied list of |
| 440 | FrameSummary objects or old-style list of tuples. |
| 441 | """ |
| 442 | # While doing a fast-path check for isinstance(a_list, StackSummary) is |
| 443 | # appealing, idlelib.run.cleanup_traceback and other similar code may |
| 444 | # break this by making arbitrary frames plain tuples, so we need to |
| 445 | # check on a frame by frame basis. |
| 446 | result = StackSummary() |
| 447 | for frame in a_list: |
| 448 | if isinstance(frame, FrameSummary): |
| 449 | result.append(frame) |
| 450 | else: |
| 451 | filename, lineno, name, line = frame |
| 452 | result.append(FrameSummary(filename, lineno, name, line=line)) |
| 453 | return result |
| 454 | |
| 455 | def format_frame_summary(self, frame_summary): |
| 456 | """Format the lines for a single FrameSummary. |
no test coverage detected