From 38eda3edcfbdb66ee34b2498a300a8f7789181fa Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Fri, 6 Jun 2025 10:12:28 +0200 Subject: [PATCH] docs for types added --- docs/source/floatarray.md | 5 +++++ docs/source/generate_class_list.py | 15 +++++++++------ docs/source/ndfloat.md | 5 +++++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 docs/source/floatarray.md create mode 100644 docs/source/ndfloat.md diff --git a/docs/source/floatarray.md b/docs/source/floatarray.md new file mode 100644 index 0000000..98c5e3c --- /dev/null +++ b/docs/source/floatarray.md @@ -0,0 +1,5 @@ +# gaspype.FloatArray + +```{eval-rst} +.. autoclass:: gaspype.FloatArray +``` \ No newline at end of file diff --git a/docs/source/generate_class_list.py b/docs/source/generate_class_list.py index 605b699..41a941f 100644 --- a/docs/source/generate_class_list.py +++ b/docs/source/generate_class_list.py @@ -6,8 +6,12 @@ import fnmatch from io import TextIOWrapper -def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title: str, description: str = '', exclude: list[str] = []) -> None: +def write_manual(f: TextIOWrapper, doc_files: list[str], title: str) -> None: + write_dochtree(f, title, doc_files) + +def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title: str, description: str = '', exclude: list[str] = []) -> None: + """Write the classes to the file.""" module = importlib.import_module(module_name) classes = [ @@ -17,7 +21,6 @@ def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title obj.__doc__ and '(Automatic generated stub)' not in obj.__doc__) ] - """Write the classes to the file.""" if description: f.write(f'{description}\n\n') @@ -36,7 +39,7 @@ def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title def write_functions(f: TextIOWrapper, patterns: list[str], module_name: str, title: str, description: str = '', exclude: list[str] = []) -> None: - + """Write the classes to the file.""" module = importlib.import_module(module_name) functions = [ @@ -45,7 +48,6 @@ def write_functions(f: TextIOWrapper, patterns: list[str], module_name: str, tit any(fnmatch.fnmatch(name, pat) for pat in patterns if pat not in exclude)) ] - """Write the classes to the file.""" if description: f.write(f'{description}\n\n') @@ -74,8 +76,9 @@ def write_dochtree(f: TextIOWrapper, title: str, items: list[str]): if __name__ == "__main__": with open('docs/source/_autogenerated/index.md', 'w') as f: f.write('# Classes and functions\n\n') - #f.write('## Classes\n\n') + write_classes(f, ['*'], 'gaspype', title='Classes') - #f.write('## Functions\n\n') write_functions(f, ['*'], 'gaspype', title='Functions') + + write_manual(f, ['../ndfloat', '../floatarray'], title='Types') diff --git a/docs/source/ndfloat.md b/docs/source/ndfloat.md new file mode 100644 index 0000000..1ac7868 --- /dev/null +++ b/docs/source/ndfloat.md @@ -0,0 +1,5 @@ +# gaspype.NDFloat + +```{eval-rst} +.. autoclass:: gaspype.NDFloat +``` \ No newline at end of file