def _rdbr(): try: from celery.contrib import rdb except ModuleNotFoundError as error: raise type(error)( "In order to install celery, use pdbr[celery]") from error return __set_style_theme(rich_pdb_klass(rdb.Rdb, is_celery=True))
def rich_ipdb_klass(*args, **kwargs): ripdb = rich_pdb_klass(TerminalPdb, show_layouts=False)(*args, **kwargs) # Set frame and stack related self-attributes ripdb.botframe = currentframe.f_back ripdb.setup(currentframe.f_back, None) # Set the console's file to stdout so that we can capture the output _console = Console( file=kwargs.get("stdout", sys.stdout), theme=Theme({ "info": "dim cyan", "warning": "magenta", "danger": "bold red" }), ) ripdb._console = _console return ripdb
def debugger_cls(klass=None, context=None, is_celery=False, show_layouts=True): if klass is None: try: from IPython.terminal.debugger import TerminalPdb klass = TerminalPdb except ImportError: from pdb import Pdb klass = Pdb RichPdb = rich_pdb_klass(klass, context=context, is_celery=is_celery, show_layouts=show_layouts) style, theme, history_file, ipython_history_file = read_config() RichPdb._style = style RichPdb._theme = theme RichPdb._history_file = history_file RichPdb._ipython_history_file = ipython_history_file return RichPdb
def _pdbr(): return __set_style_theme(rich_pdb_klass(debugger_cls()))
def RichPdb(): return rich_pdb_klass(pdb.Pdb)
def wrapper(): rpdb = rich_pdb_klass(pdb.Pdb, show_layouts=False)(*args, **kwargs) # Set frame and stack related self-attributes rpdb.botframe = currentframe.f_back rpdb.setup(currentframe.f_back, None) return rpdb