当前位置: 首页>>代码示例>>Python>>正文


Python bpython.embed方法代码示例

本文整理汇总了Python中bpython.embed方法的典型用法代码示例。如果您正苦于以下问题:Python bpython.embed方法的具体用法?Python bpython.embed怎么用?Python bpython.embed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bpython的用法示例。


在下文中一共展示了bpython.embed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _embed_ipython_shell

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def _embed_ipython_shell(namespace={}, banner=''):
    """Start an IPython Shell"""
    try:
        from IPython.terminal.embed import InteractiveShellEmbed
        from IPython.terminal.ipapp import load_default_config
    except ImportError:
        from IPython.frontend.terminal.embed import InteractiveShellEmbed
        from IPython.frontend.terminal.ipapp import load_default_config

    @wraps(_embed_ipython_shell)
    def wrapper(namespace=namespace, banner=''):
        config = load_default_config()
        # Always use .instace() to ensure _instance propagation to all parents
        # this is needed for <TAB> completion works well for new imports
        # and clear the instance to always have the fresh env
        # on repeated breaks like with inspect_response()
        InteractiveShellEmbed.clear_instance()
        shell = InteractiveShellEmbed.instance(
            banner1=banner, user_ns=namespace, config=config)
        shell()
    return wrapper 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:23,代码来源:console.py

示例2: get_shell_embed_func

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def get_shell_embed_func(shells=None, known_shells=None):
    """Return the first acceptable shell-embed function
    from a given list of shell names.
    """
    if shells is None: # list, preference order of shells
        shells = DEFAULT_PYTHON_SHELLS.keys()
    if known_shells is None: # available embeddable shells
        known_shells = DEFAULT_PYTHON_SHELLS.copy()
    for shell in shells:
        if shell in known_shells:
            try:
                # function test: run all setup code (imports),
                # but dont fall into the shell
                return known_shells[shell]()
            except ImportError:
                continue 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:18,代码来源:console.py

示例3: shell

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def shell(self, stage):
        self.set_up_yolofile_context(stage=stage)
        self._yolo_file = self.yolo_file.render(**self.context)

        # Set up AWS credentials for the shell
        self._setup_aws_credentials_in_environment(
            self.context.account.account_number,
            self.context.stage.region,
        )

        # Select Python shell
        if have_bpython:
            bpython.embed()
        elif have_ipython:
            start_ipython(argv=[])
        else:
            code.interact() 
开发者ID:rackerlabs,项目名称:yolo,代码行数:19,代码来源:client.py

示例4: prepare_client

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def prepare_client(image):
    """prepare a client to embed in a shell with recipe parsers and writers.
    """
    # The client will announce itself (backend/database) unless it's get
    from spython.main import get_client
    from spython.main.parse import parsers
    from spython.main.parse import writers

    client = get_client()

    if image:
        client.load(image)

    # Add recipe parsers
    client.parsers = parsers
    client.writers = writers
    return client 
开发者ID:singularityhub,项目名称:singularity-cli,代码行数:19,代码来源:shell.py

示例5: bpython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def bpython(self):
        import bpython
        bpython.embed() 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:5,代码来源:shell.py

示例6: bpython_console

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def bpython_console(self):
        """bpython console interpreter

        https://bpython-interpreter.org/
        """
        # pylint: disable=import-error
        import bpython
        bpython.embed(banner=self.banner)
        return 0 
开发者ID:nil0x42,项目名称:phpsploit,代码行数:11,代码来源:console.py

示例7: ipython_console

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def ipython_console(self):
        """IPython console interpreter

        https://ipython.org/
        """
        # pylint: disable=import-error
        import IPython
        print(colorize("%BoldWhite", self.banner))
        IPython.embed()
        return 0 
开发者ID:nil0x42,项目名称:phpsploit,代码行数:12,代码来源:console.py

示例8: ipython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def ipython(args):
    """give the user an ipython shell, optionally with an endpoint of choice.
    """

    # The client will announce itself (backend/database) unless it's get
    from sregistry.main import get_client

    client = get_client(args.endpoint)
    client.announce(args.command)
    from IPython import embed

    embed() 
开发者ID:singularityhub,项目名称:sregistry-cli,代码行数:14,代码来源:shell.py

示例9: bpython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def bpython(args):
    import bpython
    from sregistry.main import get_client

    client = get_client(args.endpoint)
    client.announce(args.command)
    from sregistry.database.models import Container, Collection

    bpython.embed(
        locals_={"client": client, "Container": Container, "Collection": Collection}
    ) 
开发者ID:singularityhub,项目名称:sregistry-cli,代码行数:13,代码来源:shell.py

示例10: run_ipython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def run_ipython(local):
    try:
        from IPython.frontend.terminal.embed import TerminalInteractiveShell
        shell = TerminalInteractiveShell(user_ns=local)
        shell.mainloop()
    except ImportError:
        # IPython < 0.11
        # Explicitly pass an empty list as arguments, because otherwise
        # IPython would use sys.argv from this script.
        from IPython.Shell import IPShell
        shell = IPShell(argv=[], user_ns=local)
        shell.mainloop() 
开发者ID:wikilinks,项目名称:neleval,代码行数:14,代码来源:interact.py

示例11: run_bpython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def run_bpython(local):
    import bpython
    bpython.embed(locals_=local) 
开发者ID:wikilinks,项目名称:neleval,代码行数:5,代码来源:interact.py

示例12: _embed_bpython_shell

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def _embed_bpython_shell(namespace={}, banner=''):
    """Start a bpython shell"""
    import bpython
    @wraps(_embed_bpython_shell)
    def wrapper(namespace=namespace, banner=''):
        bpython.embed(locals_=namespace, banner=banner)
    return wrapper 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:9,代码来源:console.py

示例13: _embed_ptpython_shell

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def _embed_ptpython_shell(namespace={}, banner=''):
    """Start a ptpython shell"""
    import ptpython.repl
    @wraps(_embed_ptpython_shell)
    def wrapper(namespace=namespace, banner=''):
        print(banner)
        ptpython.repl.embed(locals=namespace)
    return wrapper 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:10,代码来源:console.py

示例14: ipython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def ipython(image):
    """give the user an ipython shell
    """
    client = prepare_client(image)  # pylint: disable=unused-variable

    try:
        from IPython import embed
    except ImportError:
        return python(image)

    embed() 
开发者ID:singularityhub,项目名称:singularity-cli,代码行数:13,代码来源:shell.py

示例15: run_bpython

# 需要导入模块: import bpython [as 别名]
# 或者: from bpython import embed [as 别名]
def run_bpython(image):
    """give the user a bpython shell
    """
    client = prepare_client(image)

    try:
        import bpython
    except ImportError:
        return python(image)

    bpython.embed(locals_={"client": client}) 
开发者ID:singularityhub,项目名称:singularity-cli,代码行数:13,代码来源:shell.py


注:本文中的bpython.embed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。