python类cram()的实例源码

dbg.py 文件源码 项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def do_exec(self, arg, safe=True):
        if not self.frame:
            ret = RPCError("No current frame available to exec")
        else:
            locals = self.frame_locals
            globals = self.frame.f_globals
            code = compile(arg + '\n', '<stdin>', 'single')
            save_displayhook = sys.displayhook
            self.displayhook_value = None
            try:
                sys.displayhook = self.displayhook
                exec(code, globals, locals)
                ret = self.displayhook_value
            finally:
                sys.displayhook = save_displayhook
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
dbg.py 文件源码 项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for scope, max_length, vars in (
                    ("locals", 255, list(self.frame_locals.items())),
                    ("globals", 20, list(self.frame.f_globals.items())), ):
                for (name, value) in vars:
                    try:
                        short_repr = pydoc.cram(repr(value), max_length)                    
                    except Exception as e:
                        # some objects cannot be represented...
                        short_repr = "**exception** %s" % repr(e)
                    env[scope][name] = (short_repr, repr(type(value)))
        return env
dbg.py 文件源码 项目:rekall-agent-server 作者: rekall-innovations 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def do_exec(self, arg, safe=True):
        if not self.frame:
            ret = RPCError("No current frame available to exec")
        else:
            locals = self.frame_locals
            globals = self.frame.f_globals
            code = compile(arg + '\n', '<stdin>', 'single')
            save_displayhook = sys.displayhook
            self.displayhook_value = None
            try:
                sys.displayhook = self.displayhook
                exec(code, globals, locals)
                ret = self.displayhook_value
            finally:
                sys.displayhook = save_displayhook
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
dbg.py 文件源码 项目:rekall-agent-server 作者: rekall-innovations 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for scope, max_length, vars in (
                    ("locals", 255, list(self.frame_locals.items())),
                    ("globals", 20, list(self.frame.f_globals.items())), ):
                for (name, value) in vars:
                    try:
                        short_repr = pydoc.cram(repr(value), max_length)                    
                    except Exception as e:
                        # some objects cannot be represented...
                        short_repr = "**exception** %s" % repr(e)
                    env[scope][name] = (short_repr, repr(type(value)))
        return env
dbg.py 文件源码 项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        if self.frame:
            ret = eval(arg, self.frame.f_globals,
                        self.frame_locals)
        else:
            ret = RPCError("No current frame available to eval")
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:true_review_web2py 作者: lucadealfaro 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        ret = eval(arg, self.frame.f_globals,
                   self.frame_locals)
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:true_review_web2py 作者: lucadealfaro 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for name, value in self.frame_locals.items():
                env['locals'][name] = pydoc.cram(repr(
                    value), 255), repr(type(value))
            for name, value in self.frame.f_globals.items():
                env['globals'][name] = pydoc.cram(repr(
                    value), 20), repr(type(value))
        return env
qdb.py 文件源码 项目:spc 作者: whbrewer 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        ret = eval(arg, self.frame.f_globals,
                   self.frame_locals)
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:spc 作者: whbrewer 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for name, value in self.frame_locals.items():
                env['locals'][name] = pydoc.cram(repr(
                    value), 255), repr(type(value))
            for name, value in self.frame.f_globals.items():
                env['globals'][name] = pydoc.cram(repr(
                    value), 20), repr(type(value))
        return env
qdb.py 文件源码 项目:Problematica-public 作者: TechMaz 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        ret = eval(arg, self.frame.f_globals,
                   self.frame_locals)
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:Problematica-public 作者: TechMaz 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for name, value in self.frame_locals.items():
                env['locals'][name] = pydoc.cram(repr(
                    value), 255), repr(type(value))
            for name, value in self.frame.f_globals.items():
                env['globals'][name] = pydoc.cram(repr(
                    value), 20), repr(type(value))
        return env
dbg.py 文件源码 项目:rekall-agent-server 作者: rekall-innovations 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        if self.frame:
            ret = eval(arg, self.frame.f_globals,
                        self.frame_locals)
        else:
            ret = RPCError("No current frame available to eval")
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:slugiot-client 作者: slugiot 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        ret = eval(arg, self.frame.f_globals,
                   self.frame_locals)
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:slugiot-client 作者: slugiot 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for name, value in self.frame_locals.items():
                env['locals'][name] = pydoc.cram(repr(
                    value), 255), repr(type(value))
            for name, value in self.frame.f_globals.items():
                env['globals'][name] = pydoc.cram(repr(
                    value), 20), repr(type(value))
        return env
qdb.py 文件源码 项目:StuffShare 作者: StuffShare 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def do_eval(self, arg, safe=True):
        ret = eval(arg, self.frame.f_globals,
                   self.frame_locals)
        if safe:
            ret = pydoc.cram(repr(ret), 255)
        return ret
qdb.py 文件源码 项目:StuffShare 作者: StuffShare 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for name, value in self.frame_locals.items():
                env['locals'][name] = pydoc.cram(repr(
                    value), 255), repr(type(value))
            for name, value in self.frame.f_globals.items():
                env['globals'][name] = pydoc.cram(repr(
                    value), 20), repr(type(value))
        return env


问题


面经


文章

微信
公众号

扫码关注公众号