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


Python __builtin__.exit方法代码示例

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


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

示例1: do_python

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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

示例2: setquit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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)'

    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)
    __builtin__.quit = Quitter('quit')
    __builtin__.exit = Quitter('exit') 
开发者ID:glmcdona,项目名称:meddle,代码行数:31,代码来源:site.py

示例3: setquit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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

示例4: setquit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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

示例5: do_sessions

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [as 别名]
def do_sessions(self, arg):
		""" list/interact with established sessions """
		arg_parser = PupyArgumentParser(prog='sessions', description=self.do_sessions.__doc__)
		arg_parser.add_argument('-i', '--interact', metavar='<filter>', help="change the default --filter value for other commands")
		arg_parser.add_argument('-g', '--global-reset', action='store_true', help="reset --interact to the default global behavior")
		arg_parser.add_argument('-l', dest='list', action='store_true', help='List all active sessions')
		arg_parser.add_argument('-k', dest='kill', metavar='<id>', type=int, help='Kill the selected session')
		try:
			modargs=arg_parser.parse_args(shlex.split(arg))
		except PupyModuleExit:
			return

		if modargs.global_reset:
			self.default_filter=None
			self.display_success("default filter reset to global !")
		elif modargs.interact:
			self.default_filter=modargs.interact
			self.display_success("default filter set to %s"%self.default_filter)
		elif modargs.kill:
			selected_client = self.pupsrv.get_clients(modargs.kill)
			if selected_client:
				try:
					selected_client[0].conn.exit()
				except Exception:
					pass
		elif modargs.list or not arg:
			client_list=self.pupsrv.get_clients_list()
			self.display(PupyCmd.table_format([x.desc for x in client_list], wl=["id", "user", "hostname", "platform", "release", "os_arch", "address"])) 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:30,代码来源:PupyCmd.py

示例6: do_exit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [as 别名]
def do_exit(self, arg):
		""" Quit Pupy Shell """
		sys.exit() 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:5,代码来源:PupyCmd.py

示例7: setquit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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)
    __builtin__.quit = Quitter('quit')
    __builtin__.exit = Quitter('exit') 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:29,代码来源:site.py

示例8: setquit

# 需要导入模块: import __builtin__ [as 别名]
# 或者: from __builtin__ import exit [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-D (i.e. EOF)'  # maybe also mention Ctrl-Z if we can support for Windows
    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)
    __builtin__.quit = Quitter('quit')
    __builtin__.exit = Quitter('exit') 
开发者ID:Acmesec,项目名称:CTFCrackTools-V2,代码行数:31,代码来源:site.py


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