Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ae64b3a04 | ||
|
|
02b2e93e02 | ||
|
|
5c2252f5bf | ||
|
|
47deb43845 | ||
|
|
c1d1c10ca7 | ||
|
|
3ff62c5156 |
No files matched your search
@@ -0,0 +1 @@
|
||||
Prettier Fixer.py
|
||||
@@ -1,83 +0,0 @@
|
||||
# 导入os模块,用于操作文件和目录
|
||||
import os
|
||||
from time import sleep
|
||||
# 定义一个函数,接受一个文件名作为参数,返回修改后的内容
|
||||
|
||||
def modify_file(filename):
|
||||
# 打开文件,以只读模式
|
||||
with open(filename, 'r', encoding='UTF-8') as f:
|
||||
# 读取文件的所有行,存入一个列表
|
||||
lines = f.readlines()
|
||||
# 创建一个空列表,用于存储修改后的行
|
||||
new_lines = []
|
||||
num = 0
|
||||
# 遍历每一行
|
||||
for line in lines:
|
||||
if '"step 0";' in line:
|
||||
line = line.replace('"step 0";', '"step 0"')
|
||||
num+=1
|
||||
if '("step 1");' in line:
|
||||
line = line.replace('("step 1");', '"step 1"')
|
||||
num+=1
|
||||
if '("step 2");' in line:
|
||||
line = line.replace('("step 2");', '"step 2"')
|
||||
num+=1
|
||||
if '("step 3");' in line:
|
||||
line = line.replace('("step 3");', '"step 3"')
|
||||
num+=1
|
||||
if '("step 4");' in line:
|
||||
line = line.replace('("step 4");', '"step 4"')
|
||||
num+=1
|
||||
if '("step 5");' in line:
|
||||
line = line.replace('("step 5");', '"step 5"')
|
||||
num+=1
|
||||
if '("step 6");' in line:
|
||||
line = line.replace('("step 6");', '"step 6"')
|
||||
num+=1
|
||||
if '("step 7");' in line:
|
||||
line = line.replace('("step 7");', '"step 7"')
|
||||
num+=1
|
||||
if '("step 8");' in line:
|
||||
line = line.replace('("step 8");', '"step 8"')
|
||||
num+=1
|
||||
if '("step 9");' in line:
|
||||
line = line.replace('("step 9");', '"step 9"')
|
||||
num+=1
|
||||
if '("step 10");' in line:
|
||||
line = line.replace('("step 10");', '"step 10"')
|
||||
num+=1
|
||||
print(line)
|
||||
# 将修改后的行添加到新列表中
|
||||
new_lines.append(line)
|
||||
# 返回新列表中的所有行,用换行符连接
|
||||
print("Successfully fixed " + str(num) +" code errors")
|
||||
return ''.join(new_lines)
|
||||
|
||||
# 获取当前目录下的所有文件和子目录
|
||||
flag = False
|
||||
files = os.listdir('.')
|
||||
# 遍历每一个文件或子目录
|
||||
for file in files:
|
||||
# 如果是文件,并且文件名是extension.js
|
||||
if os.path.isfile(file) and file == 'extension.js':
|
||||
# 调用函数,传入文件名,得到修改后的内容
|
||||
content = modify_file(file)
|
||||
# 打开文件,以写入模式,覆盖原内容
|
||||
with open(file, 'w', encoding='UTF-8') as f:
|
||||
# 写入修改后的内容
|
||||
f.write(content)
|
||||
flag = True
|
||||
if os.path.isfile(file) and file == 'game.js':
|
||||
# 调用函数,传入文件名,得到修改后的内容
|
||||
content = modify_file(file)
|
||||
# 打开文件,以写入模式,覆盖原内容
|
||||
with open(file, 'w', encoding='UTF-8') as f:
|
||||
# 写入修改后的内容
|
||||
f.write(content)
|
||||
flag = True
|
||||
|
||||
if flag:
|
||||
pass
|
||||
else:
|
||||
print('ERROR')
|
||||
sleep(3)
|
||||
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 272 KiB |
|
After Width: | Height: | Size: 297 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 756 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 8.9 MiB |
|
Before Width: | Height: | Size: 532 KiB |
|
Before Width: | Height: | Size: 3.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 297 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 449 KiB |
|
Before Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 331 KiB |
|
Before Width: | Height: | Size: 451 KiB |
|
Before Width: | Height: | Size: 245 KiB |
|
Before Width: | Height: | Size: 584 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 334 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 338 KiB |
|
Before Width: | Height: | Size: 13 MiB |
|
Before Width: | Height: | Size: 562 KiB |
|
Before Width: | Height: | Size: 569 KiB |
|
Before Width: | Height: | Size: 9.1 MiB |
|
Before Width: | Height: | Size: 8.6 MiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 367 KiB |
|
Before Width: | Height: | Size: 6.6 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 456 KiB |
|
Before Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 843 KiB |
|
Before Width: | Height: | Size: 307 KiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 371 KiB |
|
Before Width: | Height: | Size: 316 KiB |
|
Before Width: | Height: | Size: 355 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 815 KiB |
|
Before Width: | Height: | Size: 920 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 544 KiB |
|
Before Width: | Height: | Size: 337 KiB |
|
Before Width: | Height: | Size: 658 KiB |
|
Before Width: | Height: | Size: 313 KiB |
|
Before Width: | Height: | Size: 928 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 5.6 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 342 KiB |
|
Before Width: | Height: | Size: 298 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 235 KiB |
|
Before Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 2.8 MiB |