From 576c0227f5b4d0a496e00675b1c3f098f1b2b328 Mon Sep 17 00:00:00 2001 From: CodyCBakerPhD Date: Tue, 13 Aug 2024 12:30:20 -0400 Subject: [PATCH] mirror API docs --- docs/api/nwbinspector.rst | 2 +- docs/api/register_check.rst | 4 +++- docs/api/tools.rst | 9 +++++--- docs/conf.py | 38 ++++++++++++++++++++++++++++++-- docs/gen_checks_by_importance.py | 35 ----------------------------- 5 files changed, 46 insertions(+), 42 deletions(-) delete mode 100644 docs/gen_checks_by_importance.py diff --git a/docs/api/nwbinspector.rst b/docs/api/nwbinspector.rst index 1fb49417c..d1d5bfad8 100644 --- a/docs/api/nwbinspector.rst +++ b/docs/api/nwbinspector.rst @@ -1,4 +1,4 @@ Core Library ============ -.. automodule:: nwbinspector.nwbinspector +.. automodule:: nwbinspector._nwbinspector diff --git a/docs/api/register_check.rst b/docs/api/register_check.rst index ca3fa6271..213f503fa 100644 --- a/docs/api/register_check.rst +++ b/docs/api/register_check.rst @@ -3,4 +3,6 @@ Data Classes and Check Registration All common data class used across the package, as well as the decorator for adding a check function to the registry. -.. automodule:: nwbinspector.register_checks +.. automodule:: nwbinspector._types + +.. automodule:: nwbinspector._registration diff --git a/docs/api/tools.rst b/docs/api/tools.rst index 48028764e..60384deb3 100644 --- a/docs/api/tools.rst +++ b/docs/api/tools.rst @@ -1,5 +1,5 @@ -Tools for Organizating and Displaying Reports -============================================= +Tools for Organizing and Displaying Reports +=========================================== .. automodule:: nwbinspector :members: @@ -9,5 +9,8 @@ Tools for Organizating and Displaying Reports .. toctree:: :maxdepth: 4 -.. automodule:: nwbinspector.inspector_tools +.. automodule:: nwbinspector._organization + :noindex: + +.. automodule:: nwbinspector._formatting :noindex: diff --git a/docs/conf.py b/docs/conf.py index f1605ca2d..998c66e8d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,12 @@ +import os import sys from pathlib import Path +from nwbinspector import available_checks +from collections import defaultdict + sys.path.append(str(Path(__file__).parent)) from conf_extlinks import extlinks, intersphinx_mapping -from gen_checks_by_importance import gen_checks_by_importance sys.path.insert(0, Path(__file__).resolve().parents[1]) @@ -73,4 +76,35 @@ def setup(app): app.connect("autodoc-process-docstring", add_refs_to_docstrings) -gen_checks_by_importance() +def _gen_checks_by_importance(): + dd = defaultdict(list) + + for x in available_checks: + dd[x.importance.name.replace("_", " ")].append(x) + + generate_checks_rst_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks_by_importance.rst") + with open(generate_checks_rst_file, "w") as f: + f.write( + """Checks by Importance +====================== + +This section lists the available checks organized by their importance level. + +""" + ) + + for importance_level, checks in dd.items(): + f.write( + f"""{importance_level} +{'-' * (len(f'{importance_level}') + 1)} + +""" + ) + + for check in checks: + f.write(f"* :py:func:`~{check.__module__}.{check.__name__}`\n") + + f.write("\n") + + +_gen_checks_by_importance() diff --git a/docs/gen_checks_by_importance.py b/docs/gen_checks_by_importance.py deleted file mode 100644 index d65614999..000000000 --- a/docs/gen_checks_by_importance.py +++ /dev/null @@ -1,35 +0,0 @@ -import os -from nwbinspector import available_checks - -from collections import defaultdict - - -def gen_checks_by_importance(): - dd = defaultdict(list) - - for x in available_checks: - dd[x.importance.name.replace("_", " ")].append(x) - - generate_checks_rst_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "checks_by_importance.rst") - with open(generate_checks_rst_file, "w") as f: - f.write( - """Checks by Importance -====================== - -This section lists the available checks organized by their importance level. - -""" - ) - - for importance_level, checks in dd.items(): - f.write( - f"""{importance_level} -{'-' * (len(f'{importance_level}') + 1)} - -""" - ) - - for check in checks: - f.write(f"* :py:func:`~{check.__module__}.{check.__name__}`\n") - - f.write("\n")