From 8550b94e6cdca6c030e0fdf3333ea873e2ce2956 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 14 Dec 2023 18:15:01 +1100 Subject: [PATCH 1/3] more documentation examples --- docs/numpydoc_example.py | 34 ++++++++++++++++++++++++++++-- mdanalysis_sphinx_theme/authors.py | 10 +++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 mdanalysis_sphinx_theme/authors.py diff --git a/docs/numpydoc_example.py b/docs/numpydoc_example.py index 63cdf7c..9b8aebd 100644 --- a/docs/numpydoc_example.py +++ b/docs/numpydoc_example.py @@ -9,8 +9,6 @@ a line by itself, preferably preceded by a blank line. """ -from __future__ import absolute_import, division, print_function - import os # standard library imports first import matplotlib as mpl @@ -128,3 +126,35 @@ def foo(var1, var2, *args, long_var_name="hi", **kwargs): # But for function, method and module, there should be no blank lines # after closing the docstring. pass + + +class TestClassDocumentation: + """ + This is an example docstring of a class. + + Unordered list: + + * item 1 + * item 2 + * sub-item 3 + + .. note:: + This is a note inside a class docstring. + + Parameters + ---------- + filename : str + The name of the file to be read. + + """ + + def __init__(self, filename: str): + """Initialize the class. + + Parameters + ---------- + filename : str + The name of the file to be read. + + """ + self.filename = filename \ No newline at end of file diff --git a/mdanalysis_sphinx_theme/authors.py b/mdanalysis_sphinx_theme/authors.py new file mode 100644 index 0000000..cfe675e --- /dev/null +++ b/mdanalysis_sphinx_theme/authors.py @@ -0,0 +1,10 @@ +#-*- coding:utf-8 -*- + +# This file is generated from the AUTHORS file during the installation process. +# Do not edit it as your changes will be overwritten. + +__authors__ = [ + u"Lily Wang", + u"Irfan Alibay", + u"Ian Kenney", +] From 81fbc6a1846ca45a076128b58ae28cfc7bea5d31 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 14 Dec 2023 18:17:58 +1100 Subject: [PATCH 2/3] add space --- docs/numpydoc_example.py | 4 ++-- mdanalysis_sphinx_theme/authors.py | 10 ---------- setup.py | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 mdanalysis_sphinx_theme/authors.py diff --git a/docs/numpydoc_example.py b/docs/numpydoc_example.py index 9b8aebd..caa0d29 100644 --- a/docs/numpydoc_example.py +++ b/docs/numpydoc_example.py @@ -131,7 +131,7 @@ def foo(var1, var2, *args, long_var_name="hi", **kwargs): class TestClassDocumentation: """ This is an example docstring of a class. - + Unordered list: * item 1 @@ -157,4 +157,4 @@ def __init__(self, filename: str): The name of the file to be read. """ - self.filename = filename \ No newline at end of file + self.filename = filename diff --git a/mdanalysis_sphinx_theme/authors.py b/mdanalysis_sphinx_theme/authors.py deleted file mode 100644 index cfe675e..0000000 --- a/mdanalysis_sphinx_theme/authors.py +++ /dev/null @@ -1,10 +0,0 @@ -#-*- coding:utf-8 -*- - -# This file is generated from the AUTHORS file during the installation process. -# Do not edit it as your changes will be overwritten. - -__authors__ = [ - u"Lily Wang", - u"Irfan Alibay", - u"Ian Kenney", -] diff --git a/setup.py b/setup.py index 8f60a82..c3664b3 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ def dynamic_author_list(): out_path = current_dir / "mdanalysis_sphinx_theme" / "authors.py" author_lines = "\n".join([f' u"{name}",' for name in authors]) template = f"""\ -#-*- coding:utf-8 -*- +# -*- coding:utf-8 -*- # This file is generated from the AUTHORS file during the installation process. # Do not edit it as your changes will be overwritten. From e638c6cd10e593eea27d54c8aba73658ae0e77aa Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 14 Dec 2023 18:48:49 +1100 Subject: [PATCH 3/3] multiline item --- docs/numpydoc_example.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/numpydoc_example.py b/docs/numpydoc_example.py index caa0d29..6d16ce4 100644 --- a/docs/numpydoc_example.py +++ b/docs/numpydoc_example.py @@ -128,13 +128,15 @@ def foo(var1, var2, *args, long_var_name="hi", **kwargs): pass + class TestClassDocumentation: """ This is an example docstring of a class. Unordered list: - * item 1 + * multi-line + item 1 * item 2 * sub-item 3