Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_oceanbase
提交
8a3bbbcc
S
skill_tree_oceanbase
项目概览
CSDN 技术社区
/
skill_tree_oceanbase
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8a3bbbcc
编写于
11月 09, 2021
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed odd orders
上级
e14884d6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
3 deletion
+15
-3
src/tree.py
src/tree.py
+15
-3
未找到文件。
src/tree.py
浏览文件 @
8a3bbbcc
...
@@ -119,7 +119,8 @@ class TreeWalker:
...
@@ -119,7 +119,8 @@ class TreeWalker:
level_path
=
os
.
path
.
join
(
self
.
root
,
level
)
level_path
=
os
.
path
.
join
(
self
.
root
,
level
)
num
,
config
=
self
.
load_level_node
(
level_path
)
num
,
config
=
self
.
load_level_node
(
level_path
)
levels
.
append
((
num
,
config
))
levels
.
append
((
num
,
config
))
levels
.
sort
(
key
=
lambda
item
:
item
[
0
])
levels
=
self
.
resort_children
(
self
.
root
,
levels
)
root_node
[
"children"
]
=
[
item
[
1
]
for
item
in
levels
]
root_node
[
"children"
]
=
[
item
[
1
]
for
item
in
levels
]
return
root_node
return
root_node
...
@@ -145,7 +146,7 @@ class TreeWalker:
...
@@ -145,7 +146,7 @@ class TreeWalker:
num
,
chapter
=
self
.
load_chapter_node
(
full_name
)
num
,
chapter
=
self
.
load_chapter_node
(
full_name
)
chapters
.
append
((
num
,
chapter
))
chapters
.
append
((
num
,
chapter
))
chapters
.
sort
(
key
=
lambda
item
:
item
[
0
]
)
chapters
=
self
.
resort_children
(
base
,
chapters
)
level_node
[
"children"
]
=
[
item
[
1
]
for
item
in
chapters
]
level_node
[
"children"
]
=
[
item
[
1
]
for
item
in
chapters
]
return
level_node
return
level_node
...
@@ -157,10 +158,21 @@ class TreeWalker:
...
@@ -157,10 +158,21 @@ class TreeWalker:
num
,
section
=
self
.
load_section_node
(
full_name
)
num
,
section
=
self
.
load_section_node
(
full_name
)
sections
.
append
((
num
,
section
))
sections
.
append
((
num
,
section
))
sections
.
sort
(
key
=
lambda
item
:
item
[
0
]
)
sections
=
self
.
resort_children
(
base
,
sections
)
chapter_node
[
"children"
]
=
[
item
[
1
]
for
item
in
sections
]
chapter_node
[
"children"
]
=
[
item
[
1
]
for
item
in
sections
]
return
chapter_node
return
chapter_node
def
resort_children
(
self
,
base
,
children
):
children
.
sort
(
key
=
lambda
item
:
item
[
0
])
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
}
"
)
if
origin
!=
posted
:
self
.
logger
.
info
(
f
"rename [
{
origin
}
] to [
{
posted
}
]"
)
os
.
rename
(
origin
,
posted
)
return
children
def
ensure_chapters
(
self
):
def
ensure_chapters
(
self
):
for
subdir
in
os
.
listdir
(
self
.
root
):
for
subdir
in
os
.
listdir
(
self
.
root
):
self
.
ensure_level_config
(
subdir
)
self
.
ensure_level_config
(
subdir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录