docs for types added

This commit is contained in:
Nicolas Kruse 2025-06-06 10:12:28 +02:00
parent 9fc5ea2dc1
commit 38eda3edcf
3 changed files with 19 additions and 6 deletions

View File

@ -0,0 +1,5 @@
# gaspype.FloatArray
```{eval-rst}
.. autoclass:: gaspype.FloatArray
```

View File

@ -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')

5
docs/source/ndfloat.md Normal file
View File

@ -0,0 +1,5 @@
# gaspype.NDFloat
```{eval-rst}
.. autoclass:: gaspype.NDFloat
```