File: gen_ref_pages.py

package info (click to toggle)
python-sparse 0.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,816 kB
  • sloc: python: 11,223; sh: 54; javascript: 10; makefile: 8
file content (20 lines) | stat: -rw-r--r-- 583 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Generate the code reference pages."""

from pathlib import Path

import sparse

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()

root = Path(__file__).parent.parent

for item in dir(sparse):
    if item.startswith("_") or not getattr(getattr(sparse, item), "__module__", "").startswith("sparse"):
        continue
    full_doc_path = Path("api/" + item + ".md")
    with mkdocs_gen_files.open(Path("api", f"{item}.md"), "w") as fd:
        print(f"# {item}", file=fd)
        print("::: " + f"sparse.{item}", file=fd)
    mkdocs_gen_files.set_edit_path(full_doc_path, root)