Spaces:
Paused
Paused
Download patch_dedupe.py from AUXteam/Plandex: direct link, hf CLI and curl.
- Browser
- Download file 670 Bytes
-
https://huggingface.co/spaces/AUXteam/Plandex/resolve/main/patch_dedupe.py
- Command line
-
hf download hf://spaces/AUXteam/Plandex/patch_dedupe.py
-
curl -L -o patch_dedupe.py https://huggingface.co/spaces/AUXteam/Plandex/resolve/main/patch_dedupe.py
670 Bytes
| with open("server.js", "r") as f: | |
| content = f.read() | |
| # Since I ran the patch twice (once successfully with the first script despite the warning, and once with the second), it might be duplicated. | |
| # Let's remove the block if it exists multiple times. | |
| import re | |
| # Find how many times it exists | |
| pattern = r"// Utility to extract variables from template content.*?// POST /api/sessions/from-template.*?\n\}\);" | |
| matches = re.findall(pattern, content, flags=re.DOTALL) | |
| if len(matches) > 1: | |
| print(f"Found {len(matches)} duplications. Removing all but the first.") | |
| content = content.replace(matches[0], "") | |
| with open("server.js", "w") as f: | |
| f.write(content) | |