@tornado.gen.coroutine
    def execute_code(self, text, originlabel=None):
        self.task.tick()

        ### This originlabel stuff is pretty much wrong. Also slow.
        ### And unnecessary, now that the build interface test-parses?
        if originlabel:
            if type(originlabel) is dict and 'text' in originlabel:
                originlabel = originlabel['text']
            originlabel = '"%.20s"' % (originlabel,)
        else:
            originlabel = '<script>'
            
        tree = ast.parse(text, filename=originlabel)
        assert type(tree) is ast.Module

        res = None
        for nod in tree.body:
            res = yield self.execcode_statement(nod)
        return res
Execute a pile of (already-looked-up) script code.
dataset/ETHPy150Open erkyrath/tworld/lib/two/evalctx.py/EvalPropContext.execute_code