(self, color_scheme='NoColor', call_pdb=False, ostream=None, parent=None, config=None)
| 483 | tb_offset = 0 |
| 484 | |
| 485 | def __init__(self, color_scheme='NoColor', call_pdb=False, ostream=None, parent=None, config=None): |
| 486 | # Whether to call the interactive pdb debugger after printing |
| 487 | # tracebacks or not |
| 488 | super(TBTools, self).__init__(parent=parent, config=config) |
| 489 | self.call_pdb = call_pdb |
| 490 | |
| 491 | # Output stream to write to. Note that we store the original value in |
| 492 | # a private attribute and then make the public ostream a property, so |
| 493 | # that we can delay accessing sys.stdout until runtime. The way |
| 494 | # things are written now, the sys.stdout object is dynamically managed |
| 495 | # so a reference to it should NEVER be stored statically. This |
| 496 | # property approach confines this detail to a single location, and all |
| 497 | # subclasses can simply access self.ostream for writing. |
| 498 | self._ostream = ostream |
| 499 | |
| 500 | # Create color table |
| 501 | self.color_scheme_table = exception_colors() |
| 502 | |
| 503 | self.set_colors(color_scheme) |
| 504 | self.old_scheme = color_scheme # save initial value for toggles |
| 505 | |
| 506 | if call_pdb: |
| 507 | self.pdb = debugger.Pdb() |
| 508 | else: |
| 509 | self.pdb = None |
| 510 | |
| 511 | def _get_ostream(self): |
| 512 | """Output stream that exceptions are written to. |
nothing calls this directly
no test coverage detected