(stack: Stack, last: bool)
| 656 | |
| 657 | @group() |
| 658 | def render_stack(stack: Stack, last: bool) -> RenderResult: |
| 659 | if stack.frames: |
| 660 | stack_renderable: ConsoleRenderable = Panel( |
| 661 | self._render_stack(stack), |
| 662 | title="[traceback.title]Traceback [dim](most recent call last)", |
| 663 | style=background_style, |
| 664 | border_style="traceback.border", |
| 665 | expand=True, |
| 666 | padding=(0, 1), |
| 667 | ) |
| 668 | stack_renderable = Constrain(stack_renderable, self.width) |
| 669 | with console.use_theme(traceback_theme): |
| 670 | yield stack_renderable |
| 671 | |
| 672 | if stack.syntax_error is not None: |
| 673 | with console.use_theme(traceback_theme): |
| 674 | yield Constrain( |
| 675 | Panel( |
| 676 | self._render_syntax_error(stack.syntax_error), |
| 677 | style=background_style, |
| 678 | border_style="traceback.border.syntax_error", |
| 679 | expand=True, |
| 680 | padding=(0, 1), |
| 681 | width=self.width, |
| 682 | ), |
| 683 | self.width, |
| 684 | ) |
| 685 | yield Text.assemble( |
| 686 | (f"{stack.exc_type}: ", "traceback.exc_type"), |
| 687 | highlighter(stack.syntax_error.msg), |
| 688 | ) |
| 689 | elif stack.exc_value: |
| 690 | yield Text.assemble( |
| 691 | (f"{stack.exc_type}: ", "traceback.exc_type"), |
| 692 | highlighter(stack.exc_value), |
| 693 | ) |
| 694 | else: |
| 695 | yield Text.assemble((f"{stack.exc_type}", "traceback.exc_type")) |
| 696 | |
| 697 | for note in stack.notes: |
| 698 | yield Text.assemble(("[NOTE] ", "traceback.note"), highlighter(note)) |
| 699 | |
| 700 | if stack.is_group: |
| 701 | for group_no, group_exception in enumerate(stack.exceptions, 1): |
| 702 | grouped_exceptions: List[Group] = [] |
| 703 | for group_last, group_stack in loop_last(group_exception.stacks): |
| 704 | grouped_exceptions.append(render_stack(group_stack, group_last)) |
| 705 | yield "" |
| 706 | yield Constrain( |
| 707 | Panel( |
| 708 | Group(*grouped_exceptions), |
| 709 | title=f"Sub-exception #{group_no}", |
| 710 | border_style="traceback.group.border", |
| 711 | ), |
| 712 | self.width, |
| 713 | ) |
| 714 | |
| 715 | if not last: |
nothing calls this directly
no test coverage detected