import os from pathlib import Path import re def fix_routes(): routes_dir = Path("src/routes") for route_file in routes_dir.glob("*_routes.py"): content = route_file.read_text(encoding="utf-8") # Add await to crud.* calls # Matches: db_user = crud.get_by_id(user_id) -> await crud.get_by_id(user_id) # Matches: return crud.create(user_in) -> return await crud.create(user_in) # We need to be careful not to double await content = re.sub(r"(?