Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_pg
提交
062f543e
S
skill_tree_pg
项目概览
CSDN 技术社区
/
skill_tree_pg
通知
9
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_pg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
062f543e
编写于
12月 02, 2021
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed eid missed
上级
eb464464
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
62 addition
and
6 deletion
+62
-6
data/2.PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/extension.json
....PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/extension.json
+3
-1
data/2.PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/language.json
...2.PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/language.json
+3
-1
data/2.PostgreSQL中阶/2.服务端编程/1.聚合和分组/salary.json
data/2.PostgreSQL中阶/2.服务端编程/1.聚合和分组/salary.json
+3
-1
data/2.PostgreSQL中阶/2.服务端编程/2.连接查询/customer_order.json
data/2.PostgreSQL中阶/2.服务端编程/2.连接查询/customer_order.json
+3
-1
data/2.PostgreSQL中阶/2.服务端编程/5.CTE/to_root.json
data/2.PostgreSQL中阶/2.服务端编程/5.CTE/to_root.json
+3
-1
data/3.PostgreSQL高阶/1.集群和复制/3.fdw/fdw.json
data/3.PostgreSQL高阶/1.集群和复制/3.fdw/fdw.json
+3
-1
requirements.txt
requirements.txt
+1
-0
src/tree.py
src/tree.py
+43
-0
未找到文件。
data/2.PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/extension.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"extension.md"
,
"source"
:
"extension.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"fad124e7fe1a420dbfbe72de8d4b3f11"
}
}
\ No newline at end of file
data/2.PostgreSQL中阶/1.PostgreSQL数据库的基本结构/6.数据库扩展/language.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"language.md"
,
"source"
:
"language.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"4657a4c34eec421a913625fb61af00d4"
}
}
\ No newline at end of file
data/2.PostgreSQL中阶/2.服务端编程/1.聚合和分组/salary.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"salary.md"
,
"source"
:
"salary.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"31deab40b4af44c38c363b2333bdd977"
}
}
\ No newline at end of file
data/2.PostgreSQL中阶/2.服务端编程/2.连接查询/customer_order.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"customer_order.md"
,
"source"
:
"customer_order.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"18d5a22c34874bb4b73aac6846674243"
}
}
\ No newline at end of file
data/2.PostgreSQL中阶/2.服务端编程/5.CTE/to_root.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"to_root.md"
,
"source"
:
"to_root.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"45f0cef12fcf4f9e90276dff6a336657"
}
}
\ No newline at end of file
data/3.PostgreSQL高阶/1.集群和复制/3.fdw/fdw.json
浏览文件 @
062f543e
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
"type"
:
"code_options"
,
"type"
:
"code_options"
,
"author"
:
"ccat"
,
"author"
:
"ccat"
,
"source"
:
"fdw.md"
,
"source"
:
"fdw.md"
,
"notebook_enable"
:
false
"notebook_enable"
:
false
,
"exercise_id"
:
"762a9c3f032b4ce884858c18e2bb580c"
}
}
\ No newline at end of file
requirements.txt
浏览文件 @
062f543e
pre_commit
~=2.16.0
pre_commit
~=2.16.0
GitPython
~=3.1.24
\ No newline at end of file
src/tree.py
浏览文件 @
062f543e
...
@@ -4,6 +4,8 @@ import os
...
@@ -4,6 +4,8 @@ import os
import
re
import
re
import
sys
import
sys
import
uuid
import
uuid
import
re
import
git
id_set
=
set
()
id_set
=
set
()
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -12,7 +14,10 @@ handler = logging.StreamHandler(sys.stdout)
...
@@ -12,7 +14,10 @@ handler = logging.StreamHandler(sys.stdout)
formatter
=
logging
.
Formatter
(
'%(asctime)s - %(levelname)s - %(message)s'
)
formatter
=
logging
.
Formatter
(
'%(asctime)s - %(levelname)s - %(message)s'
)
handler
.
setFormatter
(
formatter
)
handler
.
setFormatter
(
formatter
)
logger
.
addHandler
(
handler
)
logger
.
addHandler
(
handler
)
repo
=
git
.
Repo
(
"."
)
def
user_name
():
return
repo
.
config_reader
().
get_value
(
"user"
,
"name"
)
def
load_json
(
p
):
def
load_json
(
p
):
with
open
(
p
,
'r'
)
as
f
:
with
open
(
p
,
'r'
)
as
f
:
...
@@ -301,6 +306,14 @@ class TreeWalker:
...
@@ -301,6 +306,14 @@ class TreeWalker:
def
ensure_exercises
(
self
,
section_path
):
def
ensure_exercises
(
self
,
section_path
):
config
=
self
.
ensure_section_config
(
section_path
)
config
=
self
.
ensure_section_config
(
section_path
)
for
e
in
os
.
listdir
(
section_path
):
base
,
ext
=
os
.
path
.
splitext
(
e
)
_
,
source
=
os
.
path
.
split
(
e
)
if
ext
!=
".md"
:
continue
meta_path
=
os
.
path
.
join
(
section_path
,
base
+
".json"
)
self
.
ensure_exercises_meta
(
meta_path
,
source
)
for
e
in
config
.
get
(
"export"
,
[]):
for
e
in
config
.
get
(
"export"
,
[]):
full_name
=
os
.
path
.
join
(
section_path
,
e
)
full_name
=
os
.
path
.
join
(
section_path
,
e
)
exercise
=
load_json
(
full_name
)
exercise
=
load_json
(
full_name
)
...
@@ -311,6 +324,36 @@ class TreeWalker:
...
@@ -311,6 +324,36 @@ class TreeWalker:
else
:
else
:
id_set
.
add
(
exercise
[
"exercise_id"
])
id_set
.
add
(
exercise
[
"exercise_id"
])
def
ensure_exercises_meta
(
self
,
meta_path
,
source
):
_
,
mfile
=
os
.
path
.
split
(
meta_path
)
if
os
.
path
.
exists
(
meta_path
):
meta
=
load_json
(
meta_path
)
if
"exercise_id"
not
in
meta
:
meta
[
"exercise_id"
]
=
uuid
.
uuid4
().
hex
if
"notebook_enable"
not
in
meta
:
meta
[
"notebook_enable"
]
=
self
.
default_notebook
()
if
"source"
not
in
meta
:
meta
[
"source"
]
=
source
if
"author"
not
in
meta
:
meta
[
"author"
]
=
user_name
()
if
"type"
not
in
meta
:
meta
[
"type"
]
=
"code_options"
else
:
meta
=
{
"type"
:
"code_options"
,
"author"
:
user_name
(),
"source"
:
source
,
"notebook_enable"
:
self
.
default_notebook
(),
"exercise_id"
:
uuid
.
uuid4
().
hex
}
dump_json
(
meta_path
,
meta
,
True
,
True
)
def
default_notebook
(
self
):
if
self
.
name
in
[
"python"
,
"java"
,
"c"
,
"algorithm"
]:
return
True
else
:
return
False
def
check_section_keywords
(
self
,
full_path
):
def
check_section_keywords
(
self
,
full_path
):
config
=
self
.
ensure_section_config
(
full_path
)
config
=
self
.
ensure_section_config
(
full_path
)
if
not
config
.
get
(
"keywords"
,
[]):
if
not
config
.
get
(
"keywords"
,
[]):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录