class_docstr: Customizable crash handlers for IPython applications.
  
  Instances of this class provide a :meth:`__call__` method which can be
  used as a ``sys.excepthook``.  The :meth:`__call__` signature is::
  
      def __call__(self, etype, evalue, etb)
class_docstr_tok: ["Customizable","crash","handlers","for","IPython","applications",".","Instances","of","this","class","provide","a",":","meth",":","`","__call__","`","method","which","can","be","used","as","a","``","sys.excepthook","``",".","The",":","meth",":","`","__call__","`","signature","is",":",":","def","__call__","(","self",",","etype",",","evalue",",","etb",")"]
docstr: Handle an exception, call for compatible with sys.excepthook
docstr_tok: ["Handle","an","exception",",","call","for","compatible","with","sys.excepthook"]
code: def __call__(self, etype, evalue, etb):
      """Handle an exception, call for compatible with sys.excepthook"""
  
      # do not allow the crash handler to be called twice without reinstalling it
      # this prevents unlikely errors in the crash handling from entering an
      # infinite loop.
      sys.excepthook = sys.__excepthook__
  
      # Report tracebacks shouldn't use color in general (safer for users)
      color_scheme = "NoColor"
  
      # Use this ONLY for developer debugging (keep commented out for release)
      # color_scheme = 'Linux'   # dbg
      try:
          rptdir = self.app.ipython_dir
      except:
          rptdir = Path.cwd()
      if rptdir is None or not Path.is_dir(rptdir):
          rptdir = Path.cwd()
      report_name = rptdir / self.crash_report_fname
      # write the report filename into the instance dict so it can get
      # properly expanded out in the user message template
      self.crash_report_fname = report_name
      self.info["crash_report_fname"] = report_name
      TBhandler = ultratb.VerboseTB(
          color_scheme=color_scheme,
          long_header=1,
          call_pdb=self.call_pdb,
      )
      if self.call_pdb:
          TBhandler(etype, evalue, etb)
          return
      else:
          traceback = TBhandler.text(etype, evalue, etb, context=31)
  
      # print traceback to screen
      if self.show_crash_traceback:
          print(traceback, file=sys.stderr)
  
      # and generate a complete report on disk
      try:
          report = open(report_name, "w", encoding="utf-8")
      except:
          print(
              "Could not create crash report on disk.", file=sys.stderr
          )
          return
  
      with report:
          # Inform user on stderr of what happened
          print("\n" + "*" * 70 + "\n", file=sys.stderr)
          print(
              self.message_template.format(**self.info), file=sys.stderr
          )
  
          # Construct report on disk
          report.write(self.make_report(traceback))
  
      input("Hit <Enter> to quit (your terminal may close):")
  
file_path: catboost/contrib/python/ipython/py3/IPython/core/crashhandler.py
imports: import sys
  import traceback
  from pprint import pformat
  from pathlib import Path
  from IPython.core import ultratb
  from IPython.core.release import author_email
  from IPython.utils.sysinfo import sys_info
  from IPython.utils.py3compat import input
  from IPython.core.release import __version__
  from typing import Optional
label_desc: Use image node_id 2 for calling the CrashHandler obj's underlying member method code with example usage: obj.__call__(etype, evalue, etb) without return types