-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrename_script.py
More file actions
55 lines (46 loc) · 1.97 KB
/
Copy pathrename_script.py
File metadata and controls
55 lines (46 loc) · 1.97 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import glob
replacements = {
# Imports
"from safemath import": "from safemathjax import",
"import safemath as": "import safemathjax as",
# string references
"getLogger('safemath')": "getLogger('safemathjax')",
"safemath=safemath.cli:main": "safemathjax=safemathjax.cli:main",
"name=\"safemath\"": "name=\"SafeMathJax\"",
"name = \"safemath\"": "name = \"SafeMathJax\"",
"pip install safemath": "pip install SafeMathJax",
"safemath \"log(10)": "safemathjax \"log(10)",
"safemath \"x^2": "safemathjax \"x^2",
"safemath=safemathjax.cli:main": "safemathjax=safemathjax.cli:main",
# Pyproject / Setup / README
"yourusername/safemath": "qaflabindia/SafeMathJax",
"amanchoudhary1727/safemath": "qaflabindia/SafeMathJax",
"safemath#readme": "SafeMathJax#readme",
"--cov=safemath": "--cov=safemathjax",
"project/safemath/": "project/SafeMathJax/",
"pyversions/safemath.svg": "pyversions/SafeMathJax.svg",
"py/safemath.svg": "py/SafeMathJax.svg",
"SafeMath library": "SafeMathJax library",
"SafeMath Library": "SafeMathJax Library",
"SafeMath operations": "SafeMathJax operations",
"SafeMath functionality": "SafeMathJax functionality",
"# 🛡️ SafeMath": "# 🛡️ SafeMathJax",
"**SafeMath** –": "**SafeMathJax** –"
}
files_to_check = []
files_to_check.extend(glob.glob("**/*.py", recursive=True))
files_to_check.extend(glob.glob("**/*.md", recursive=True))
files_to_check.extend(glob.glob("**/*.toml", recursive=True))
for filepath in files_to_check:
if not os.path.isfile(filepath) or 'rename_script.py' in filepath:
continue
with open(filepath, 'r') as f:
content = f.read()
new_content = content
for old, new in replacements.items():
new_content = new_content.replace(old, new)
if new_content != content:
with open(filepath, 'w') as f:
f.write(new_content)
print(f"Updated {filepath}")