Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_java
提交
65e6fb7c
S
skill_tree_java
项目概览
CSDN 技术社区
/
skill_tree_java
通知
43
Star
8
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_java
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
65e6fb7c
编写于
3年前
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理windows平台的默认编码问题;临时兼容java技能树四级结构
上级
11249b1c
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
65 addition
and
214 deletion
+65
-214
data/3.Java高阶/1.通过行为参数化传递代码/1.行为参数化/config.json
data/3.Java高阶/1.通过行为参数化传递代码/1.行为参数化/config.json
+0
-0
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/config.json
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/config.json
+8
-0
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/sam.json
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/sam.json
+8
-0
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/sam.md
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/sam.md
+0
-0
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/config.json
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/config.json
+0
-40
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/config.json
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/config.json
+9
-0
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/double.json
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/double.json
+8
-0
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/double.md
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/double.md
+0
-0
data/3.Java高阶/1.通过行为参数化传递代码/4.真实的例子/config.json
data/3.Java高阶/1.通过行为参数化传递代码/4.真实的例子/config.json
+0
-40
data/3.Java高阶/11.反应式编程/1.反应式流以及Flow API/config.json
data/3.Java高阶/11.反应式编程/1.反应式流以及Flow API/config.json
+0
-0
data/3.Java高阶/11.反应式编程/2.使用反应式库RxJava/config.json
data/3.Java高阶/11.反应式编程/2.使用反应式库RxJava/config.json
+0
-0
data/3.Java高阶/11.反应式编程/3.Java反射技术/config.json
data/3.Java高阶/11.反应式编程/3.Java反射技术/config.json
+0
-0
data/tree.json
data/tree.json
+4
-124
src/tree.py
src/tree.py
+28
-10
未找到文件。
data/3.Java高阶/1.通过行为参数化传递代码/
2
.行为参数化/config.json
→
data/3.Java高阶/1.通过行为参数化传递代码/
1
.行为参数化/config.json
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/config.json
0 → 100644
浏览文件 @
65e6fb7c
{
"node_id"
:
"java-b121d453fc544e188b9ad50476c22f59"
,
"keywords"
:
[],
"children"
:
[
],
"export"
:
[
"sam.json"
]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/2.简写/sam.json
0 → 100644
浏览文件 @
65e6fb7c
{
"type"
:
"code_options"
,
"author"
:
"刘鑫"
,
"source"
:
"sam.md"
,
"notebook_enable"
:
true
,
"exercise_id"
:
"9f7e58ada74749099f03991776c0c350"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/
3
.简写/sam.md
→
data/3.Java高阶/1.通过行为参数化传递代码/
2
.简写/sam.md
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/config.json
已删除
100644 → 0
浏览文件 @
11249b1c
{
"node_id"
:
"java-b121d453fc544e188b9ad50476c22f59"
,
"keywords"
:
[],
"children"
:
[
{
"匿名类"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-afe49e9037d946b2934d38fa45bfc80d"
,
"title"
:
"匿名类"
}
},
{
"第五次尝试:使用匿名类"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第五次尝试:使用匿名类"
}
},
{
"第六次尝试:使用Lambda表达式"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第六次尝试:使用Lambda表达式"
}
},
{
"第七次尝试:将List类型抽象化"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
}
}
],
"export"
:
[
"sam.json"
],
"title"
:
"对付啰唆"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/config.json
0 → 100644
浏览文件 @
65e6fb7c
{
"node_id"
:
"java-db33d9c7f2004cdbbc058254fe536ace"
,
"keywords"
:
[],
"children"
:
[
],
"export"
:
[
"double.json"
],
"title"
:
"真实的例子"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.高序函数/double.json
0 → 100644
浏览文件 @
65e6fb7c
{
"type"
:
"code_options"
,
"author"
:
"刘鑫"
,
"source"
:
"double.md"
,
"notebook_enable"
:
true
,
"exercise_id"
:
"e6410eab038346daa724ca715e808c79"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.
简写/sam.json
→
data/3.Java高阶/1.通过行为参数化传递代码/3.
高序函数/double.md
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/4.真实的例子/config.json
已删除
100644 → 0
浏览文件 @
11249b1c
{
"node_id"
:
"java-db33d9c7f2004cdbbc058254fe536ace"
,
"keywords"
:
[],
"children"
:
[
{
"用Comparator来排序"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-a218b2a634d34529b4b65991e217632c"
,
"title"
:
"用Comparator来排序"
}
},
{
"用Runnable执行代码块"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"用Runnable执行代码块"
}
},
{
"通过Callable返回结果"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"通过Callable返回结果"
}
},
{
"GUI事件处理"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
}
}
],
"export"
:
[],
"title"
:
"真实的例子"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/11.反应式编程/
2
.反应式流以及Flow API/config.json
→
data/3.Java高阶/11.反应式编程/
1
.反应式流以及Flow API/config.json
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/3.Java高阶/11.反应式编程/
3
.使用反应式库RxJava/config.json
→
data/3.Java高阶/11.反应式编程/
2
.使用反应式库RxJava/config.json
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/3.Java高阶/11.反应式编程/
4
.Java反射技术/config.json
→
data/3.Java高阶/11.反应式编程/
3
.Java反射技术/config.json
浏览文件 @
65e6fb7c
文件已移动
This diff is collapsed.
Click to expand it.
data/tree.json
浏览文件 @
65e6fb7c
...
...
@@ -3976,38 +3976,6 @@
"node_id"
:
"java-fb711fb0dfbb40db974476ea2d9faf9d"
,
"keywords"
:
[],
"children"
:
[
{
"应对不断变化的需求"
:
{
"node_id"
:
"java-0a39f4040da04b8591f9b36f3c446789"
,
"keywords"
:
[],
"children"
:
[
{
"初试牛刀:筛选绿苹果"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-e888465b1043473fbb919fd4958e3179"
,
"title"
:
"初试牛刀:筛选绿苹果"
}
},
{
"再展身手:把颜色作为参数"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"再展身手:把颜色作为参数"
}
},
{
"第三次尝试:对你能想到的每个属性做筛选"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第三次尝试:对你能想到的每个属性做筛选"
}
}
]
}
},
{
"行为参数化"
:
{
"node_id"
:
"java-3a05a505cd514579a52321f0c945d577"
,
...
...
@@ -4016,81 +3984,17 @@
}
},
{
"
对付啰唆
"
:
{
"
简写
"
:
{
"node_id"
:
"java-b121d453fc544e188b9ad50476c22f59"
,
"keywords"
:
[],
"children"
:
[
{
"匿名类"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-afe49e9037d946b2934d38fa45bfc80d"
,
"title"
:
"匿名类"
}
},
{
"第五次尝试:使用匿名类"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第五次尝试:使用匿名类"
}
},
{
"第六次尝试:使用Lambda表达式"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第六次尝试:使用Lambda表达式"
}
},
{
"第七次尝试:将List类型抽象化"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
}
}
]
"children"
:
[]
}
},
{
"
真实的例子
"
:
{
"
高序函数
"
:
{
"node_id"
:
"java-db33d9c7f2004cdbbc058254fe536ace"
,
"keywords"
:
[],
"children"
:
[
{
"用Comparator来排序"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-a218b2a634d34529b4b65991e217632c"
,
"title"
:
"用Comparator来排序"
}
},
{
"用Runnable执行代码块"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"用Runnable执行代码块"
}
},
{
"通过Callable返回结果"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"通过Callable返回结果"
}
},
{
"GUI事件处理"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
}
}
]
"children"
:
[]
}
}
]
...
...
@@ -4619,30 +4523,6 @@
"node_id"
:
"java-0969aecf77a7416ba0fed596b2569a23"
,
"keywords"
:
[],
"children"
:
[
{
"反应式宣言"
:
{
"node_id"
:
"java-4c450036165e492c87e35ff7fb65b286"
,
"keywords"
:
[],
"children"
:
[
{
"应用层的反应式编程"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-f329984b23344a9c986045dd92ef2dec"
,
"title"
:
"应用层的反应式编程"
}
},
{
"反应式系统"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"反应式系统"
}
}
]
}
},
{
"反应式流以及Flow API"
:
{
"node_id"
:
"java-96551e0eb6b044ff8f7fe9b5ff27fd73"
,
...
...
This diff is collapsed.
Click to expand it.
src/tree.py
浏览文件 @
65e6fb7c
...
...
@@ -14,6 +14,7 @@ formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
handler
)
def
load_json
(
p
):
with
open
(
p
,
'r'
)
as
f
:
return
json
.
loads
(
f
.
read
())
...
...
@@ -28,7 +29,7 @@ def dump_json(p, j, exist_ok=False, override=False):
logger
.
error
(
f
"
{
p
}
already exist"
)
sys
.
exit
(
0
)
with
open
(
p
,
'w+'
)
as
f
:
with
open
(
p
,
'w+'
,
encoding
=
"utf8"
)
as
f
:
f
.
write
(
json
.
dumps
(
j
,
indent
=
2
,
ensure_ascii
=
False
))
...
...
@@ -94,23 +95,39 @@ class TreeWalker:
for
index
,
level
in
enumerate
(
root_node
[
"children"
]):
level_title
=
list
(
level
.
keys
())[
0
]
level_node
=
list
(
level
.
values
())[
0
]
level_path
=
os
.
path
.
join
(
self
.
root
,
f
"
{
index
+
1
}
.
{
level_title
}
"
)
level_path
=
os
.
path
.
join
(
self
.
root
,
f
"
{
index
+
1
}
.
{
level_title
}
"
)
self
.
load_chapters
(
level_path
,
level_node
)
for
index
,
chapter
in
enumerate
(
level_node
[
"children"
]):
chapter_title
=
list
(
chapter
.
keys
())[
0
]
chapter_node
=
list
(
chapter
.
values
())[
0
]
chapter_path
=
os
.
path
.
join
(
level_path
,
f
"
{
index
+
1
}
.
{
chapter_title
}
"
)
chapter_path
=
os
.
path
.
join
(
level_path
,
f
"
{
index
+
1
}
.
{
chapter_title
}
"
)
self
.
load_sections
(
chapter_path
,
chapter_node
)
for
index
,
section_node
in
enumerate
(
chapter_node
[
"children"
]):
section_title
=
list
(
section_node
.
keys
())[
0
]
full_path
=
os
.
path
.
join
(
chapter_path
,
f
"
{
index
}
.
{
section_title
}
"
)
full_path
=
os
.
path
.
join
(
chapter_path
,
f
"
{
index
+
1
}
.
{
section_title
}
"
)
if
os
.
path
.
isdir
(
full_path
):
self
.
ensure_exercises
(
full_path
)
# TODO 四级知识点的处理仅为 Java 技能树的临时处理而设定,未来java技能树上线前会删掉这部分代码,将四级节点
# 合并到三级节点
for
idx
,
[
num
,
sub_section_title
]
in
self
.
sort_dir_list
([
p
for
p
in
os
.
listdir
(
full_path
)
if
os
.
path
.
isdir
(
os
.
path
.
join
(
full_path
,
p
))]):
order
=
idx
+
1
ensure_path
=
os
.
path
.
join
(
full_path
,
f
"
{
order
}
.
{
sub_section_title
}
"
)
forth_full_path
=
os
.
path
.
join
(
full_path
,
f
"
{
num
}
.
{
sub_section_title
}
"
)
if
ensure_path
!=
forth_full_path
:
os
.
rename
(
forth_full_path
,
ensure_path
)
if
os
.
path
.
isdir
(
ensure_path
):
self
.
ensure_exercises
(
forth_full_path
)
tree_path
=
os
.
path
.
join
(
self
.
root
,
"tree.json"
)
dump_json
(
tree_path
,
self
.
tree
,
exist_ok
=
True
,
override
=
True
)
return
self
.
tree
def
sort_dir_list
(
self
,
dirs
):
result
=
[
self
.
extract_node_env
(
dir
)
for
dir
in
dirs
]
result
.
sort
(
key
=
lambda
item
:
item
[
0
])
return
result
def
load_levels
(
self
,
root_node
):
levels
=
[]
for
level
in
os
.
listdir
(
self
.
root
):
...
...
@@ -167,7 +184,7 @@ class TreeWalker:
for
index
,
[
number
,
element
]
in
enumerate
(
children
):
title
=
list
(
element
.
keys
())[
0
]
origin
=
os
.
path
.
join
(
base
,
f
"
{
number
}
.
{
title
}
"
)
posted
=
os
.
path
.
join
(
base
,
f
"
{
index
+
1
}
.
{
title
}
"
)
posted
=
os
.
path
.
join
(
base
,
f
"
{
index
+
1
}
.
{
title
}
"
)
if
origin
!=
posted
:
self
.
logger
.
info
(
f
"rename [
{
origin
}
] to [
{
posted
}
]"
)
os
.
rename
(
origin
,
posted
)
...
...
@@ -229,8 +246,8 @@ class TreeWalker:
config
=
{
"node_id"
:
self
.
gen_node_id
(),
"keywords"
:
[],
"children"
:[],
"export"
:[]
"children"
:
[],
"export"
:
[]
}
dump_json
(
config_path
,
config
,
exist_ok
=
True
,
override
=
True
)
else
:
...
...
@@ -258,7 +275,8 @@ class TreeWalker:
return
int
(
number
),
title
except
Exception
as
error
:
self
.
logger
.
error
(
f
"目录 [
{
path
}
] 解析失败,结构不合法,可能是缺少序号"
)
sys
.
exit
(
1
)
# sys.exit(1)
raise
error
def
load_chapter_node
(
self
,
full_name
):
config
=
self
.
ensure_chapter_config
(
full_name
)
...
...
@@ -290,8 +308,8 @@ class TreeWalker:
config
=
self
.
ensure_section_config
(
section_path
)
for
e
in
config
.
get
(
"export"
,
[]):
full_name
=
os
.
path
.
join
(
section_path
,
e
)
logger
.
info
(
full_name
)
exercise
=
load_json
(
full_name
)
if
"exercise_id"
not
in
exercise
:
exercise
[
"exercise_id"
]
=
uuid
.
uuid4
().
hex
dump_json
(
full_name
,
exercise
)
dump_json
(
full_name
,
exercise
,
exist_ok
=
True
,
override
=
True
)
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录