Skip to content

Commit

Permalink
style(scripts): lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
boromir674 committed Nov 15, 2023
1 parent 6755b57 commit 8d85882
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions scripts/gen_api_refs_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,30 @@

nav = mkdocs_gen_files.Nav()

src = Path(__file__).parent.parent / "src"
src = Path(__file__).parent.parent / "src"

for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
doc_path = path.relative_to(src).with_suffix(".md")
full_doc_path = Path("reference", doc_path)
for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
doc_path = path.relative_to(src).with_suffix(".md")
full_doc_path = Path("reference", doc_path)

parts = list(module_path.parts)

if parts[-1] == "__init__":
if parts[-1] == "__init__":
parts = parts[:-1]
## https://mkdocstrings.github.io/recipes/#bind-pages-to-sections-themselves
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
##
elif parts[-1] == "__main__":
continue

# Progressively build the navigation object
nav[parts] = doc_path.as_posix()

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
identifier = ".".join(parts)
print("::: " + identifier, file=fd)

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
identifier = ".".join(parts)
print("::: " + identifier, file=fd)

# ROOT
# -> docs
Expand All @@ -41,7 +40,6 @@
# <repo_url>/blob/master/src/artificial_artwork/nst_math.py instead of
# <repo_url>/blob/master/docs/src/artificial_artwork/nst_math.py


# mkdocs_gen_files.set_edit_path(full_doc_path, path)


Expand Down

0 comments on commit 8d85882

Please sign in to comment.