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

Class _ExceptionPrintContext

Lib/traceback.py:981–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

979
980
981class _ExceptionPrintContext:
982 def __init__(self):
983 self.seen = set()
984 self.exception_group_depth = 0
985 self.need_close = False
986
987 def indent(self):
988 return ' ' * (2 * self.exception_group_depth)
989
990 def emit(self, text_gen, margin_char=None):
991 if margin_char is None:
992 margin_char = '|'
993 indent_str = self.indent()
994 if self.exception_group_depth:
995 indent_str += margin_char + ' '
996
997 if isinstance(text_gen, str):
998 yield textwrap.indent(text_gen, indent_str, lambda line: True)
999 else:
1000 for text in text_gen:
1001 yield textwrap.indent(text, indent_str, lambda line: True)
1002
1003
1004class TracebackException:

Callers 1

formatMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected