diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-06 17:49:40 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-03-06 17:49:40 +0000 |
| commit | 10fabb58010d80f10ffe5de58faf8eea90c223b9 (patch) | |
| tree | a4630cd6cc17437949827062a2b9639640bbbf73 /docs/generate_autodocs.py | |
| parent | Merge branch 'travis_releases' (diff) | |
| parent | Documentation improvements (diff) | |
| download | pygensvm-10fabb58010d80f10ffe5de58faf8eea90c223b9.tar.gz pygensvm-10fabb58010d80f10ffe5de58faf8eea90c223b9.zip | |
Merge branch 'docs'
Diffstat (limited to 'docs/generate_autodocs.py')
| -rw-r--r-- | docs/generate_autodocs.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/docs/generate_autodocs.py b/docs/generate_autodocs.py index a0544ef..a2f7e49 100644 --- a/docs/generate_autodocs.py +++ b/docs/generate_autodocs.py @@ -42,11 +42,11 @@ FULL_NAMES = { } OUTPUT_FILES = { - "GenSVMGridSearchCV": os.path.join(DOCDIR, "cls_gridsearch.txt"), - "GenSVM": os.path.join(DOCDIR, "cls_gensvm.txt"), - "load_grid_tiny": os.path.join(DOCDIR, "auto_functions.txt"), - "load_grid_small": os.path.join(DOCDIR, "auto_functions.txt"), - "load_grid_full": os.path.join(DOCDIR, "auto_functions.txt"), + "GenSVMGridSearchCV": os.path.join(DOCDIR, "cls_gridsearch.rst"), + "GenSVM": os.path.join(DOCDIR, "cls_gensvm.rst"), + "load_grid_tiny": os.path.join(DOCDIR, "auto_functions.rst"), + "load_grid_small": os.path.join(DOCDIR, "auto_functions.rst"), + "load_grid_full": os.path.join(DOCDIR, "auto_functions.rst"), } @@ -83,11 +83,13 @@ def generate_class_autodoc(app, cls): documenter.generate(all_members=True) with open(OUTPUT_FILES[cls], "w") as fid: + fid.write(cls + '\n') + fid.write(''.join(['=']*len(cls)) + '\n') for line in ad.result: fid.write(line + "\n") -def generate_func_autodoc(app, func): +def generate_func_autodoc(app, func, add_title=True): ad = AutoDirective( name="autofunc", arguments=[FULL_NAMES[func]], @@ -108,7 +110,11 @@ def generate_func_autodoc(app, func): documenter = FunctionDocumenter(ad, ad.arguments[0]) documenter.generate(all_members=True) + title = 'Parameter Grids' with open(OUTPUT_FILES[func], "a") as fid: + if add_title: + fid.write(title + '\n') + fid.write(''.join(['=']*len(title)) + '\n') for line in ad.result: fid.write(line + "\n") @@ -121,8 +127,10 @@ def main(): app = load_app() for cls in CLASSES: generate_class_autodoc(app, cls) + add_title = True for func in FUNCTIONS: - generate_func_autodoc(app, func) + generate_func_autodoc(app, func, add_title=add_title) + add_title = False if __name__ == "__main__": |
