MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _ExceptionPrintContext

Class _ExceptionPrintContext

tools/python-3.11.9-amd64/Lib/traceback.py:651–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649
650
651class _ExceptionPrintContext:
652 def __init__(self):
653 self.seen = set()
654 self.exception_group_depth = 0
655 self.need_close = False
656
657 def indent(self):
658 return ' ' * (2 * self.exception_group_depth)
659
660 def emit(self, text_gen, margin_char=None):
661 if margin_char is None:
662 margin_char = '|'
663 indent_str = self.indent()
664 if self.exception_group_depth:
665 indent_str += margin_char + ' '
666
667 if isinstance(text_gen, str):
668 yield textwrap.indent(text_gen, indent_str, lambda line: True)
669 else:
670 for text in text_gen:
671 yield textwrap.indent(text, indent_str, lambda line: True)
672
673
674class TracebackException:

Callers 1

formatMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected