提交 a989f68b 编写于 作者: F feilong

添加网络爬虫题目

上级 fc23aaab
......@@ -3,5 +3,6 @@
"author": "huanhuilong",
"source": "helloworld.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "class.md",
"depends": [],
"exercise_id": 26,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "function.md",
"depends": [],
"exercise_id": 28,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "process.md",
"depends": [],
"exercise_id": 27,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "install.md",
"depends": [],
"exercise_id": 31,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "run.md",
"depends": [],
"exercise_id": 32,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "ide.md",
"depends": [],
"exercise_id": 30,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "style.md",
"depends": [],
"exercise_id": 29,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "import_lib.md",
"depends": [],
"exercise_id": 163,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "import_other_module.md",
"depends": [],
"exercise_id": 164,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "import_relative.md",
"depends": [],
"exercise_id": 165,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "step.md",
"depends": [],
"exercise_id": 83,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "call.md",
"depends": [],
"exercise_id": 197,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "fact1.md",
"depends": [],
"exercise_id": 190,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "fact2.md",
"depends": [],
"exercise_id": 244,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "fibonacci1.md",
"depends": [],
"exercise_id": 201,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "fibonacci2.md",
"depends": [],
"exercise_id": 239,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "helloworld2.md",
"depends": [],
"exercise_id": 166,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -5,5 +5,6 @@
"key_value_set.py"
],
"exercise_id": 169,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -5,5 +5,6 @@
"key_value_set.py"
],
"exercise_id": 168,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "key_value_set.md",
"depends": [],
"exercise_id": 167,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"source": "calc.py",
"depends": [],
"exercise_id": 76,
"type": "code_options"
"type": "code_options",
"notebook_enable": true,
"author": "feilong"
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
"author": "HansBug",
"source": "iter.md",
"depends": [],
"exercise_id": 190,
"type": "code_options"
"exercise_id": "4ded2d6929124ddd90f409a72eb073cc",
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"author": "zxm2015",
"source": "dynamic_page.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"exercise_id": "d723ad753e0f4367932a9436f8732ec8",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"author": "zxm2015",
"source": "simulate_login.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"exercise_id": "b909e9d8af9c44498ffc0519d7b8be62",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"author": "zxm2015",
"source": "selenium.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"exercise_id": "fa67f7b6cfb94d4aa5048c0748220313",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"author": "zxm2015",
"source": "pyspider.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"exercise_id": "2a356f5e71174f599bfea527cd062057",
"notebook_enable": true
}
\ No newline at end of file
......@@ -2,5 +2,7 @@
"author": "zxm2015",
"source": "verification_code.md",
"depends": [],
"type": "code_options"
"type": "code_options",
"exercise_id": "9ae36338010949038ac029a0396b9d10",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "loc.md",
"depends": [],
"exercise_id": 121,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -3,5 +3,6 @@
"source": "stat.md",
"depends": [],
"exercise_id": 125,
"type": "code_options"
"type": "code_options",
"notebook_enable": true
}
\ No newline at end of file
......@@ -16,9 +16,11 @@ handler.setFormatter(formatter)
logger.addHandler(handler)
repo = git.Repo(".")
def user_name():
return repo.config_reader().get_value("user", "name")
def load_json(p):
with open(p, 'r') as f:
return json.loads(f.read())
......@@ -100,11 +102,13 @@ class TreeWalker:
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 + 1}.{section_title}")
full_path = os.path.join(
chapter_path, f"{index + 1}.{section_title}")
if os.path.isdir(full_path):
self.check_section_keywords(full_path)
self.ensure_exercises(full_path)
......@@ -322,7 +326,8 @@ class TreeWalker:
config["export"] = export
if flag:
dump_json(os.path.join(section_path, "config.json"), config, True, True)
dump_json(os.path.join(section_path, "config.json"),
config, True, True)
for e in config.get("export", []):
full_name = os.path.join(section_path, e)
......@@ -370,6 +375,6 @@ class TreeWalker:
def check_section_keywords(self, full_path):
config = self.ensure_section_config(full_path)
if not config.get("keywords", []):
self.logger.error(f"节点 [{full_path}] 的关键字为空,请修改配置文件写入关键字")
sys.exit(1)
# if not config.get("keywords", []):
# self.logger.error(f"节点 [{full_path}] 的关键字为空,请修改配置文件写入关键字")
# sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册