-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_campaign.py
More file actions
21 lines (19 loc) · 987 Bytes
/
Copy pathreplace_campaign.py
File metadata and controls
21 lines (19 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os, re
exclude_dirs = {'.git', 'results', '.microbenchmarks-rocm-venv', '__pycache__', 'venv', 'aiter'}
for root, dirs, files in os.walk('.'):
dirs[:] = [d for d in dirs if d not in exclude_dirs]
for f in files:
if f.endswith(('.py', '.md', '.sh', '.json')):
filepath = os.path.join(root, f)
try:
with open(filepath, 'r', encoding='utf-8') as file:
content = file.read()
new_content = re.sub(r'\bCampaign\b', 'Benchmark', content)
new_content = re.sub(r'\bcampaign\b', 'benchmark', new_content)
new_content = re.sub(r'\bCAMPAIGN\b', 'BENCHMARK', new_content)
if new_content != content:
with open(filepath, 'w', encoding='utf-8') as file:
file.write(new_content)
print(f'Updated {filepath}')
except Exception:
pass