Skip to content

Commit f0d719f

Browse files
committed
feat: update solutions to lc problems
1 parent fa56f9c commit f0d719f

File tree

24 files changed

+17093
-16858
lines changed

24 files changed

+17093
-16858
lines changed

run_format.py

+17-13
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ def remove_header(path: str):
3232
if path.endswith('.php'):
3333
content = content.rstrip()
3434
content = content.replace('<?php\n', '')
35-
elif path.endswith('.go') and 'sorting' not in path:
36-
content = content.replace('package main\n\n', '').replace('package main\n', '')
35+
elif path.endswith('.go'):
36+
content = content.rstrip()
37+
if 'sorting' not in path:
38+
content = content.replace('package main\n\n', '').replace(
39+
'package main\n', ''
40+
)
3741
else:
3842
return
3943
with open(path, 'w', encoding='utf-8') as f:
@@ -95,20 +99,20 @@ def run():
9599
"""Start formatting"""
96100
paths = find_all_paths()
97101

98-
# for path in paths:
99-
# add_header(path)
100-
# if any(path.endswith(suf) for suf in ['c', 'cpp', 'java']):
101-
# # format with clang-format
102-
# os.system(f'npx clang-format -i --style=file "{path}"')
102+
for path in paths:
103+
add_header(path)
104+
if any(path.endswith(suf) for suf in ['c', 'cpp', 'java']):
105+
# format with clang-format
106+
os.system(f'npx clang-format -i --style=file "{path}"')
103107

104-
# # format with prettier
105-
# os.system('npx prettier --write "**/*.{md,js,ts,php}"')
108+
# format with prettier
109+
os.system('npx prettier --write "**/*.{md,js,ts,php}"')
106110

107-
# # format with gofmt
108-
# os.system('gofmt -w .')
111+
# format with gofmt
112+
os.system('gofmt -w .')
109113

110-
# for path in paths:
111-
# remove_header(path)
114+
for path in paths:
115+
remove_header(path)
112116
for path in paths:
113117
format_inline_code(path)
114118

0 commit comments

Comments
 (0)