示例#1
0
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))
示例#2
0
 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
示例#3
0
文件: utils.py 项目: cansarigol/pdbr
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
示例#4
0
def _pdbr():
    return __set_style_theme(rich_pdb_klass(debugger_cls()))
示例#5
0
def RichPdb():
    return rich_pdb_klass(pdb.Pdb)
示例#6
0
 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