Format the stack frames of the traceback
(self, records, last_unique, recursion_repeat)
| 882 | self.skip_hidden = True |
| 883 | |
| 884 | def format_records(self, records, last_unique, recursion_repeat): |
| 885 | """Format the stack frames of the traceback""" |
| 886 | frames = [] |
| 887 | |
| 888 | skipped = 0 |
| 889 | for r in records[:last_unique+recursion_repeat+1]: |
| 890 | if self.skip_hidden: |
| 891 | if r[0].f_locals.get("__tracebackhide__", 0): |
| 892 | skipped += 1 |
| 893 | continue |
| 894 | if skipped: |
| 895 | Colors = self.Colors # just a shorthand + quicker name lookup |
| 896 | ColorsNormal = Colors.Normal # used a lot |
| 897 | frames.append( |
| 898 | " %s[... skipping hidden %s frame]%s\n" |
| 899 | % (Colors.excName, skipped, ColorsNormal) |
| 900 | ) |
| 901 | skipped = 0 |
| 902 | |
| 903 | frames.append(self.format_record(*r)) |
| 904 | |
| 905 | if skipped: |
| 906 | Colors = self.Colors # just a shorthand + quicker name lookup |
| 907 | ColorsNormal = Colors.Normal # used a lot |
| 908 | frames.append( |
| 909 | " %s[... skipping hidden %s frame]%s\n" |
| 910 | % (Colors.excName, skipped, ColorsNormal) |
| 911 | ) |
| 912 | |
| 913 | if recursion_repeat: |
| 914 | frames.append('... last %d frames repeated, from the frame below ...\n' % recursion_repeat) |
| 915 | frames.append(self.format_record(*records[last_unique+recursion_repeat+1])) |
| 916 | |
| 917 | return frames |
| 918 | |
| 919 | def format_record(self, frame, file, lnum, func, lines, index): |
| 920 | """Format a single stack frame""" |
no test coverage detected