提交 ee801ad4 编写于 作者: M Mars Liu

fixed strcutre errors

上级 82cb5562
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "HelloWorld.md", "source": "HelloWorld.md",
"exercise_id":"1190bb7834904da0b1f20915960714d5", "exercise_id": "1190bb7834904da0b1f20915960714d5",
"notebook_enable": true "notebook_enable": true
} }
\ No newline at end of file
{ {
"keywords": [], "keywords": ["class", "类", "面向对象", "oo"],
"children": [], "children": [],
"node_id": "java-0593e0b9c9f74799a204d697f0db488b", "node_id": "java-0593e0b9c9f74799a204d697f0db488b",
"export": [ "export": [
......
{ {
"node_id": "java-3ea06f6d049d4c079a88747ffd0cc51e", "node_id": "java-3ea06f6d049d4c079a88747ffd0cc51e",
"keywords": [], "keywords": ["字节流", "bytestream"],
"children": [], "children": [],
"export": [ "export": [
"bytestream.json" "bytestream.json"
......
{ {
"node_id": "java-046d129404f14676af135da42fea658b", "node_id": "java-046d129404f14676af135da42fea658b",
"keywords": [], "keywords": ["文件", "文件类", "file"],
"children": [], "children": [],
"export": [ "export": [
"file.json" "file.json"
......
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "app.md", "source": "app.md",
"exercise_id": "f83bb3ca8a7d4070a5cdb850c8745d43" "exercise_id": "f83bb3ca8a7d4070a5cdb850c8745d43",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "comment.md", "source": "comment.md",
"exercise_id":"a666420ebe28430dab8ad4bd99306dfb" "exercise_id": "a666420ebe28430dab8ad4bd99306dfb",
"notebook_enable": true
} }
\ No newline at end of file
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "keyword.md", "source": "keyword.md",
"exercise_id": "57b6f2510fde488486f73ab8597370c6" "exercise_id": "57b6f2510fde488486f73ab8597370c6",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "swap.md", "source": "swap.md",
"exercise_id":"accd5c6fca914d69990826e6123de37e" "exercise_id": "accd5c6fca914d69990826e6123de37e",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "vars.md", "source": "vars.md",
"exercise_id":"f990d6473c1c4b0c8947c27681c8f476" "exercise_id": "f990d6473c1c4b0c8947c27681c8f476",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "solidity.md", "source": "solidity.md",
"exercise_id":"45bc14d503364f999f98e5d2faad2fec" "exercise_id": "45bc14d503364f999f98e5d2faad2fec",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "scope.md", "source": "scope.md",
"exercise_id":"009d35ca11a24baa809d0eeb5e2f66e2" "exercise_id": "009d35ca11a24baa809d0eeb5e2f66e2",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "find.md", "source": "find.md",
"exercise_id":"61cca0fdecc34b00b173f4edc575ce48" "exercise_id": "61cca0fdecc34b00b173f4edc575ce48",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "max.md", "source": "max.md",
"exercise_id":"5025886554e5470e82710ed84735e419" "exercise_id": "5025886554e5470e82710ed84735e419",
"notebook_enable": true
} }
\ No newline at end of file
{ {
"node_id": "java-98b609c0de1544bf955cd3e1996224f7", "node_id": "java-98b609c0de1544bf955cd3e1996224f7",
"keywords": [], "keywords": ["集合", "legacy"],
"children": [ "children": [
{ {
"属性映射": { "属性映射": {
......
{ {
"node_id": "java-af0bf70f564b4ac68a7fadda69d55086", "node_id": "java-af0bf70f564b4ac68a7fadda69d55086",
"keywords": [], "keywords": ["集合", "collection"],
"children": [ "children": [
{ {
"集合接口与实现分离": { "集合接口与实现分离": {
......
{ {
"type": "code_options", "type": "code_options",
"author": "lostrex", "author": "lostrex",
"source": "hashset.md", "source": "hashset.md",
"exercise_id": "", "exercise_id": "",
"notebook_enable": false "notebook_enable": false
} }
\ No newline at end of file
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "ifelse.md", "source": "ifelse.md",
"notebook_enable": false "notebook_enable": false,
"exercise_id": "6feafab76cba4d91a083c1dc0b14a80b"
} }
\ No newline at end of file
{ {
"node_id": "java-20cad95081b4475aaac1c1ebf7af0253", "node_id": "java-20cad95081b4475aaac1c1ebf7af0253",
"keywords": [], "keywords": ["容器", "collection", "方法"],
"children": [], "children": [],
"export": [ "export": [
"Collection.json" "Collection.json"
......
{ {
"type": "code_options", "type": "code_options",
"author": "ccat", "author": "ccat",
"source": "junit.md", "source": "junit.md",
"notebook_enable": false "notebook_enable": false,
"exercise_id": "38a9581c24d9427598c83112d0af0c34"
} }
\ No newline at end of file
{
"type": "code_options",
"author": "ccat",
"source": "group_by.md",
"notebook_enable": true,
"exercise_id": "a2249d4d426c403da4382c62e64f37e5"
}
\ No newline at end of file
...@@ -433,7 +433,10 @@ ...@@ -433,7 +433,10 @@
{ {
"Java集合框架": { "Java集合框架": {
"node_id": "java-af0bf70f564b4ac68a7fadda69d55086", "node_id": "java-af0bf70f564b4ac68a7fadda69d55086",
"keywords": [], "keywords": [
"集合",
"collection"
],
"children": [ "children": [
{ {
"集合接口与实现分离": { "集合接口与实现分离": {
...@@ -561,7 +564,10 @@ ...@@ -561,7 +564,10 @@
{ {
"遗留的集合": { "遗留的集合": {
"node_id": "java-98b609c0de1544bf955cd3e1996224f7", "node_id": "java-98b609c0de1544bf955cd3e1996224f7",
"keywords": [], "keywords": [
"集合",
"legacy"
],
"children": [ "children": [
{ {
"属性映射": { "属性映射": {
...@@ -1037,7 +1043,12 @@ ...@@ -1037,7 +1043,12 @@
{ {
"类和面向对象": { "类和面向对象": {
"node_id": "java-0593e0b9c9f74799a204d697f0db488b", "node_id": "java-0593e0b9c9f74799a204d697f0db488b",
"keywords": [], "keywords": [
"class",
"类",
"面向对象",
"oo"
],
"children": [] "children": []
} }
}, },
...@@ -1085,14 +1096,21 @@ ...@@ -1085,14 +1096,21 @@
{ {
"字节流": { "字节流": {
"node_id": "java-3ea06f6d049d4c079a88747ffd0cc51e", "node_id": "java-3ea06f6d049d4c079a88747ffd0cc51e",
"keywords": [], "keywords": [
"字节流",
"bytestream"
],
"children": [] "children": []
} }
}, },
{ {
"File类": { "File类": {
"node_id": "java-046d129404f14676af135da42fea658b", "node_id": "java-046d129404f14676af135da42fea658b",
"keywords": [], "keywords": [
"文件",
"文件类",
"file"
],
"children": [] "children": []
} }
} }
...@@ -2028,7 +2046,11 @@ ...@@ -2028,7 +2046,11 @@
{ {
"Collection的功能方法": { "Collection的功能方法": {
"node_id": "java-20cad95081b4475aaac1c1ebf7af0253", "node_id": "java-20cad95081b4475aaac1c1ebf7af0253",
"keywords": [], "keywords": [
"容器",
"collection",
"方法"
],
"children": [] "children": []
} }
}, },
......
...@@ -326,26 +326,30 @@ class TreeWalker: ...@@ -326,26 +326,30 @@ class TreeWalker:
def ensure_exercises_meta(self, meta_path, source): def ensure_exercises_meta(self, meta_path, source):
_, mfile = os.path.split(meta_path) _, mfile = os.path.split(meta_path)
meta = None
if os.path.exists(meta_path): if os.path.exists(meta_path):
meta = load_json(meta_path) with open(meta_path) as f:
if "exercise_id" not in meta: content = f.read()
meta["exercise_id"] = uuid.uuid4().hex if content:
if "notebook_enable" not in meta: meta = json.loads(content)
meta["notebook_enable"] = self.default_notebook() if "exercise_id" not in meta:
if "source" not in meta: meta["exercise_id"] = uuid.uuid4().hex
meta["source"] = source if "notebook_enable" not in meta:
if "author" not in meta: meta["notebook_enable"] = self.default_notebook()
meta["author"] = user_name() if "source" not in meta:
if "type" not in meta: meta["source"] = source
meta["type"] = "code_options" if "author" not in meta:
else: meta["author"] = user_name()
meta = { if "type" not in meta:
"type": "code_options", meta["type"] = "code_options"
"author": user_name(), if meta is None:
"source": source, meta = {
"notebook_enable": self.default_notebook(), "type": "code_options",
"exercise_id": uuid.uuid4().hex "author": user_name(),
} "source": source,
"notebook_enable": self.default_notebook(),
"exercise_id": uuid.uuid4().hex
}
dump_json(meta_path, meta, True, True) dump_json(meta_path, meta, True, True)
def default_notebook(self): def default_notebook(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册