當前位置: 首頁>>代碼示例>>Python>>正文


Python builtins.quit方法代碼示例

本文整理匯總了Python中builtins.quit方法的典型用法代碼示例。如果您正苦於以下問題:Python builtins.quit方法的具體用法?Python builtins.quit怎麽用?Python builtins.quit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在builtins的用法示例。


在下文中一共展示了builtins.quit方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __call__

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def __call__(self):
        self.__setup()
        prompt = 'Hit Return for more, or q (and Return) to quit: '
        lineno = 0
        while 1:
            try:
                for i in range(lineno, lineno + self.MAXLINES):
                    print(self.__lines[i])
            except IndexError:
                break
            else:
                lineno += self.MAXLINES
                key = None
                while key is None:
                    try:
                        key = raw_input(prompt)
                    except NameError:
                        key = input(prompt)
                    if key not in ('', 'q'):
                        key = None
                if key == 'q':
                    break 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:24,代碼來源:site.py

示例2: __call__

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def __call__(self):
        self.__setup()
        prompt = "Hit Return for more, or q (and Return) to quit: "
        lineno = 0
        while 1:
            try:
                for i in range(lineno, lineno + self.MAXLINES):
                    print(self.__lines[i])
            except IndexError:
                break
            else:
                lineno += self.MAXLINES
                key = None
                while key is None:
                    try:
                        key = raw_input(prompt)
                    except NameError:
                        key = input(prompt)
                    if key not in ("", "q"):
                        key = None
                if key == "q":
                    break 
開發者ID:QData,項目名稱:deepWordBug,代碼行數:24,代碼來源:site.py

示例3: setquit

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def setquit():
    """Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    """
    if os.sep == ':':
        eof = 'Cmd-Q'
    elif os.sep == '\\':
        eof = 'Ctrl-Z plus Return'
    else:
        eof = 'Ctrl-D (i.e. EOF)'

    builtins.quit = _sitebuiltins.Quitter('quit', eof)
    builtins.exit = _sitebuiltins.Quitter('exit', eof) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:18,代碼來源:site.py

示例4: do_python

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def do_python(self,arg):
		""" start the local python interpreter (for debugging purposes) """
		orig_exit=builtins.exit
		orig_quit=builtins.quit
		def disabled_exit(*args, **kwargs):
			self.display_warning("exit() disabled ! use ctrl+D to exit the python shell")
		builtins.exit=disabled_exit
		builtins.quit=disabled_exit
		oldcompleter=readline.get_completer()
		try:
			local_ns={"pupsrv":self.pupsrv}
			readline.set_completer(PythonCompleter(local_ns=local_ns).complete)
			readline.parse_and_bind('tab: complete')
			code.interact(local=local_ns)
		except Exception as e:
			self.display_error(str(e))
		finally:
			readline.set_completer(oldcompleter)
			readline.parse_and_bind('tab: complete')
			builtins.exit=orig_exit
			builtins.quit=orig_quit 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:23,代碼來源:PupyCmd.py

示例5: setquit

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def setquit():
    """Define new built-ins 'quit' and 'exit'.
    These are simply strings that display a hint on how to exit.

    """
    if os.sep == ':':
        eof = 'Cmd-Q'
    elif os.sep == '\\':
        eof = 'Ctrl-Z plus Return'
    else:
        eof = 'Ctrl-D (i.e. EOF)'

    class Quitter(object):
        def __init__(self, name):
            self.name = name
        def __repr__(self):
            return 'Use %s() or %s to exit' % (self.name, eof)
        def __call__(self, code=None):
            # Shells like IDLE catch the SystemExit, but listen when their
            # stdin wrapper is closed.
            try:
                sys.stdin.close()
            except:
                pass
            raise SystemExit(code)
    builtins.quit = Quitter('quit')
    builtins.exit = Quitter('exit') 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:29,代碼來源:site.py

示例6: setquit

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def setquit():
    """Define new built-ins 'quit' and 'exit'.
    These are simply strings that display a hint on how to exit.

    """
    if os.sep == ":":
        eof = "Cmd-Q"
    elif os.sep == "\\":
        eof = "Ctrl-Z plus Return"
    else:
        eof = "Ctrl-D (i.e. EOF)"

    class Quitter(object):
        def __init__(self, name):
            self.name = name

        def __repr__(self):
            return "Use {}() or {} to exit".format(self.name, eof)

        def __call__(self, code=None):
            # Shells like IDLE catch the SystemExit, but listen when their
            # stdin wrapper is closed.
            try:
                sys.stdin.close()
            except:
                pass
            raise SystemExit(code)

    builtins.quit = Quitter("quit")
    builtins.exit = Quitter("exit") 
開發者ID:QData,項目名稱:deepWordBug,代碼行數:32,代碼來源:site.py

示例7: setquit

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import quit [as 別名]
def setquit():
    """Define new builtins 'quit' and 'exit'.

    These are objects which make the interpreter exit when called.
    The repr of each object contains a hint at how it works.

    """
    if os.sep == '\\':
        eof = 'Ctrl-Z plus Return'
    else:
        eof = 'Ctrl-D (i.e. EOF)'

    builtins.quit = _sitebuiltins.Quitter('quit', eof)
    builtins.exit = _sitebuiltins.Quitter('exit', eof) 
開發者ID:CedricGuillemet,項目名稱:Imogen,代碼行數:16,代碼來源:site.py


注:本文中的builtins.quit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。