ironpython_console.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码
def install_readline(hook):
    def hook_wrap():
        try:
            res = hook()
        except KeyboardInterrupt as x:  #this exception does not seem to be caught
            res = ""
        except EOFError:
            return None
        if res[-1:] == "\n":
            return res[:-1]
        else:
            return res

    class IronPythonWrapper(IronPythonConsole.IConsole):
        def ReadLine(self, autoIndentSize):
            return hook_wrap()

        def Write(self, text, style):
            System.Console.Write(text)

        def WriteLine(self, text, style):
            System.Console.WriteLine(text)

    IronPythonConsole.PythonCommandLine.MyConsole = IronPythonWrapper()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号