diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:32:47 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 07:32:47 +0000 |
commit | a1ecb84f48f890a1d107037a36730635890c7839 (patch) | |
tree | 8c0cca130a70c44efd4dd485d854a598f6bb937b | |
parent | c121529b34566f9a99f216544e9c038baa16af56 (diff) |
automatic import of python-sphinx-autodoc-defaultargs
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-sphinx-autodoc-defaultargs.spec | 364 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 366 insertions, 0 deletions
@@ -0,0 +1 @@ +/sphinx-autodoc-defaultargs-0.1.2.tar.gz diff --git a/python-sphinx-autodoc-defaultargs.spec b/python-sphinx-autodoc-defaultargs.spec new file mode 100644 index 0000000..e713147 --- /dev/null +++ b/python-sphinx-autodoc-defaultargs.spec @@ -0,0 +1,364 @@ +%global _empty_manifest_terminate_build 0 +Name: python-sphinx-autodoc-defaultargs +Version: 0.1.2 +Release: 1 +Summary: Automatic generation of default arguments for the Sphinx autodoc extension. +License: MIT +URL: https://pypi.org/project/sphinx-autodoc-defaultargs/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/1a/7c/8edb5d817ebeb146073be629ed58f89b292a643ee111bee3c703be05a7a1/sphinx-autodoc-defaultargs-0.1.2.tar.gz +BuildArch: noarch + +Requires: python3-Sphinx +Requires: python3-pytest +Requires: python3-typing-extensions +Requires: python3-sphobjinv +Requires: python3-Sphinx +Requires: python3-dataclasses +Requires: python3-typed-ast + +%description +# sphinx-autodoc-defaultargs + +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/actions/workflows/python-package.yml) +[](https://coveralls.io/github/zwang123/sphinx-autodoc-defaultargs?branch=main) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/blob/main/LICENSE) +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) + +## Overview + +This extension automatically generates default arguments for the Sphinx autodoc extension. + +## Example + +With this package, the default values of all documented arguments, and undocumented arguments if enabled, +are automatically detected and added to the docstring. + +It also detects existing documentation of default arguments with the text unchanged. + +```python +def func(x=None, y=None): + """ + Example docstring. + + :param x: The default value ``None`` will be added here. + :param y: The text of default value is unchanged. + (Default: ``'Default Value'``) + """ + + if y is None: + y = 'Default Value' + + ... +``` + +## Installation + +### pip + +If you use `pip`, you can install the package with: + +```bash +python -m pip install sphinx_autodoc_defaultargs +``` + +### setup.py + +In the root directory, run the following command in the terminal. + +```bash +python setup.py install +``` + +## Usage + +Add the extension as well as the global substitution to the `conf.py` file: + +```python +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx_autodoc_defaultargs' +] + +rst_prolog = """ +.. |default| raw:: html + + <div class="default-value-section">""" + \ + ' <span class="default-value-label">Default:</span>' +``` + +Note that it should be loaded after [sphinx.ext.napoleon](http://www.sphinx-doc.org/en/stable/ext/napoleon.html). + +## Config Options + +* `always_document_default_args` (default: `False`): +If False, do not add info of default arguments for undocumented parameters. +If True, add stub documentation for undocumented parameters +to be able to add default value and to flag `optional` in the type. + +* `docstring_default_arg_flags` (default: `[('(Default: ', ')')]`): +List of pairs indicating the header and the footer of an existing documentation of default values, +which is expected at the end of the `param` section. +If detected, it will be replaced by the unified style but the text should remain unchanged. + +* `docstring_default_arg_after_directives` (default: `False`): +If True, the default value will be added after all +[directives](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html) +(e.g., note, warning). +Existing documentation of the default value is also expected after these directives. +Otherwise, it will be added, and expected to exist, before these directives. + +* `docstring_default_arg_substitution` (default: `'|default|'`): +The substitution markup defined in the `conf.py` file. + + + + +%package -n python3-sphinx-autodoc-defaultargs +Summary: Automatic generation of default arguments for the Sphinx autodoc extension. +Provides: python-sphinx-autodoc-defaultargs +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-sphinx-autodoc-defaultargs +# sphinx-autodoc-defaultargs + +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/actions/workflows/python-package.yml) +[](https://coveralls.io/github/zwang123/sphinx-autodoc-defaultargs?branch=main) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/blob/main/LICENSE) +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) + +## Overview + +This extension automatically generates default arguments for the Sphinx autodoc extension. + +## Example + +With this package, the default values of all documented arguments, and undocumented arguments if enabled, +are automatically detected and added to the docstring. + +It also detects existing documentation of default arguments with the text unchanged. + +```python +def func(x=None, y=None): + """ + Example docstring. + + :param x: The default value ``None`` will be added here. + :param y: The text of default value is unchanged. + (Default: ``'Default Value'``) + """ + + if y is None: + y = 'Default Value' + + ... +``` + +## Installation + +### pip + +If you use `pip`, you can install the package with: + +```bash +python -m pip install sphinx_autodoc_defaultargs +``` + +### setup.py + +In the root directory, run the following command in the terminal. + +```bash +python setup.py install +``` + +## Usage + +Add the extension as well as the global substitution to the `conf.py` file: + +```python +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx_autodoc_defaultargs' +] + +rst_prolog = """ +.. |default| raw:: html + + <div class="default-value-section">""" + \ + ' <span class="default-value-label">Default:</span>' +``` + +Note that it should be loaded after [sphinx.ext.napoleon](http://www.sphinx-doc.org/en/stable/ext/napoleon.html). + +## Config Options + +* `always_document_default_args` (default: `False`): +If False, do not add info of default arguments for undocumented parameters. +If True, add stub documentation for undocumented parameters +to be able to add default value and to flag `optional` in the type. + +* `docstring_default_arg_flags` (default: `[('(Default: ', ')')]`): +List of pairs indicating the header and the footer of an existing documentation of default values, +which is expected at the end of the `param` section. +If detected, it will be replaced by the unified style but the text should remain unchanged. + +* `docstring_default_arg_after_directives` (default: `False`): +If True, the default value will be added after all +[directives](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html) +(e.g., note, warning). +Existing documentation of the default value is also expected after these directives. +Otherwise, it will be added, and expected to exist, before these directives. + +* `docstring_default_arg_substitution` (default: `'|default|'`): +The substitution markup defined in the `conf.py` file. + + + + +%package help +Summary: Development documents and examples for sphinx-autodoc-defaultargs +Provides: python3-sphinx-autodoc-defaultargs-doc +%description help +# sphinx-autodoc-defaultargs + +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/actions/workflows/python-package.yml) +[](https://coveralls.io/github/zwang123/sphinx-autodoc-defaultargs?branch=main) +[](https://github.com/zwang123/sphinx-autodoc-defaultargs/blob/main/LICENSE) +[](https://pypi.org/project/sphinx-autodoc-defaultargs/) + +## Overview + +This extension automatically generates default arguments for the Sphinx autodoc extension. + +## Example + +With this package, the default values of all documented arguments, and undocumented arguments if enabled, +are automatically detected and added to the docstring. + +It also detects existing documentation of default arguments with the text unchanged. + +```python +def func(x=None, y=None): + """ + Example docstring. + + :param x: The default value ``None`` will be added here. + :param y: The text of default value is unchanged. + (Default: ``'Default Value'``) + """ + + if y is None: + y = 'Default Value' + + ... +``` + +## Installation + +### pip + +If you use `pip`, you can install the package with: + +```bash +python -m pip install sphinx_autodoc_defaultargs +``` + +### setup.py + +In the root directory, run the following command in the terminal. + +```bash +python setup.py install +``` + +## Usage + +Add the extension as well as the global substitution to the `conf.py` file: + +```python +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx_autodoc_defaultargs' +] + +rst_prolog = """ +.. |default| raw:: html + + <div class="default-value-section">""" + \ + ' <span class="default-value-label">Default:</span>' +``` + +Note that it should be loaded after [sphinx.ext.napoleon](http://www.sphinx-doc.org/en/stable/ext/napoleon.html). + +## Config Options + +* `always_document_default_args` (default: `False`): +If False, do not add info of default arguments for undocumented parameters. +If True, add stub documentation for undocumented parameters +to be able to add default value and to flag `optional` in the type. + +* `docstring_default_arg_flags` (default: `[('(Default: ', ')')]`): +List of pairs indicating the header and the footer of an existing documentation of default values, +which is expected at the end of the `param` section. +If detected, it will be replaced by the unified style but the text should remain unchanged. + +* `docstring_default_arg_after_directives` (default: `False`): +If True, the default value will be added after all +[directives](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html) +(e.g., note, warning). +Existing documentation of the default value is also expected after these directives. +Otherwise, it will be added, and expected to exist, before these directives. + +* `docstring_default_arg_substitution` (default: `'|default|'`): +The substitution markup defined in the `conf.py` file. + + + + +%prep +%autosetup -n sphinx-autodoc-defaultargs-0.1.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-sphinx-autodoc-defaultargs -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.2-1 +- Package Spec generated @@ -0,0 +1 @@ +5d7a7652961fb51e5e4bd632e5cc3940 sphinx-autodoc-defaultargs-0.1.2.tar.gz |