MCPcopy
hub / github.com/MisterBooo/LeetCodeAnimation / create_solution

Function create_solution

tools/anima/create.py:7–21  ·  view source on GitHub ↗
(problem_id: int, problem_title: str)

Source from the content-addressed store, hash-verified

5
6
7def create_solution(problem_id: int, problem_title: str) -> None:
8 problem = ProblemInfo(problem_id, problem_title)
9 solution_dir = get_project_path() / problem.title_slug()
10
11 if solution_dir.exists():
12 print(f'创建失败,文件夹 {solution_dir} 已存在')
13 exit(1)
14 solution_dir.mkdir()
15
16 solution = Solution.create(problem, solution_dir)
17
18 template = get_md_template_path()
19 shutil.copy(template, solution.doc_path())
20
21 print(f'题解框架创建完毕,位于文件夹 {solution.path}')
22

Callers 1

newMethod · 0.90

Calls 6

title_slugMethod · 0.95
ProblemInfoClass · 0.90
get_project_pathFunction · 0.90
get_md_template_pathFunction · 0.90
createMethod · 0.80
doc_pathMethod · 0.80

Tested by

no test coverage detected