Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_algorithm
提交
7c76b1d2
S
skill_tree_algorithm
项目概览
CSDN 技术社区
/
skill_tree_algorithm
通知
9
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_algorithm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7c76b1d2
编写于
12月 07, 2021
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for merge
上级
8f95621a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
79 addition
and
111 deletion
+79
-111
.gitignore
.gitignore
+3
-1
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
+4
-2
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
+4
-2
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
+2
-1
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
+4
-2
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
+4
-2
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
+4
-2
leetcode_helper.py
leetcode_helper.py
+42
-91
main.py
main.py
+0
-2
未找到文件。
.gitignore
浏览文件 @
7c76b1d2
...
...
@@ -19,4 +19,6 @@ fix_bug.py
tools.py
back_.md
test.md
lanqiao.cpp
\ No newline at end of file
lanqiao.cpp
*.iml
**/.idea/**
\ No newline at end of file
data/1.算法初阶/1.蓝桥杯-基础/30.k倍区间/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"d5ad2458a40a46daaf75bbb9291e6d4b"
"source"
:
"solution.md"
,
"exercise_id"
:
"d5ad2458a40a46daaf75bbb9291e6d4b"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/1.蓝桥杯-基础/37.平面切分/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"e572003202d0462fa95f635381897624"
"source"
:
"solution.md"
,
"exercise_id"
:
"e572003202d0462fa95f635381897624"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/3.蓝桥杯-递归/7.逆波兰表达式/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md
.md
"
,
"source"
:
"solution.md"
,
"exercise_id"
:
"c29652154669434cb71e4f036b690fef"
}
\ No newline at end of file
data/1.算法初阶/5.蓝桥杯-模拟/13.灵能传输/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"a7672a561bd14ce5ba8bca21c4074683"
"source"
:
"solution.md"
,
"exercise_id"
:
"a7672a561bd14ce5ba8bca21c4074683"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/5.蓝桥杯-模拟/16.三体攻击/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"4db03bcefa5649d19f4dd5fe293221ab"
"source"
:
"solution.md"
,
"exercise_id"
:
"4db03bcefa5649d19f4dd5fe293221ab"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/3.装饰珠/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"8b374f1e3965460e97f165638222ab90"
"source"
:
"solution.md"
,
"exercise_id"
:
"8b374f1e3965460e97f165638222ab90"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/5.组合数问题/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"3c3985435f414d7f9a8bbdcf42a42d46"
"source"
:
"solution.md"
,
"exercise_id"
:
"3c3985435f414d7f9a8bbdcf42a42d46"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/6.糖果/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"3c7880dd590c4f7cbe182c2c00af0e5a"
"source"
:
"solution.md"
,
"exercise_id"
:
"3c7880dd590c4f7cbe182c2c00af0e5a"
,
"notebook_enable"
:
true
}
\ No newline at end of file
data/1.算法初阶/7.蓝桥杯-动态规划/8.垒骰子/solution.json
浏览文件 @
7c76b1d2
{
"type"
:
"code_options"
,
"author"
:
"csdn.net"
,
"source"
:
"solution.md.md"
,
"exercise_id"
:
"6b4b68a3ead544a2a9640d9ca6f008b1"
"source"
:
"solution.md"
,
"exercise_id"
:
"6b4b68a3ead544a2a9640d9ca6f008b1"
,
"notebook_enable"
:
true
}
\ No newline at end of file
leetcode_helper.py
浏览文件 @
7c76b1d2
...
...
@@ -5,6 +5,7 @@ import json
import
uuid
import
argparse
import
collections
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--run"
,
type
=
str
,
help
=
"Decide to run which function"
)
args
=
parser
.
parse_args
()
...
...
@@ -26,6 +27,7 @@ def get_files_path(file_dir, filetype='.txt'):
files_path
.
append
(
os
.
path
.
join
(
root
,
file
))
return
files_path
def
leetcode_helper
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dailycode_exercises_dir
=
'/Users/zhangzc/Desktop/workplace/daily-code-data/data/input/dailycode/leetcode/exercises'
...
...
@@ -40,10 +42,11 @@ def leetcode_helper():
assert
os
.
path
.
isdir
(
dir
)
exercises_id
=
dir
.
split
(
'/'
)[
-
1
].
split
(
'_'
)[
0
]
if
0
<=
int
(
exercises_id
)
and
int
(
exercises_id
)
<
100
:
desc_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}_desc.html'
.
format
(
exercises_id
))
cpp_code_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}.cpp'
.
format
(
exercises_id
))
desc_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}_desc.html'
.
format
(
exercises_id
))
cpp_code_src_path
=
os
.
path
.
join
(
os
.
path
.
join
(
dailycode_exercises_dir
,
exercises_id
),
'{}.cpp'
.
format
(
exercises_id
))
desc_dst_path
=
os
.
path
.
join
(
dir
,
'desc.html'
)
cpp_code_dst_path
=
os
.
path
.
join
(
dir
,
'solution.cpp'
)
...
...
@@ -58,10 +61,10 @@ def leetcode_helper():
if
not
os
.
path
.
exists
(
cpp_code_dst_path
):
open
(
cpp_code_dst_path
,
'w'
,
encoding
=
'utf-8'
)
if
100
<=
int
(
exercises_id
)
and
int
(
exercises_id
)
<
203
:
with
open
(
cpp_code_dst_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
cpp_code
=
f
.
read
()
cpp_code
=
f
.
read
()
if
cpp_code
==
''
and
not
os
.
path
.
exists
(
shell_code_dst_path
)
and
not
os
.
path
.
exists
(
sql_code_dst_path
):
print
(
cpp_code_dst_path
)
desc_src_path
=
os
.
path
.
join
(
crawer_leetcode_dir
,
str
(
int
(
exercises_id
)
+
1
)
+
'.html'
)
...
...
@@ -72,11 +75,11 @@ def leetcode_helper():
if
os
.
path
.
exists
(
desc_src_path
):
shutil
.
copy
(
desc_src_path
,
desc_dst_path
)
else
:
pass
# print("该路径不存在,请检查: {}".format(desc_src_path))
def
leetcode_helper_delete_md
():
data_dir
=
'data/3.算法高阶/1.leetcode'
...
...
@@ -101,6 +104,7 @@ def leetcode_helper_delete_md():
if
leetcode_solution_md_data
==
template
:
os
.
remove
(
solution_md_path
)
def
leetcode_helper_update_md
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -130,6 +134,7 @@ def leetcode_helper_update_md():
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
def
leetcode_helper_update_config
():
data_dir
=
'data/3.算法高阶/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -161,7 +166,7 @@ def leetcode_helper_update_config():
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
,
"exercise_id"
:
exercise_id
,
}
solution_json
=
json
.
dumps
(
solution_json_data
,
ensure_ascii
=
False
,
indent
=
3
)
with
open
(
solution_json_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
...
...
@@ -211,7 +216,6 @@ def count_exercises():
dst_exercises_ids
=
[
i
for
i
in
range
(
200
)]
lacked_id
=
set
(
dst_exercises_ids
)
-
set
(
exercises_ids
)
print
(
lacked_id
)
def
modify_config_and_dir_name
():
...
...
@@ -237,7 +241,7 @@ def modify_config_and_dir_name():
# with open(config_path, 'r', encoding='utf-8') as f:
# config_data = json.load(f)
config_data
[
'node_id'
]
=
"algorithm-"
+
uuid
.
uuid4
().
hex
config_data
[
'node_id'
]
=
"algorithm-"
+
uuid
.
uuid4
().
hex
config_data
[
'keywords'
]
=
[
"leetcode"
,
title
]
config_data
[
'children'
]
=
[]
config_data
[
'export'
]
=
[
'solution.json'
]
...
...
@@ -249,10 +253,7 @@ def modify_config_and_dir_name():
f
.
write
(
config_data_json
)
def
modify_config_and_dir_name_new
():
dirs
=
[
'data/2.算法中阶'
,
'data/3.算法高阶'
,
'data/1.算法初阶'
]
exercises_ids
=
[]
for
dir
in
dirs
:
...
...
@@ -262,7 +263,7 @@ def modify_config_and_dir_name_new():
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
...
...
@@ -273,7 +274,7 @@ def modify_config_and_dir_name_new():
for
idx
,
tem_dir
in
enumerate
(
exercises_dirs
):
config_path
=
os
.
path
.
join
(
tem_dir
,
'config.json'
)
solution_md_path
=
os
.
path
.
join
(
tem_dir
,
'solution.md'
)
if
dir
==
"data/1.算法初阶"
:
title
=
tem_dir
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
1
]
else
:
...
...
@@ -282,16 +283,16 @@ def modify_config_and_dir_name_new():
solution_md_data
=
f
.
read
()
if
solution_md_data
.
find
(
'# {}
\n\n
'
.
format
(
title
))
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'# {}'
.
format
(
title
),
'# {}
\n
'
.
format
(
title
))
if
solution_md_data
.
find
(
'## aop
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## aop'
,
'## aop
\n
'
)
if
solution_md_data
.
find
(
'## 答案
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## 答案'
,
'## 答案
\n
'
)
if
solution_md_data
.
find
(
'## 选项
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## 选项'
,
'## 选项
\n
'
)
if
solution_md_data
.
find
(
'### before
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'### before'
,
'### before
\n
'
)
...
...
@@ -300,15 +301,13 @@ def modify_config_and_dir_name_new():
if
solution_md_data
.
find
(
'
\n\n
```cpp'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'```cpp'
,
'
\n
```cpp'
)
if
solution_md_data
.
find
(
'
\n\n
### '
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'### '
,
'
\n
### '
)
print
(
tem_dir
)
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
# with open(config_path, 'r', encoding='utf-8') as f:
# config_data = json.load(f)
...
...
@@ -320,9 +319,6 @@ def modify_config_and_dir_name_new():
# f.write(config_data_json)
def
modify_back_up_dir_name
():
# dirs = ['data/2.算法中阶', 'data/3.算法高阶']
# exercises_ids = []
...
...
@@ -344,7 +340,7 @@ def modify_back_up_dir_name():
new_dir_name
=
os
.
path
.
join
(
root_dir
,
new_dir_name
)
os
.
rename
(
algo_floor_dir
,
new_dir_name
)
print
(
new_dir_name
)
def
leetcode_helper_add_sloutionjson
():
data_dir
=
'data_backup/1.leetcode'
...
...
@@ -369,14 +365,13 @@ def leetcode_helper_add_sloutionjson():
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
,
"exercise_id"
:
exercise_id
,
}
solution_json
=
json
.
dumps
(
solution_json_data
,
ensure_ascii
=
False
,
indent
=
2
)
with
open
(
solution_json_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_json
)
def
fix_bug
():
data_dir
=
'data_backup/1.leetcode'
dirs_
=
os
.
listdir
(
data_dir
)
...
...
@@ -387,7 +382,7 @@ def fix_bug():
dirs
.
append
(
dir
)
for
dir
in
dirs
:
assert
os
.
path
.
isdir
(
dir
)
solution_md_path
=
os
.
path
.
join
(
dir
,
'solution.md'
)
if
not
os
.
path
.
exists
(
solution_md_path
):
continue
...
...
@@ -398,16 +393,16 @@ def fix_bug():
# print(title)
solution_md_data
=
solution_md_data
.
replace
(
'# 两数之和'
,
'# {}'
.
format
(
title
))
if
solution_md_data
.
find
(
'# {}
\n\n
'
.
format
(
title
))
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'# {}'
.
format
(
title
),
'# {}
\n
'
.
format
(
title
))
solution_md_data
=
solution_md_data
.
replace
(
'# {}'
.
format
(
title
),
'# {}
\n
'
.
format
(
title
))
if
solution_md_data
.
find
(
'## aop
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## aop'
,
'## aop
\n
'
)
if
solution_md_data
.
find
(
'## 答案
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## 答案'
,
'## 答案
\n
'
)
if
solution_md_data
.
find
(
'
\n\n
## 选项
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'## 选项'
,
'
\n
## 选项
\n
'
)
if
solution_md_data
.
find
(
'### before
\n\n
'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'### before'
,
'### before
\n
'
)
...
...
@@ -416,20 +411,19 @@ def fix_bug():
if
solution_md_data
.
find
(
'A
\n\n
```cpp'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'A
\n
```cpp'
,
'A
\n\n
```cpp'
)
if
solution_md_data
.
find
(
'B
\n\n
```cpp'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'B
\n
```cpp'
,
'B
\n\n
```cpp'
)
if
solution_md_data
.
find
(
'C
\n\n
```cpp'
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'C
\n
```cpp'
,
'C
\n\n
```cpp'
)
print
(
dir
)
if
solution_md_data
.
find
(
'
\n\n
### '
)
==
-
1
:
solution_md_data
=
solution_md_data
.
replace
(
'### '
,
'
\n
### '
)
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
def
add_color_for_special_exercises
():
count
=
0
...
...
@@ -442,7 +436,7 @@ def add_color_for_special_exercises():
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
...
...
@@ -453,7 +447,7 @@ def add_color_for_special_exercises():
for
idx
,
tem_dir
in
enumerate
(
exercises_dirs
):
config_path
=
os
.
path
.
join
(
tem_dir
,
'config.json'
)
solution_md_path
=
os
.
path
.
join
(
tem_dir
,
'solution.md'
)
count
+=
1
count
+=
1
print
(
solution_md_path
)
with
open
(
solution_md_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
solution_md_data
=
f
.
read
()
...
...
@@ -461,10 +455,8 @@ def add_color_for_special_exercises():
solution_md_data
=
solution_md_data
.
replace
(
'错误'
,
'<span style="color:red">错误</span>'
)
with
open
(
solution_md_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_md_data
)
print
(
'当前已有 {} 道习题'
.
format
(
count
))
print
(
'当前已有 {} 道习题'
.
format
(
count
))
def
add_solution_md_template_for_lanqiao
():
...
...
@@ -477,7 +469,7 @@ def add_solution_md_template_for_lanqiao():
dirs
.
append
(
dir
)
for
dir
in
dirs
:
assert
os
.
path
.
isdir
(
dir
)
solution_md_path
=
os
.
path
.
join
(
dir
,
'solution.md'
)
solution_json_path
=
os
.
path
.
join
(
dir
,
'solution.json'
)
...
...
@@ -502,11 +494,11 @@ def add_solution_md_template_for_lanqiao():
if
not
os
.
path
.
exists
(
solution_json_path
):
exercise_id
=
uuid
.
uuid4
().
hex
solution_json_data
=
{
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
}
"type"
:
"code_options"
,
"author"
:
"CSDN.net"
,
"source"
:
"solution.md"
,
"exercise_id"
:
exercise_id
}
solution_json_data_json
=
json
.
dumps
(
solution_json_data
,
ensure_ascii
=
False
,
indent
=
2
)
with
open
(
solution_json_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
solution_json_data_json
)
...
...
@@ -527,7 +519,7 @@ def check_exercises_is_duplicate():
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
...
...
@@ -554,7 +546,7 @@ def add_config_export():
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
...
...
@@ -583,7 +575,7 @@ def add_config_export_for_lanqiao_backup():
dirs
.
append
(
dir
)
for
dir
in
dirs
:
assert
os
.
path
.
isdir
(
dir
)
config_path
=
os
.
path
.
join
(
dir
,
'config.json'
)
print
(
config_path
)
with
open
(
config_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
...
...
@@ -606,7 +598,7 @@ def fixbug_for_md():
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
...
...
@@ -624,8 +616,6 @@ def fixbug_for_md():
f
.
write
(
solution_md_data
)
if
helper_function
==
'count_tag_class'
:
count_tag_class
()
if
helper_function
==
'count_exercises'
:
...
...
@@ -633,50 +623,11 @@ if helper_function == 'count_exercises':
if
helper_function
==
'modify_back_up_dir_name'
:
modify_back_up_dir_name
()
# add_solution_md_template_for_lanqiao()
# add_color_for_special_exercises()
def
remove_unse_md_file
():
count
=
0
dirs
=
[
'data/2.算法中阶'
,
'data/3.算法高阶'
,
'data/1.算法初阶'
]
exercises_ids
=
[]
for
dir
in
dirs
:
dirs_
=
os
.
listdir
(
dir
)
algo_floor_dirs
=
[]
for
algo_floor_dir
in
dirs_
:
leetcode_class_dir
=
os
.
path
.
join
(
dir
,
algo_floor_dir
)
if
os
.
path
.
isdir
(
leetcode_class_dir
):
algo_floor_dirs
.
append
(
leetcode_class_dir
)
for
algo_floor_dir
in
algo_floor_dirs
:
exercises_dirs_
=
os
.
listdir
(
algo_floor_dir
)
exercises_dirs
=
[]
for
exercises_dir_
in
exercises_dirs_
:
exercises_dir
=
os
.
path
.
join
(
algo_floor_dir
,
exercises_dir_
)
if
os
.
path
.
isdir
(
exercises_dir
):
exercises_dirs
.
append
(
exercises_dir
)
for
idx
,
tem_dir
in
enumerate
(
exercises_dirs
):
desc_md_path
=
os
.
path
.
join
(
tem_dir
,
'desc.md'
)
print
(
desc_md_path
)
if
os
.
path
.
exists
(
desc_md_path
):
os
.
remove
(
desc_md_path
)
remove_unse_md_file
()
# check_exercises_is_duplicate()
# leetcode_helper_update_md()
# leetcode_helper_update_config()
main.py
浏览文件 @
7c76b1d2
...
...
@@ -5,5 +5,3 @@ if __name__ == '__main__':
walker
=
TreeWalker
(
"data"
,
"algorithm"
,
"Algorithm"
)
walker
.
walk
()
math
=
MathWalker
(
'data'
)
math
.
walk
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录