MCPcopy Index your code
hub / github.com/RustPython/RustPython / from_list

Method from_list

Lib/traceback.py:510–526  ·  view source on GitHub ↗

Create a StackSummary object from a supplied list of FrameSummary objects or old-style list of tuples.

(klass, a_list)

Source from the content-addressed store, hash-verified

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.

Callers 5

print_listFunction · 0.80
format_listFunction · 0.80
test_from_listMethod · 0.80
test_format_smokeMethod · 0.80

Calls 4

StackSummaryClass · 0.85
isinstanceFunction · 0.85
FrameSummaryClass · 0.85
appendMethod · 0.45

Tested by 3

test_from_listMethod · 0.64
test_format_smokeMethod · 0.64