當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。