Spaces:
Sleeping
Sleeping
Download test_patch.py from Viraj0112/rl_code_fix_env: direct link, hf CLI and curl.
- Browser
- Download file 603 Bytes
-
https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/test_patch.py
- Command line
-
hf download hf://spaces/Viraj0112/rl_code_fix_env/test_patch.py
-
curl -L -o test_patch.py https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/test_patch.py
603 Bytes
| import diff_match_patch as dmp_module | |
| dmp_init = dmp_module.diff_match_patch() | |
| old = ' \"\"\"Rotate matrix 90 degrees clockwise.\"\"\"\n t = transpose(matrix)\n # BUG: this is counter-clockwise.\n return t[::-1]\n' | |
| new = ' \"\"\"Rotate matrix 90 degrees clockwise.\"\"\"\n t = transpose(matrix)\n # BUG: this is counter-clockwise.\n return [row[::-1] for row in t]\n' | |
| diffs = dmp_init.diff_main(old, new) | |
| dmp_init.diff_cleanupSemantic(diffs) | |
| patches = dmp_init.patch_make(old, diffs) | |
| patched, res = dmp_init.patch_apply(patches, old) | |
| print('patched:', repr(patched)) | |