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


Python IPShellEmbed.set_exit_msg方法代码示例

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


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

示例1: setup_shell

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
def setup_shell():

    banner = "+-----------------------------------------------------------+\n"
    banner += " SimpleCV "
    banner += SIMPLECV_VERSION
    banner += " [interactive shell] - http://simplecv.org\n"
    banner += "+-----------------------------------------------------------+\n"
    banner += "\n"
    banner += "Commands: \n"
    banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
    banner += '\t"clear" to clear the shell screen\n'
    banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
    banner += '\t"example" gives a list of examples you can run\n'
    banner += '\t"forums" will launch a web browser for the help forums\n'
    banner += '\t"walkthrough" will launch a web browser with a walkthrough\n'
    banner += "\n"
    banner += "Usage:\n"
    banner += "\tdot complete works to show library\n"
    banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
    banner += "\tjust by touching TAB after typing Image().\n"
    banner += "\n"
    banner += "Documentation:\n"
    banner += "\thelp(Image), ?Image, Image?, or Image()? all do the same\n"
    banner += '\t"docs" will launch webbrowser showing documentation'
    banner += "\n"
    exit_msg = "\n... [Exiting the SimpleCV interactive shell] ...\n"

    # IPython version is less than 11
    if IPVER <= 10:
        # setup terminal to show SCV prompt
        argsv = ["-pi1", "SimpleCV:\\#>", "-pi2", "   .\\D.:", "-po", "SimpleCV:\\#>", "-nosep"]

        scvShell = IPShellEmbed(argsv)
        scvShell.set_banner(banner)
        scvShell.set_exit_msg(exit_msg)
        scvShell.IP.api.expose_magic("tutorial", magic_tutorial)
        scvShell.IP.api.expose_magic("clear", magic_clear)
        scvShell.IP.api.expose_magic("example", magic_examples)
        scvShell.IP.api.expose_magic("forums", magic_forums)
        scvShell.IP.api.expose_magic("walkthrough", magic_walkthrough)
        scvShell.IP.api.expose_magic("docs", magic_docs)

        return scvShell

    # IPython version 0.11 or higher
    else:
        cfg = Config()
        cfg.PromptManager.in_template = "SimpleCV:\\#> "
        cfg.PromptManager.out_template = "SimpleCV:\\#: "
        # ~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
        # ~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
        scvShell = InteractiveShellEmbed(config=cfg, banner1=banner, exit_msg=exit_msg)
        scvShell.define_magic("tutorial", magic_tutorial)
        scvShell.define_magic("clear", magic_clear)
        scvShell.define_magic("example", magic_examples)
        scvShell.define_magic("forums", magic_forums)
        scvShell.define_magic("walkthrough", magic_walkthrough)
        scvShell.define_magic("docs", magic_docs)

        return scvShell
开发者ID:BradMP,项目名称:SimpleCV,代码行数:62,代码来源:Shell.py

示例2: main

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
def main():
    clear()
    banner = '+----------------------------------------------------+\n'
    banner += ' SimpleCV [interactive shell]\n'
    banner += '+----------------------------------------------------+\n'
    banner += '\n'
    banner += 'Commands: \n'
    banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
    banner += '\t"clear" to clear the shell screen\n'
    banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
    banner += '\t"cheatsheet" gives a cheatsheet of all the shell functions\n' 
    banner += '\t"simplehelp" gives list of commands or help on a certain command\n'
    banner += '\t"example" gives a list of examples you can run'
    banner += '\n'
    banner += 'Usage:\n'
    banner += '\tdot complete works to show library\n'
    banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
    banner += '\tjust by touching TAB after typing Image().\n'
    banner += '\n'
    banner += 'API Documentation:\n'
    banner += '\t"help function_name" will give in depth documentation of API\n'
    banner += '\t\texample:'
    banner += 'help Image or ?Image\n'
    banner += '\t\twill give the in-depth information about that class\n'
    banner += '\t"?function_name" will give the quick API documentation\n'
    banner += '\t\texample:'
    banner += '?Image.save\n'
    banner += '\t\twill give help on the image save function'

    

    
    exit_msg = '\nExiting the SimpleCV interactive shell\n'
    

    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("simplehelp", magic_help)
    scvShell.IP.api.expose_magic("cheatsheet", magic_cheatsheet)
    scvShell.IP.api.expose_magic("example", magic_examples)
    

    #Note that all loaded libraries are inherited in the embedded ipython shell
    sys.exit(scvShell())
开发者ID:MarkPortnell,项目名称:the_mad_hatter,代码行数:52,代码来源:Shell.py

示例3: setup_shell

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
def setup_shell():  
    banner = '+----------------------------------------------------+\n'
    banner += ' SimpleCV [interactive shell] - http://simplecv.org\n'
    banner += '+----------------------------------------------------+\n'
    banner += '\n'
    banner += 'Commands: \n'
    banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
    banner += '\t"clear" to clear the shell screen\n'
    banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
    banner += '\t"cheatsheet" gives a cheatsheet of all the shell functions\n' 
    banner += '\t"example" gives a list of examples you can run'
    banner += '\n'
    banner += 'Usage:\n'
    banner += '\tdot complete works to show library\n'
    banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
    banner += '\tjust by touching TAB after typing Image().\n'
    banner += 'API Documentation:\n'
    banner += '\t"help function_name" will give in depth documentation of API\n'
    banner += '\texample: help Image\n'
    banner += 'Editor:\n'
    banner += '\t"editor" will run the SimpleCV code editor in a browser\n'
    banner += '\t\texample:'
    banner += 'help Image or ?Image\n'
    banner += '\t\twill give the in-depth information about that class\n'
    banner += '\t"?function_name" will give the quick API documentation\n'
    banner += '\t\texample:'
    banner += '?Image.save\n'
    banner += '\t\twill give help on the image save function'
    exit_msg = '\nExiting the SimpleCV interactive shell\n'
    

    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("cheatsheet", magic_cheatsheet)
    scvShell.IP.api.expose_magic("example", magic_examples)
    scvShell.IP.api.expose_magic("editor", magic_editor)
    
    return scvShell
开发者ID:blackball,项目名称:SimpleCV,代码行数:46,代码来源:Shell.py

示例4: pyevThread

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
import sys
from IPython.Shell import IPShellEmbed
from evnet import pyevThread
from pwrcall import Node, expose, loop, unloop
from pwrcall.util import NodeException, parse_url

CERT = 'clientside.pem'
t = pyevThread()
t.start()
n = Node(cert=CERT)
ipshell = IPShellEmbed()

def establish(pwrurl):
	return t.blockingCall(n.establish, pwrurl)

def pwrcall(obj, fn, *args):
	return t.blockingCall(obj.call, fn, *args)	

if __name__ == '__main__':
	ipshell.set_banner(
'''pwrcall Interactive Shell
-------------------------
starts up a evnet loop and pwrcall Node
use the Node through the t.blockingCall function''')
	ipshell.set_exit_msg('Exit.')
	ipshell()
	sys.exit(0)

开发者ID:rep,项目名称:pwrcall,代码行数:29,代码来源:icli.py

示例5: Config

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
        banner = '*** Starting Interactive Shell - Ctrl-D to exit...\n\nnapi is your NexposeAPI variable to play with\n'

        if IPython.__version__ >= "0.11":
            from IPython.config.loader import Config
            cfg = Config()
            cfg.InteractiveShellEmbed.prompt_in1="myprompt [\\#]> "
            cfg.InteractiveShellEmbed.prompt_out="myprompt [\\#]: "
            #cfg.InteractiveShellEmbed.profile=ipythonprofile
            # directly open the shell
            IPython.embed(config=cfg, banner2=banner)
        else:
            try:
                from IPython.Shell import IPShellEmbed
                argv = ['-pi1','In <\\#>:','-pi2','   .\\D.:','-po','Out<\\#>:']
                ipshell = IPShellEmbed(argv,banner='*** Starting Interactive Shell - Ctrl-D to exit...\n\nnapi is your NexposeAPI variable to play with\n')
                ipshell.set_exit_msg('Buh-bye!')
                ipshell()
            except ImportError, e:
                sys.exit("IPython not installed, won't continue...")

    if options.listvulns:
        vuln_class = VulnData(napi.sessionid)
        vuln_class.populate_summary()
        if (vuln_class.vulnerabilities) > 0:
            if options.listvulns.upper() == "CSV":
                print vuln_class.csvout()
            else:
                print vuln_class.vulnxml
        else:
            print "Error: No Vulnerabilities loaded, check your Nexpose server address or user/pass"
开发者ID:001001,项目名称:Kvasir,代码行数:32,代码来源:NexposeAPI.py

示例6: set_banner

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
# They also print an exit message every time they exit.

# Both the startup banner and the exit message default to None, and can be set
# either at the instance constructor or at any other time with the
# set_banner() and set_exit_msg() methods.

# The shell instance can be also put in 'dummy' mode globally or on a per-call
# basis. This gives you fine control for debugging without having to change
# code all over the place.

# The code below illustrates all this.


# This is how the global banner and exit_msg can be reset at any point
ipshell.set_banner('Entering interpreter - New Banner')
ipshell.set_exit_msg('Leaving interpreter - New exit_msg')

def foo(m):
    s = 'spam'
    ipshell('***In foo(). Try @whos, or print s or m:')
    print 'foo says m = ',m

def bar(n):
    s = 'eggs'
    ipshell('***In bar(). Try @whos, or print s or n:')
    print 'bar says n = ',n
    
# Some calls to the above functions which will trigger IPython:
print 'Main program calling foo("eggs")\n'
foo('eggs')
开发者ID:acaballero6270,项目名称:py4science,代码行数:32,代码来源:ip_embed.py

示例7: setup_shell

# 需要导入模块: from IPython.Shell import IPShellEmbed [as 别名]
# 或者: from IPython.Shell.IPShellEmbed import set_exit_msg [as 别名]
def setup_shell():
  
  banner = '+----------------------------------------------------+\n'
  banner += ' SimpleCV [interactive shell] - http://simplecv.org\n'
  banner += '+----------------------------------------------------+\n'
  banner += '\n'
  banner += 'Commands: \n'
  banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
  banner += '\t"clear" to clear the shell screen\n'
  banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
  banner += '\t"cheatsheet" gives a cheatsheet of all the shell functions\n' 
  banner += '\t"example" gives a list of examples you can run'
  banner += '\n'
  banner += 'Usage:\n'
  banner += '\tdot complete works to show library\n'
  banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
  banner += '\tjust by touching TAB after typing Image().\n'
  banner += 'API Documentation:\n'
  banner += '\t"help function_name" will give in depth documentation of API\n'
  banner += '\texample: help Image\n'
  banner += 'Editor:\n'
  banner += '\t"editor" will run the SimpleCV code editor in a browser\n'
  banner += '\t\texample:'
  banner += 'help Image or ?Image\n'
  banner += '\t\twill give the in-depth information about that class\n'
  banner += '\t"?function_name" will give the quick API documentation\n'
  banner += '\t\texample:'
  banner += '?Image.save\n'
  banner += '\t\twill give help on the image save function'
  exit_msg = '\n... [Exiting the SimpleCV interactive shell] ...\n'


  #IPython version is less than 11
  if IPVER <= 10:
    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("cheatsheet", magic_cheatsheet)
    scvShell.IP.api.expose_magic("example", magic_examples)
    scvShell.IP.api.expose_magic("editor", magic_editor)
    
    return scvShell

  #IPython version 0.11 or higher
  else:
    cfg = Config()
    cfg.PromptManager.in_template = "SimpleCV:\\#> "
    cfg.PromptManager.out_template = "SimpleCV:\\#: "
    #~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
    #~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
    scvShell = InteractiveShellEmbed(config=cfg, banner1=banner, exit_msg = exit_msg)
    scvShell.define_magic("tutorial",magic_tutorial)
    scvShell.define_magic("clear", magic_clear)
    scvShell.define_magic("cheatsheet", magic_cheatsheet)
    scvShell.define_magic("example", magic_examples)
    scvShell.define_magic("editor", magic_editor)

    return scvShell
开发者ID:gregorynicholas,项目名称:simplecv,代码行数:65,代码来源:Shell.py


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