-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_m5_structure.py
More file actions
31 lines (24 loc) · 1.01 KB
/
fix_m5_structure.py
File metadata and controls
31 lines (24 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import os
path = 'src/recon_lite/learning/m5_structure.py'
with open(path, 'rb') as f:
content = f.read()
# Normalize to LF for easier replacement, then we'll save back (LF is usually safer in WSL)
lines = content.splitlines()
new_lines = []
skip = 0
for i, line in enumerate(lines):
if skip > 0:
skip -= 1
continue
if b'# Check if ready for trial - EXPANSION: lowered to 0.40' in line:
new_lines.append(b' # Check if ready for trial - Delta-based analysis')
new_lines.append(b' consistency, signature, goal = cell.analyze_pattern_delta_based()')
new_lines.append(b' if goal:')
new_lines.append(b' cell.metadata["goal_vector"] = goal')
skip = 1 # Skip the next line which is 'consistency, _ = cell.analyze_pattern()'
else:
new_lines.append(line)
with open(path, 'wb') as f:
f.write(b'\n'.join(new_lines) + b'\n')
print("Fix applied successfully")