MCPcopy Index your code
hub / github.com/python/cpython / _ExceptionPrintContext

Class _ExceptionPrintContext

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

Source from the content-addressed store, hash-verified

999
1000
1001class _ExceptionPrintContext:
1002 def __init__(self):
1003 self.seen = set()
1004 self.exception_group_depth = 0
1005 self.need_close = False
1006
1007 def indent(self):
1008 return ' ' * (2 * self.exception_group_depth)
1009
1010 def emit(self, text_gen, margin_char=None):
1011 if margin_char is None:
1012 margin_char = '|'
1013 indent_str = self.indent()
1014 if self.exception_group_depth:
1015 indent_str += margin_char + ' '
1016
1017 if isinstance(text_gen, str):
1018 yield textwrap.indent(text_gen, indent_str, lambda line: True)
1019 else:
1020 for text in text_gen:
1021 yield textwrap.indent(text, indent_str, lambda line: True)
1022
1023
1024class TracebackException:

Callers 1

formatMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…