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


Python embed.InteractiveShellEmbed方法代码示例

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


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

示例1: ipsh

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def ipsh():
    ipshell = InteractiveShellEmbed(config=cfg, banner1=banner_msg, exit_msg=exit_msg)
    frame = inspect.currentframe().f_back
    msg = 'Stopped at {0.f_code.co_filename} at line {0.f_lineno}'.format(frame)
    # Go back one level!
    # This is needed because the call to ipshell is inside the function ipsh()
    ipshell(msg, stack_depth=2) 
开发者ID:ustunb,项目名称:risk-slim,代码行数:9,代码来源:debug.py

示例2: Shell

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def Shell(user_session):
    # This should bring back the old autocall behaviour. e.g.:
    # In [1]: pslist
    cfg = Config()
    cfg.InteractiveShellEmbed.autocall = 2
    cfg.TerminalInteractiveShell.prompts_class = RekallPrompt
    cfg.InteractiveShell.separate_in = ''
    cfg.InteractiveShell.separate_out = ''
    cfg.InteractiveShell.separate_out2 = ''

    shell = RekallShell(config=cfg, user_ns=user_session.locals)

    shell.Completer.merge_completions = False
    shell.exit_msg = constants.GetQuote()
    shell.set_custom_completer(RekallCompleter, 0)

    # Do we need to pre-run something?
    if user_session.run != None:
        execfile(user_session.run, user_session.locals)

    user_session.shell = shell

    # Set known delimeters for the completer. This varies by OS so we need to
    # set it to ensure consistency.
    readline.set_completer_delims(' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?')

    for magic in REGISTERED_MAGICS:
        shell.register_magics(magic)

    shell(module=user_session.locals, )

    return True 
开发者ID:google,项目名称:rekall,代码行数:34,代码来源:ipython_support.py

示例3: main

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def main(path_to_serialized_model):
    print('Loading: ' + str(path_to_serialized_model))
    network = fieldnetwork.deserialize_network(path_to_serialized_model)
    store_client = StoreHandler()
    api = API(network, store_client)
    ip_shell = InteractiveShellEmbed(banner1=init_banner, exit_msg=exit_banner)
    ip_shell() 
开发者ID:mitdbg,项目名称:aurum-datadiscovery,代码行数:9,代码来源:main.py

示例4: get_ipshell

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def get_ipshell():
    banner = 'Starting IPython Interpreter Now \n'
    exit_msg = '\nExiting IPython Interpreter Now'

    try:
        return InteractiveShellEmbed(banner1=banner, exit_msg=exit_msg)
    except:
        print("*** Error initializing colorized shell, failing over to non-colorized shell ***\n\n")
        return embed 
开发者ID:RedHatInsights,项目名称:insights-core,代码行数:11,代码来源:insights_inspect.py

示例5: interact

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def interact():
    CONF["SESSION"] = Session(True)
    cfg = Config()
    ipshell = InteractiveShellEmbed(
        config=cfg,
        banner1="Androguard version %s" % ANDROGUARD_VERSION)
    init_print_colors()
    ipshell() 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:10,代码来源:androlyze.py

示例6: run

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def run(self):
        """
        Args:
            None

        Returns:
            None
        """
        ipshell = InteractiveShellEmbed(config=self.config, banner1="")
        ipshell() 
开发者ID:xtiankisutsa,项目名称:MARA_Framework,代码行数:12,代码来源:interact.py

示例7: main

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def main():
    ''' Run IPython shell. '''
    ipy_shell = InteractiveShellEmbed(
        banner1=f'IPython Shell: Starbelly v{__version__}')
    ipy_shell.magic('autoawait trio')
    ipy_shell() 
开发者ID:HyperionGray,项目名称:starbelly,代码行数:8,代码来源:shell.py

示例8: shell

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def shell(self, banner1='-- Augur Shell --', **kwargs):
        from IPython.terminal.embed import InteractiveShellEmbed
        if not self.__shell_config:
            from augur.util import init_shell_config
            self.__shell_config = init_shell_config()
        return InteractiveShellEmbed(config=self.__shell_config, banner1=banner1, **kwargs) 
开发者ID:chaoss,项目名称:augur,代码行数:8,代码来源:application.py

示例9: main

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def main():

    try:
        try:
            get_ipython
        except NameError:
            pass
        else:
            sys.exit("Running ipython inside ipython isn't supported. :(")

        options, basic_auth, oauth, kerberos_auth = get_config()

        if basic_auth:
            basic_auth = handle_basic_auth(auth=basic_auth, server=options["server"])

        if oauth.get("oauth_dance") is True:
            oauth = oauth_dance(
                options["server"],
                oauth["consumer_key"],
                oauth["key_cert"],
                oauth["print_tokens"],
                options["verify"],
            )
        elif not all(
            (
                oauth.get("access_token"),
                oauth.get("access_token_secret"),
                oauth.get("consumer_key"),
                oauth.get("key_cert"),
            )
        ):
            oauth = None

        use_kerberos = kerberos_auth.get("use_kerberos", False)
        del kerberos_auth["use_kerberos"]

        jira = JIRA(
            options=options,
            basic_auth=basic_auth,
            kerberos=use_kerberos,
            kerberos_options=kerberos_auth,
            oauth=oauth,
        )

        import IPython

        # The top-level `frontend` package has been deprecated since IPython 1.0.
        if IPython.version_info[0] >= 1:
            from IPython.terminal.embed import InteractiveShellEmbed
        else:
            from IPython.frontend.terminal.embed import InteractiveShellEmbed

        ip_shell = InteractiveShellEmbed(
            banner1="<Jira Shell " + __version__ + " (" + jira.client_info() + ")>"
        )
        ip_shell("*** Jira shell active; client is in 'jira'." " Press Ctrl-D to exit.")
    except Exception as e:
        print(e, file=sys.stderr)
        return 2 
开发者ID:pycontribs,项目名称:jira,代码行数:61,代码来源:jirashell.py

示例10: start_shell

# 需要导入模块: from IPython.terminal import embed [as 别名]
# 或者: from IPython.terminal.embed import InteractiveShellEmbed [as 别名]
def start_shell(controller=None):
    """Load Kytos interactive shell."""
    kytos_ascii = r"""
      _          _
     | |        | |
     | | ___   _| |_ ___  ___
     | |/ / | | | __/ _ \/ __|
     |   <| |_| | || (_) \__ \
     |_|\_\__,  |\__\___/|___/
            __/ |
           |___/
    """

    banner1 = f"""\033[95m{kytos_ascii}\033[0m
    Welcome to Kytos SDN Platform!

    We are making a huge effort to make sure that this console will work fine
    but for now it's still experimental.

    Kytos website.: https://kytos.io/
    Documentation.: https://docs.kytos.io/
    OF Address....:"""

    exit_msg = "Stopping Kytos daemon... Bye, see you!"

    if controller:
        address = controller.server.server_address[0]
        port = controller.server.server_address[1]
        banner1 += f" tcp://{address}:{port}\n"

        api_port = controller.api_server.port
        banner1 += f"    WEB UI........: http://{address}:{api_port}/\n"
        banner1 += f"    Kytos Version.: {__version__}"

    banner1 += "\n"

    cfg = Config()
    cfg.TerminalInteractiveShell.autocall = 2
    cfg.TerminalInteractiveShell.show_rewritten_input = False
    cfg.TerminalInteractiveShell.confirm_exit = False

    # Avoiding sqlite3.ProgrammingError when trying to save command history
    # on Kytos shutdown
    cfg.HistoryAccessor.enabled = False

    ipshell = InteractiveShellEmbed(config=cfg,
                                    banner1=banner1,
                                    exit_msg=exit_msg)
    ipshell.prompts = KytosPrompt(ipshell)

    ipshell()


# def disable_threadpool_exit():
#     """Avoid traceback when ThreadPool tries to shut down threads again."""
#     import atexit
#     from concurrent.futures import thread, ThreadPoolExecutor
#     atexit.unregister(thread._python_exit) 
开发者ID:kytos,项目名称:kytos,代码行数:60,代码来源:kytosd.py


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