(code, slot_map)
| 59 | |
| 60 | |
| 61 | def decanonicalize_code(code, slot_map): |
| 62 | try: |
| 63 | slot2string = {x[0]: x[1]['value'] for x in list(slot_map.items())} |
| 64 | py_ast = ast.parse(code) |
| 65 | replace_strings_in_ast(py_ast, slot2string) |
| 66 | raw_code = astor.to_source(py_ast) |
| 67 | # for slot_name, slot_info in slot_map.items(): |
| 68 | # raw_code = raw_code.replace(slot_name, slot_info['value']) |
| 69 | |
| 70 | return raw_code.strip() |
| 71 | except: |
| 72 | return code |
nothing calls this directly
no test coverage detected