Skip to content

Commit

Permalink
Use idiomatic exist_ok
Browse files Browse the repository at this point in the history
  • Loading branch information
mmore500 committed Dec 7, 2023
1 parent d366721 commit 3f156a9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions doc/make_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def format_heading(level, text):
new_dir = "library/" + just_dir + "/api"
print(new_dir)
toc_text = "<!-- API TOC -->\n<!-- The above comment tells the API generator that this file has API docs. Don't remove it. -->\n" + format_heading(2, "API") + "```{eval-rst}\n.. toctree::\n :glob:\n\n api/*\n```\n"
if not os.path.exists(new_dir):
os.makedirs(new_dir)
os.makedirs(new_dir, exist_ok=True)
toc_file_name = f"library/{just_dir}/{last_dir}.md"
if not os.path.exists(toc_file_name):
toc_text = format_heading(1, last_dir.capitalize()) + toc_text
Expand Down

0 comments on commit 3f156a9

Please sign in to comment.