import re

with open('/tmp/scpi_agent_batch.py', 'r') as f:
    content = f.read()

# Replace the broken section
old = """# Build name -> URL map
URL_MAP = {}
for name, iid in MANUAL_URLS.items():
    slug = name.lower()
    for a, b in [('é','e'),('è','e'),('ê','e'),('ë','e'),('â','a'),('à','a'),('î','i'),('ï','i'),('ô','o'),('û','u'),('ü','u'),('ç','c'),("'",""),(' ','-'),('(',''),("""

new = """# Build name -> URL map
URL_MAP = {}
for name, iid in MANUAL_URLS.items():
    slug = name.lower()
    for a, b in [('é','e'),('è','e'),('ê','e'),('ë','e'),('â','a'),('à','a'),('î','i'),('ï','i'),('ô','o'),('û','u'),('ü','u'),('ç','c'),("'",""),(' ','-'),('(',''),("):
        slug = slug.replace(a, b)"""

content = content.replace(old, new)

with open('/tmp/scpi_agent_batch.py', 'w') as f:
    f.write(content)

print("Patched!")
