bug-fixer / fix_generator.py
venky2k1
Upgraded to CodeT5 for full code bug fixing
22b22ed
raw
history blame contribute delete
514 Bytes
def generate_fix(code):
lines = code.split('\n')
fixed_lines = []
for line in lines:
stripped = line.strip()
# Fix print statements missing parentheses
if stripped.startswith("print ") and "(" not in stripped:
expression = stripped[6:]
fixed_line = f"print({expression})"
fixed_lines.append(fixed_line)
else:
fixed_lines.append(line)
return "\n".join(fixed_lines)
#genrate the fixed version of code using an ML Model