shell.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:zeus 作者: getsentry 项目源码 文件源码
def shell():
    import IPython
    from flask.globals import _app_ctx_stack
    app = _app_ctx_stack.top.app
    banner = 'Python %s on %s\nIPython: %s\nApp: %s%s\nInstance: %s\n' % (
        sys.version, sys.platform, IPython.__version__, app.import_name,
        app.debug and ' [debug]' or '', app.instance_path,
    )

    ctx = {}

    startup = os.environ.get('PYTHONSTARTUP')
    if startup and os.path.isfile(startup):
        with open(startup, 'rb') as f:
            eval(compile(f.read(), startup, 'exec'), ctx)

    ctx.update(app.make_shell_context())

    IPython.embed(banner1=banner, user_ns=ctx)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号