getHint.py 文件源码

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

项目:ITAP-django 作者: krivers 项目源码 文件源码
def run_tests(source_state):
    orig_code = source_state.code
    source_state = test_code(source_state)
    source_state.code = orig_code

    args = eval(source_state.problem.arguments)
    given_code = ast.parse(source_state.problem.given_code)
    importNames = getAllImports(source_state.tree) + getAllImports(given_code)
    inp = importNames + (list(args.keys()) if type(args) == dict else [])
    given_names = [str(x) for x in inp]
    imports = getAllImportStatements(source_state.tree) + getAllImportStatements(given_code)

    if source_state.tree != None:
        (cleaned_state, anon_state, canonical_state) = generate_states(source_state, given_names, imports)
        save_states(source_state, cleaned_state, anon_state, canonical_state)
    else:
        source_state.save()
    return source_state
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号