app.py 文件源码

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

项目:parsl 作者: Parsl 项目源码 文件源码
def _trace_cmdline(self, *args, **kwargs):
        ''' Internal function used to trace the values set to the special variable
        cmd_line in the function body.

        '''

        def tracer(frame, event, arg):
            if event=='return':
                self._locals = frame.f_locals.copy()

        # Activate tracer
        sys.setprofile(tracer)
        try:
            # trace the function call
            res = self.func(*args, **kwargs)
        finally:
            # disable tracer and replace with old one
            sys.setprofile(None)

        return self._locals['cmd_line']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号