==> Building on magmar ==> Checking for remote environment... ==> Syncing package to remote host... sending incremental file list created directory packages/pdoc ./ .SRCINFO 1,013 100% 0.00kB/s 0:00:00 1,013 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=7/9) .nvchecker.toml 78 100% 76.17kB/s 0:00:00 78 100% 76.17kB/s 0:00:00 (xfr#2, to-chk=6/9) LICENSE 646 100% 630.86kB/s 0:00:00 646 100% 630.86kB/s 0:00:00 (xfr#3, to-chk=5/9) PKGBUILD 1,434 100% 1.37MB/s 0:00:00 1,434 100% 1.37MB/s 0:00:00 (xfr#4, to-chk=4/9) REUSE.toml 375 100% 366.21kB/s 0:00:00 375 100% 366.21kB/s 0:00:00 (xfr#5, to-chk=3/9) pdoc-16.0.0-2.log 725 100% 708.01kB/s 0:00:00 725 100% 708.01kB/s 0:00:00 (xfr#6, to-chk=2/9) LICENSES/ LICENSES/0BSD.txt -> ../LICENSE sent 2,827 bytes received 180 bytes 2,004.67 bytes/sec total size is 3,749 speedup is 1.25 ==> Running pkgctl build --arch riscv64 on remote host... ==> WARNING: invalid architecture: riscv64 ==> Updating pacman database cache [?25l:: Synchronizing package databases... core downloading... extra downloading... multilib downloading... [?25h==> Building pdoc -> repo: extra -> arch: riscv64 -> worker: felix-0 ==> Building pdoc for [extra] (riscv64) Note: in a future version of systemd-nspawn the default set of permitted socket address families will be restricted to AF_INET, AF_INET6 and AF_UNIX. Use --restrict-address-families= to configure the set of permitted socket address families, or set RestrictAddressFamilies= in a .nspawn file. [?25l:: Synchronizing package databases... core downloading... extra downloading... :: Starting full system upgrade... there is nothing to do [?25h==> Building in chroot for [extra] (riscv64)... ==> Synchronizing chroot copy [/var/lib/archbuild/extra-riscv64/root] -> [felix-0]...done ==> Making package: pdoc 16.0.0-2 (Mon Aug 31 09:09:04 2026) ==> Retrieving sources...  -> Downloading pdoc-16.0.0.tar.gz... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 685.8k 0 685.8k 0 0 482.6k 0 00:01 0 100 685.8k 0 685.8k 0 0 482.6k 0 00:01 0 100 685.8k 0 685.8k 0 0 482.5k 0 00:01 0 ==> Validating source files with sha512sums... pdoc-16.0.0.tar.gz ... Passed ==> Validating source files with b2sums... pdoc-16.0.0.tar.gz ... Passed Note: in a future version of systemd-nspawn the default set of permitted socket address families will be restricted to AF_INET, AF_INET6 and AF_UNIX. Use --restrict-address-families= to configure the set of permitted socket address families, or set RestrictAddressFamilies= in a .nspawn file. ==> Making package: pdoc 16.0.0-2 (Mon Aug 31 09:09:15 2026) ==> Checking runtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (4) New Version Net Change Download Size extra/python-jinja 1:3.1.6-3.1 2.04 MiB extra/python-markdown2 2.5.5-1 0.66 MiB 0.12 MiB extra/python-markupsafe 3.0.3-1 0.09 MiB extra/python-pygments 2.20.0-1 15.36 MiB Total Download Size: 0.12 MiB Total Installed Size: 18.15 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... python-markdown2-2.5.5-1-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing python-markupsafe... installing python-jinja... Optional dependencies for python-jinja python-babel: for i18n support installing python-pygments... installing python-markdown2... Optional dependencies for python-markdown2 python-latex2mathml: latex support python-wavedrom: wavedrom support :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... [?25h==> Checking buildtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (27) New Version Net Change Download Size extra/python-annotated-types 0.8.0-1 0.12 MiB extra/python-attrs 26.1.0-1 0.63 MiB extra/python-autocommand 2.2.2-9 0.08 MiB extra/python-iniconfig 2.3.0-1 0.07 MiB extra/python-jaraco.collections 5.1.0-3 0.11 MiB extra/python-jaraco.context 6.1.2-1 0.06 MiB extra/python-jaraco.functools 4.1.0-3 0.07 MiB extra/python-jaraco.text 4.0.0-4 0.08 MiB extra/python-more-itertools 11.1.0-1 0.77 MiB extra/python-packaging 26.3-1 1.58 MiB extra/python-pkg_resources 81.0.0-1 0.50 MiB extra/python-platformdirs 4.11.5-1 0.47 MiB extra/python-pluggy 1.6.0-3.1 0.23 MiB extra/python-pydantic-core 3:2.46.4-1 5.35 MiB extra/python-pyproject-hooks 1.2.0-6 0.11 MiB extra/python-sortedcontainers 2.4.0-8 0.38 MiB extra/python-typing-inspection 0.4.4-1 0.13 MiB extra/python-typing_extensions 4.16.0-1 0.53 MiB extra/python-build 1.4.3-1 0.26 MiB extra/python-hypothesis 6.165.10-1 6.47 MiB 1.24 MiB extra/python-installer 1.0.1-1 0.21 MiB 0.05 MiB extra/python-pdoc-pyo3-sample-library 1.0.11-2 0.40 MiB 0.18 MiB extra/python-pydantic 2.13.4-1 6.04 MiB extra/python-pytest 1:9.0.3-1 4.86 MiB extra/python-pytest-timeout 2.5.0-1 0.09 MiB extra/python-setuptools 1:82.0.1-1 7.35 MiB extra/python-wheel 0.48.0-1 0.34 MiB Total Download Size: 1.46 MiB Total Installed Size: 37.28 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... python-hypothesis-6.165.10-1-riscv64 downloading... python-pdoc-pyo3-sample-library-1.0.11-2-riscv64 downloading... python-installer-1.0.1-1-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing python-packaging... installing python-pyproject-hooks... installing python-build... Optional dependencies for python-build python-pip: to use as the Python package installer (default) python-uv: to use as the Python package installer python-virtualenv: to use virtualenv for build isolation installing python-installer... installing python-more-itertools... installing python-jaraco.functools... installing python-jaraco.context... installing python-autocommand... installing python-jaraco.text... Optional dependencies for python-jaraco.text python-inflect: for show-newlines script installing python-jaraco.collections... installing python-platformdirs... installing python-wheel... Optional dependencies for python-wheel python-keyring: for wheel.signatures python-xdg: for wheel.signatures python-setuptools: for legacy bdist_wheel subcommand [pending] installing python-typing_extensions... installing python-pkg_resources... installing python-setuptools... installing python-attrs... installing python-sortedcontainers... installing python-hypothesis... Optional dependencies for python-hypothesis python-black: for CLI and ghostwriter python-click: for CLI python-dateutil: for date support python-django: for django module python-dpcontracts: for contracts support python-faker: for fakefactory and django module python-lark-parser: for lark module python-libcst: for codemods module python-numpy: for numpy module python-pandas: for pandas support python-pytest: for pytest module [pending] python-pytz: for datetime and django module python-redis: for redis support python-rich: for CLI python-watchdog: for tracking file system events installing python-pdoc-pyo3-sample-library... installing python-annotated-types... installing python-typing-inspection... installing python-pydantic-core... installing python-pydantic... Optional dependencies for python-pydantic mypy: for type validation with mypy python-dotenv: for .env file support python-email-validator: for email validation python-hypothesis: for hypothesis plugin when using legacy v1 [installed] installing python-iniconfig... installing python-pluggy... installing python-pytest... installing python-pytest-timeout... :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... [?25h==> Retrieving sources...  -> Found pdoc-16.0.0.tar.gz ==> WARNING: Skipping all source file integrity checks. ==> Extracting sources...  -> Extracting pdoc-16.0.0.tar.gz with bsdtar ==> Starting build()... * Getting build dependencies for wheel... /usr/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated !! ******************************************************************************** Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0). By 2027-Feb-18, you need to update your project and remove deprecated calls or your builds will no longer be supported. See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! corresp(dist, value, root_dir) /usr/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: Public Domain See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! dist._finalize_license_expression() /usr/lib/python3.14/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: Public Domain See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() running egg_info creating pdoc.egg-info writing pdoc.egg-info/PKG-INFO writing dependency_links to pdoc.egg-info/dependency_links.txt writing entry points to pdoc.egg-info/entry_points.txt writing requirements to pdoc.egg-info/requires.txt writing top-level names to pdoc.egg-info/top_level.txt writing manifest file 'pdoc.egg-info/SOURCES.txt' reading manifest file 'pdoc.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no directories found matching 'requirements' no previously-included directories found matching '**/.mypy_cache' no previously-included directories found matching '**/__pycache__' adding license file 'LICENSE' writing manifest file 'pdoc.egg-info/SOURCES.txt' * Building wheel... /usr/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated !! ******************************************************************************** Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0). By 2027-Feb-18, you need to update your project and remove deprecated calls or your builds will no longer be supported. See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! corresp(dist, value, root_dir) /usr/lib/python3.14/site-packages/setuptools/config/_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: Public Domain See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! dist._finalize_license_expression() /usr/lib/python3.14/site-packages/setuptools/dist.py:765: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: Public Domain See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() running bdist_wheel running build running build_py creating build/lib/pdoc copying pdoc/render_helpers.py -> build/lib/pdoc copying pdoc/web.py -> build/lib/pdoc copying pdoc/_pydantic.py -> build/lib/pdoc copying pdoc/doc_ast.py -> build/lib/pdoc copying pdoc/render.py -> build/lib/pdoc copying pdoc/search.py -> build/lib/pdoc copying pdoc/doc.py -> build/lib/pdoc copying pdoc/_compat.py -> build/lib/pdoc copying pdoc/docstrings.py -> build/lib/pdoc copying pdoc/doc_types.py -> build/lib/pdoc copying pdoc/__init__.py -> build/lib/pdoc copying pdoc/doc_pyi.py -> build/lib/pdoc copying pdoc/__main__.py -> build/lib/pdoc copying pdoc/extract.py -> build/lib/pdoc running egg_info writing pdoc.egg-info/PKG-INFO writing dependency_links to pdoc.egg-info/dependency_links.txt writing entry points to pdoc.egg-info/entry_points.txt writing requirements to pdoc.egg-info/requires.txt writing top-level names to pdoc.egg-info/top_level.txt reading manifest file 'pdoc.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no directories found matching 'requirements' no previously-included directories found matching '**/.mypy_cache' no previously-included directories found matching '**/__pycache__' adding license file 'LICENSE' writing manifest file 'pdoc.egg-info/SOURCES.txt' copying pdoc/py.typed -> build/lib/pdoc creating build/lib/pdoc/templates copying pdoc/templates/README.md -> build/lib/pdoc/templates copying pdoc/templates/build-search-index.js -> build/lib/pdoc/templates copying pdoc/templates/content.css -> build/lib/pdoc/templates copying pdoc/templates/custom.css -> build/lib/pdoc/templates copying pdoc/templates/layout.css -> build/lib/pdoc/templates copying pdoc/templates/livereload.html.jinja2 -> build/lib/pdoc/templates copying pdoc/templates/math.html.jinja2 -> build/lib/pdoc/templates copying pdoc/templates/mermaid.html.jinja2 -> build/lib/pdoc/templates copying pdoc/templates/search.html.jinja2 -> build/lib/pdoc/templates copying pdoc/templates/search.js.jinja2 -> build/lib/pdoc/templates copying pdoc/templates/syntax-highlighting.css -> build/lib/pdoc/templates copying pdoc/templates/theme.css -> build/lib/pdoc/templates creating build/lib/pdoc/templates/default copying pdoc/templates/default/error.html.jinja2 -> build/lib/pdoc/templates/default copying pdoc/templates/default/frame.html.jinja2 -> build/lib/pdoc/templates/default copying pdoc/templates/default/index.html.jinja2 -> build/lib/pdoc/templates/default copying pdoc/templates/default/module.html.jinja2 -> build/lib/pdoc/templates/default creating build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/README.md -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/bootstrap-reboot.min.css -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/box-arrow-in-left.svg -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/elasticlunr.min.js -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/favicon.svg -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/navtoggle.svg -> build/lib/pdoc/templates/deprecated copying pdoc/templates/deprecated/pdoc-logo.svg -> build/lib/pdoc/templates/deprecated creating build/lib/pdoc/templates/resources copying pdoc/templates/resources/bootstrap-reboot.min.css -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/box-arrow-in-left.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/elasticlunr.min.js -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/exclamation-octagon-fill.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/exclamation-square-fill.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/exclamation-triangle-fill.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/info-circle-fill.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/lightbulb.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/lightning-fill.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/navtoggle.svg -> build/lib/pdoc/templates/resources copying pdoc/templates/resources/pdoc-logo.svg -> build/lib/pdoc/templates/resources creating build/lib/pdoc/templates/deprecated/resources copying pdoc/templates/deprecated/resources/favicon.svg -> build/lib/pdoc/templates/deprecated/resources installing to build/bdist.linux-riscv64/wheel running install running install_lib creating build/bdist.linux-riscv64/wheel creating build/bdist.linux-riscv64/wheel/pdoc copying build/lib/pdoc/render_helpers.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/web.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/_pydantic.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/doc_ast.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/render.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/search.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/py.typed -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/doc.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/_compat.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/docstrings.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/doc_types.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/__init__.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/doc_pyi.py -> build/bdist.linux-riscv64/wheel/./pdoc creating build/bdist.linux-riscv64/wheel/pdoc/templates creating build/bdist.linux-riscv64/wheel/pdoc/templates/default copying build/lib/pdoc/templates/default/module.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates/default copying build/lib/pdoc/templates/default/index.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates/default copying build/lib/pdoc/templates/default/error.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates/default copying build/lib/pdoc/templates/default/frame.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates/default copying build/lib/pdoc/templates/search.js.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/custom.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates creating build/bdist.linux-riscv64/wheel/pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/box-arrow-in-left.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/bootstrap-reboot.min.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/elasticlunr.min.js -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/pdoc-logo.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/navtoggle.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/favicon.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated copying build/lib/pdoc/templates/deprecated/README.md -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated creating build/bdist.linux-riscv64/wheel/pdoc/templates/deprecated/resources copying build/lib/pdoc/templates/deprecated/resources/favicon.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/deprecated/resources copying build/lib/pdoc/templates/syntax-highlighting.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/layout.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/theme.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/mermaid.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/livereload.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/search.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/README.md -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/build-search-index.js -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/content.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates copying build/lib/pdoc/templates/math.html.jinja2 -> build/bdist.linux-riscv64/wheel/./pdoc/templates creating build/bdist.linux-riscv64/wheel/pdoc/templates/resources copying build/lib/pdoc/templates/resources/exclamation-square-fill.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/exclamation-octagon-fill.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/info-circle-fill.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/box-arrow-in-left.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/lightbulb.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/bootstrap-reboot.min.css -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/elasticlunr.min.js -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/exclamation-triangle-fill.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/lightning-fill.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/pdoc-logo.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/templates/resources/navtoggle.svg -> build/bdist.linux-riscv64/wheel/./pdoc/templates/resources copying build/lib/pdoc/__main__.py -> build/bdist.linux-riscv64/wheel/./pdoc copying build/lib/pdoc/extract.py -> build/bdist.linux-riscv64/wheel/./pdoc running install_egg_info Copying pdoc.egg-info to build/bdist.linux-riscv64/wheel/./pdoc-16.0.0-py3.14.egg-info running install_scripts creating build/bdist.linux-riscv64/wheel/pdoc-16.0.0.dist-info/WHEEL creating '/build/pdoc/src/pdoc-16.0.0/dist/.tmp-b8qw6xvt/pdoc-16.0.0-py3-none-any.whl' and adding 'build/bdist.linux-riscv64/wheel' to it adding 'pdoc/__init__.py' adding 'pdoc/__main__.py' adding 'pdoc/_compat.py' adding 'pdoc/_pydantic.py' adding 'pdoc/doc.py' adding 'pdoc/doc_ast.py' adding 'pdoc/doc_pyi.py' adding 'pdoc/doc_types.py' adding 'pdoc/docstrings.py' adding 'pdoc/extract.py' adding 'pdoc/py.typed' adding 'pdoc/render.py' adding 'pdoc/render_helpers.py' adding 'pdoc/search.py' adding 'pdoc/web.py' adding 'pdoc/templates/README.md' adding 'pdoc/templates/build-search-index.js' adding 'pdoc/templates/content.css' adding 'pdoc/templates/custom.css' adding 'pdoc/templates/layout.css' adding 'pdoc/templates/livereload.html.jinja2' adding 'pdoc/templates/math.html.jinja2' adding 'pdoc/templates/mermaid.html.jinja2' adding 'pdoc/templates/search.html.jinja2' adding 'pdoc/templates/search.js.jinja2' adding 'pdoc/templates/syntax-highlighting.css' adding 'pdoc/templates/theme.css' adding 'pdoc/templates/default/error.html.jinja2' adding 'pdoc/templates/default/frame.html.jinja2' adding 'pdoc/templates/default/index.html.jinja2' adding 'pdoc/templates/default/module.html.jinja2' adding 'pdoc/templates/deprecated/README.md' adding 'pdoc/templates/deprecated/bootstrap-reboot.min.css' adding 'pdoc/templates/deprecated/box-arrow-in-left.svg' adding 'pdoc/templates/deprecated/elasticlunr.min.js' adding 'pdoc/templates/deprecated/favicon.svg' adding 'pdoc/templates/deprecated/navtoggle.svg' adding 'pdoc/templates/deprecated/pdoc-logo.svg' adding 'pdoc/templates/deprecated/resources/favicon.svg' adding 'pdoc/templates/resources/bootstrap-reboot.min.css' adding 'pdoc/templates/resources/box-arrow-in-left.svg' adding 'pdoc/templates/resources/elasticlunr.min.js' adding 'pdoc/templates/resources/exclamation-octagon-fill.svg' adding 'pdoc/templates/resources/exclamation-square-fill.svg' adding 'pdoc/templates/resources/exclamation-triangle-fill.svg' adding 'pdoc/templates/resources/info-circle-fill.svg' adding 'pdoc/templates/resources/lightbulb.svg' adding 'pdoc/templates/resources/lightning-fill.svg' adding 'pdoc/templates/resources/navtoggle.svg' adding 'pdoc/templates/resources/pdoc-logo.svg' adding 'pdoc-16.0.0.dist-info/licenses/LICENSE' adding 'pdoc-16.0.0.dist-info/METADATA' adding 'pdoc-16.0.0.dist-info/WHEEL' adding 'pdoc-16.0.0.dist-info/entry_points.txt' adding 'pdoc-16.0.0.dist-info/top_level.txt' adding 'pdoc-16.0.0.dist-info/RECORD' removing build/bdist.linux-riscv64/wheel Successfully built pdoc-16.0.0-py3-none-any.whl ==> Starting check()... ============================= test session starts ============================== platform linux -- Python 3.14.7, pytest-9.0.3, pluggy-1.6.0 -- /usr/bin/python cachedir: .pytest_cache hypothesis profile 'default' rootdir: /build/pdoc/src/pdoc-16.0.0 configfile: pyproject.toml testpaths: test plugins: timeout-2.4.0, hypothesis-6.165.10 timeout: 120.0s timeout method: signal timeout func_only: False collecting ... collected 370 items / 1 deselected / 369 selected test/test__pydantic.py::test_no_pydantic PASSED [ 0%] test/test__pydantic.py::test_with_pydantic PASSED [ 0%] test/test_doc.py::test_repr_tb PASSED [ 0%] test/test_doc.py::test_order PASSED [ 1%] test/test_doc.py::test_attrs PASSED [ 1%] test/test_doc.py::test_all_with_import_err PASSED [ 1%] test/test_doc.py::test_all_with_objects_instead_of_strings PASSED [ 1%] test/test_doc.py::test_var_with_raising_repr PASSED [ 2%] test/test_doc.py::test_class_with_raising_getattr PASSED [ 2%] test/test_doc.py::test_builtin_source PASSED [ 2%] test/test_doc.py::test_raising_getdoc PASSED [ 2%] test/test_doc.py::test_raising_submodules PASSED [ 3%] test/test_doc.py::test_default_value_masks_env_vars PASSED [ 3%] test/test_doc.py::test_source_file_method PASSED [ 3%] test/test_doc_ast.py::test_dedent PASSED [ 4%] test/test_doc_ast.py::test_parse_error PASSED [ 4%] test/test_doc_ast.py::test_type_checking_sections[import typing\nif typing.TYPE_CHECKING:\n\tprint(42)-1] PASSED [ 4%] test/test_doc_ast.py::test_type_checking_sections[from typing import TYPE_CHECKING\nif TYPE_CHECKING:\n\tprint(42)\n\tprint(43)-2] PASSED [ 4%] test/test_doc_ast.py::test_type_checking_sections[print(1234)-0] PASSED [ 5%] test/test_doc_pyi.py::test_type_stub_mismatch PASSED [ 5%] test/test_doc_pyi.py::test_invalid_stub_file PASSED [ 5%] test/test_doc_types.py::test_eval_fail[totally_unknown_module] PASSED [ 5%] test/test_doc_types.py::test_eval_fail[!!!!] PASSED [ 6%] test/test_doc_types.py::test_eval_fail[html.unknown_attr] PASSED [ 6%] test/test_doc_types.py::test_eval_fail2 PASSED [ 6%] test/test_doc_types.py::test_eval_fail3 PASSED [ 7%] test/test_doc_types.py::test_eval_fail_import_nonexistent PASSED [ 7%] test/test_doc_types.py::test_recurse PASSED [ 7%] test/test_docstrings.py::test_google PASSED [ 7%] test/test_docstrings.py::test_numpy PASSED [ 8%] test/test_docstrings.py::test_rst PASSED [ 8%] test/test_docstrings.py::test_rst_extract_options_fuzz PASSED [ 8%] test/test_docstrings.py::test_convert_exception PASSED [ 8%] test/test_docstrings.py::test_rst_extract_options PASSED [ 9%] test/test_docstrings.py::test_rst_include_trim_lines PASSED [ 9%] test/test_docstrings.py::test_rst_include_trim_pattern PASSED [ 9%] test/test_docstrings.py::test_rst_include_trim_mixture PASSED [ 10%] test/test_docstrings.py::test_rst_include_nonexistent PASSED [ 10%] test/test_docstrings.py::test_rst_include_invalid_options PASSED [ 10%] test/test_extract.py::test_walk_specs PASSED [ 10%] test/test_extract.py::test_parse_spec PASSED [ 11%] test/test_extract.py::test_parse_spec_mod_and_dir PASSED [ 11%] test/test_extract.py::test_module_mtime PASSED [ 11%] test/test_extract.py::test_invalidate_caches PASSED [ 11%] test/test_extract.py::test_mock_sideeffects PASSED [ 12%] test/test_main.py::test_cli PASSED [ 12%] test/test_main.py::test_cli_version PASSED [ 12%] test/test_main.py::test_cli_web PASSED [ 13%] test/test_main.py::test_cli_web_port_used PASSED [ 13%] test/test_main.py::test_api PASSED [ 13%] test/test_main.py::test_patch_showwarnings PASSED [ 13%] test/test_render_helpers.py::test_relative_link[foo-foo-] PASSED [ 14%] test/test_render_helpers.py::test_relative_link[foo-bar-bar.html] PASSED [ 14%] test/test_render_helpers.py::test_relative_link[foo.foo-foo-../foo.html] PASSED [ 14%] test/test_render_helpers.py::test_relative_link[foo.foo-bar-../bar.html] PASSED [ 14%] test/test_render_helpers.py::test_relative_link[foo.bar-foo.bar.baz-bar/baz.html] PASSED [ 15%] test/test_render_helpers.py::test_relative_link[foo.bar.baz-foo.qux.quux-../qux/quux.html] PASSED [ 15%] test/test_render_helpers.py::test_qualname_candidates[-candidates0] PASSED [ 15%] test/test_render_helpers.py::test_qualname_candidates[foo-candidates1] PASSED [ 15%] test/test_render_helpers.py::test_qualname_candidates[foo.bar-candidates2] PASSED [ 16%] test/test_render_helpers.py::test_module_candidates[foo.bar.baz-qux-candidates0] PASSED [ 16%] test/test_render_helpers.py::test_module_candidates[foo.bar.baz-foo.bar-candidates1] PASSED [ 16%] test/test_render_helpers.py::test_module_candidates[foo.bar.baz-foo-candidates2] PASSED [ 17%] test/test_render_helpers.py::test_edit_url[demo-False-mapping0-None] PASSED [ 17%] test/test_render_helpers.py::test_edit_url[demo-False-mapping1-https://github.com/mhils/pdoc/blob/master/test/testdata/demo.py] PASSED [ 17%] test/test_render_helpers.py::test_edit_url[demo-True-mapping2-https://github.com/mhils/pdoc/blob/master/test/testdata/demo/__init__.py] PASSED [ 17%] test/test_render_helpers.py::test_split_identifier[all_modules0-a.b.c.d-result0] PASSED [ 18%] test/test_render_helpers.py::test_split_identifier[all_modules1-a.c.b.d-result1] PASSED [ 18%] test/test_render_helpers.py::test_possible_sources[all_modules0-a.B-result0] PASSED [ 18%] test/test_render_helpers.py::test_possible_sources[all_modules1-a.b-result1] PASSED [ 18%] test/test_render_helpers.py::test_possible_sources[all_modules2-a-result2] PASSED [ 19%] test/test_render_helpers.py::test_possible_sources[all_modules3-a.b.c.d-result3] PASSED [ 19%] test/test_render_helpers.py::test_markdown_toc PASSED [ 19%] test/test_render_helpers.py::test_mixed_toc PASSED [ 20%] test/test_render_helpers.py::test_markdown_autolink[https://example.com/-

https://example.com/

\n] PASSED [ 20%] test/test_render_helpers.py::test_markdown_autolink[-

https://example.com

\n] PASSED [ 20%] test/test_render_helpers.py::test_markdown_autolink[link-

link

\n] PASSED [ 20%] test/test_render_helpers.py::test_markdown_autolink[[link](https://example.com)-

link

\n] PASSED [ 21%] test/test_render_helpers.py::test_markdown_autolink[See the [Python home page ](https://www.python.org) for info.-

See the Python home page for info.

\n] PASSED [ 21%] test/test_render_helpers.py::test_markdown_autolink[See https://www.python.org.-

See https://www.python.org.

\n] PASSED [ 21%] test/test_render_helpers.py::test_markdown_autolink[See **https://www.python.org**.-

See https://www.python.org.

\n] PASSED [ 21%] test/test_search.py::test_precompile_index PASSED [ 22%] test/test_smoke.py::test_smoke[pdoc] PASSED [ 22%] test/test_smoke.py::test_smoke[event_rpcgen] PASSED [ 22%] test/test_smoke.py::test_smoke[ld] PASSED [ 23%] test/test_smoke.py::test_smoke[abc] PASSED [ 23%] test/test_smoke.py::test_smoke[annotationlib] PASSED [ 23%] test/test_smoke.py::test_smoke[antigravity] PASSED [ 23%] test/test_smoke.py::test_smoke[argparse] PASSED [ 24%] test/test_smoke.py::test_smoke[ast] PASSED [ 24%] test/test_smoke.py::test_smoke[asyncio] PASSED [ 24%] test/test_smoke.py::test_smoke[base64] PASSED [ 24%] test/test_smoke.py::test_smoke[bdb] PASSED [ 25%] test/test_smoke.py::test_smoke[bisect] PASSED [ 25%] test/test_smoke.py::test_smoke[bz2] PASSED [ 25%] test/test_smoke.py::test_smoke[cProfile] PASSED [ 26%] test/test_smoke.py::test_smoke[calendar] PASSED [ 26%] test/test_smoke.py::test_smoke[cmd] PASSED [ 26%] test/test_smoke.py::test_smoke[code] PASSED [ 26%] test/test_smoke.py::test_smoke[codecs] PASSED [ 27%] test/test_smoke.py::test_smoke[codeop] PASSED [ 27%] test/test_smoke.py::test_smoke[collections] PASSED [ 27%] test/test_smoke.py::test_smoke[colorsys] PASSED [ 27%] test/test_smoke.py::test_smoke[compileall] PASSED [ 28%] test/test_smoke.py::test_smoke[compression] PASSED [ 28%] test/test_smoke.py::test_smoke[concurrent] PASSED [ 28%] test/test_smoke.py::test_smoke[configparser] PASSED [ 28%] test/test_smoke.py::test_smoke[contextlib] PASSED [ 29%] test/test_smoke.py::test_smoke[contextvars] PASSED [ 29%] test/test_smoke.py::test_smoke[copy] PASSED [ 29%] test/test_smoke.py::test_smoke[copyreg] PASSED [ 30%] test/test_smoke.py::test_smoke[csv] PASSED [ 30%] test/test_smoke.py::test_smoke[ctypes] PASSED [ 30%] test/test_smoke.py::test_smoke[curses] PASSED [ 30%] test/test_smoke.py::test_smoke[dataclasses] PASSED [ 31%] test/test_smoke.py::test_smoke[datetime] PASSED [ 31%] test/test_smoke.py::test_smoke[dbm] PASSED [ 31%] test/test_smoke.py::test_smoke[decimal] PASSED [ 31%] test/test_smoke.py::test_smoke[difflib] PASSED [ 32%] test/test_smoke.py::test_smoke[dis] PASSED [ 32%] test/test_smoke.py::test_smoke[doctest] PASSED [ 32%] test/test_smoke.py::test_smoke[email] PASSED [ 33%] test/test_smoke.py::test_smoke[encodings] PASSED [ 33%] test/test_smoke.py::test_smoke[ensurepip] PASSED [ 33%] test/test_smoke.py::test_smoke[enum] PASSED [ 33%] test/test_smoke.py::test_smoke[filecmp] PASSED [ 34%] test/test_smoke.py::test_smoke[fileinput] PASSED [ 34%] test/test_smoke.py::test_smoke[fnmatch] PASSED [ 34%] test/test_smoke.py::test_smoke[fractions] PASSED [ 34%] test/test_smoke.py::test_smoke[ftplib] PASSED [ 35%] test/test_smoke.py::test_smoke[functools] PASSED [ 35%] test/test_smoke.py::test_smoke[genericpath] PASSED [ 35%] test/test_smoke.py::test_smoke[getopt] PASSED [ 36%] test/test_smoke.py::test_smoke[getpass] PASSED [ 36%] test/test_smoke.py::test_smoke[gettext] PASSED [ 36%] test/test_smoke.py::test_smoke[glob] PASSED [ 36%] test/test_smoke.py::test_smoke[graphlib] PASSED [ 37%] test/test_smoke.py::test_smoke[gzip] PASSED [ 37%] test/test_smoke.py::test_smoke[hashlib] PASSED [ 37%] test/test_smoke.py::test_smoke[heapq] PASSED [ 37%] test/test_smoke.py::test_smoke[hmac] PASSED [ 38%] test/test_smoke.py::test_smoke[html] PASSED [ 38%] test/test_smoke.py::test_smoke[http] PASSED [ 38%] test/test_smoke.py::test_smoke[imaplib] PASSED [ 39%] test/test_smoke.py::test_smoke[importlib] PASSED [ 39%] test/test_smoke.py::test_smoke[inspect] PASSED [ 39%] test/test_smoke.py::test_smoke[io] PASSED [ 39%] test/test_smoke.py::test_smoke[ipaddress] PASSED [ 40%] test/test_smoke.py::test_smoke[json] PASSED [ 40%] test/test_smoke.py::test_smoke[keyword] PASSED [ 40%] test/test_smoke.py::test_smoke[linecache] PASSED [ 40%] test/test_smoke.py::test_smoke[locale] PASSED [ 41%] test/test_smoke.py::test_smoke[logging] PASSED [ 41%] test/test_smoke.py::test_smoke[lzma] PASSED [ 41%] test/test_smoke.py::test_smoke[mailbox] PASSED [ 42%] test/test_smoke.py::test_smoke[mimetypes] PASSED [ 42%] test/test_smoke.py::test_smoke[modulefinder] PASSED [ 42%] test/test_smoke.py::test_smoke[multiprocessing] PASSED [ 42%] test/test_smoke.py::test_smoke[netrc] PASSED [ 43%] test/test_smoke.py::test_smoke[ntpath] PASSED [ 43%] test/test_smoke.py::test_smoke[nturl2path] PASSED [ 43%] test/test_smoke.py::test_smoke[numbers] PASSED [ 43%] test/test_smoke.py::test_smoke[opcode] PASSED [ 44%] test/test_smoke.py::test_smoke[operator] PASSED [ 44%] test/test_smoke.py::test_smoke[optparse] PASSED [ 44%] test/test_smoke.py::test_smoke[os] PASSED [ 44%] test/test_smoke.py::test_smoke[pathlib] PASSED [ 45%] test/test_smoke.py::test_smoke[pdb] PASSED [ 45%] test/test_smoke.py::test_smoke[pickle] PASSED [ 45%] test/test_smoke.py::test_smoke[pickletools] PASSED [ 46%] test/test_smoke.py::test_smoke[pkgutil] PASSED [ 46%] test/test_smoke.py::test_smoke[platform] PASSED [ 46%] test/test_smoke.py::test_smoke[plistlib] PASSED [ 46%] test/test_smoke.py::test_smoke[poplib] PASSED [ 47%] test/test_smoke.py::test_smoke[posixpath] PASSED [ 47%] test/test_smoke.py::test_smoke[pprint] PASSED [ 47%] test/test_smoke.py::test_smoke[profile] PASSED [ 47%] test/test_smoke.py::test_smoke[pstats] PASSED [ 48%] test/test_smoke.py::test_smoke[pty] PASSED [ 48%] test/test_smoke.py::test_smoke[py_compile] PASSED [ 48%] test/test_smoke.py::test_smoke[pyclbr] PASSED [ 49%] test/test_smoke.py::test_smoke[pydoc] PASSED [ 49%] test/test_smoke.py::test_smoke[pydoc_data] PASSED [ 49%] test/test_smoke.py::test_smoke[queue] PASSED [ 49%] test/test_smoke.py::test_smoke[quopri] PASSED [ 50%] test/test_smoke.py::test_smoke[random] PASSED [ 50%] test/test_smoke.py::test_smoke[re] PASSED [ 50%] test/test_smoke.py::test_smoke[reprlib] PASSED [ 50%] test/test_smoke.py::test_smoke[rlcompleter] PASSED [ 51%] test/test_smoke.py::test_smoke[runpy] PASSED [ 51%] test/test_smoke.py::test_smoke[sched] PASSED [ 51%] test/test_smoke.py::test_smoke[secrets] PASSED [ 52%] test/test_smoke.py::test_smoke[selectors] PASSED [ 52%] test/test_smoke.py::test_smoke[shelve] PASSED [ 52%] test/test_smoke.py::test_smoke[shlex] PASSED [ 52%] test/test_smoke.py::test_smoke[shutil] PASSED [ 53%] test/test_smoke.py::test_smoke[signal] PASSED [ 53%] test/test_smoke.py::test_smoke[site] PASSED [ 53%] test/test_smoke.py::test_smoke[smtplib] PASSED [ 53%] test/test_smoke.py::test_smoke[socket] PASSED [ 54%] test/test_smoke.py::test_smoke[socketserver] PASSED [ 54%] test/test_smoke.py::test_smoke[sqlite3] PASSED [ 54%] test/test_smoke.py::test_smoke[sre_compile] PASSED [ 55%] test/test_smoke.py::test_smoke[sre_constants] PASSED [ 55%] test/test_smoke.py::test_smoke[sre_parse] PASSED [ 55%] test/test_smoke.py::test_smoke[ssl] PASSED [ 55%] test/test_smoke.py::test_smoke[stat] PASSED [ 56%] test/test_smoke.py::test_smoke[statistics] PASSED [ 56%] test/test_smoke.py::test_smoke[string] PASSED [ 56%] test/test_smoke.py::test_smoke[stringprep] PASSED [ 56%] test/test_smoke.py::test_smoke[struct] PASSED [ 57%] test/test_smoke.py::test_smoke[subprocess] PASSED [ 57%] test/test_smoke.py::test_smoke[symtable] PASSED [ 57%] test/test_smoke.py::test_smoke[sysconfig] PASSED [ 57%] test/test_smoke.py::test_smoke[tabnanny] PASSED [ 58%] test/test_smoke.py::test_smoke[tarfile] PASSED [ 58%] test/test_smoke.py::test_smoke[tempfile] PASSED [ 58%] test/test_smoke.py::test_smoke[textwrap] PASSED [ 59%] test/test_smoke.py::test_smoke[this] PASSED [ 59%] test/test_smoke.py::test_smoke[threading] PASSED [ 59%] test/test_smoke.py::test_smoke[timeit] PASSED [ 59%] test/test_smoke.py::test_smoke[tkinter] PASSED [ 60%] test/test_smoke.py::test_smoke[token] PASSED [ 60%] test/test_smoke.py::test_smoke[tokenize] PASSED [ 60%] test/test_smoke.py::test_smoke[tomllib] PASSED [ 60%] test/test_smoke.py::test_smoke[trace] PASSED [ 61%] test/test_smoke.py::test_smoke[traceback] PASSED [ 61%] test/test_smoke.py::test_smoke[tracemalloc] PASSED [ 61%] test/test_smoke.py::test_smoke[tty] PASSED [ 62%] test/test_smoke.py::test_smoke[turtle] PASSED [ 62%] test/test_smoke.py::test_smoke[turtledemo] PASSED [ 62%] test/test_smoke.py::test_smoke[types] PASSED [ 62%] test/test_smoke.py::test_smoke[typing] PASSED [ 63%] test/test_smoke.py::test_smoke[unittest] PASSED [ 63%] test/test_smoke.py::test_smoke[urllib] PASSED [ 63%] test/test_smoke.py::test_smoke[uuid] PASSED [ 63%] test/test_smoke.py::test_smoke[venv] PASSED [ 64%] test/test_smoke.py::test_smoke[warnings] PASSED [ 64%] test/test_smoke.py::test_smoke[wave] PASSED [ 64%] test/test_smoke.py::test_smoke[weakref] PASSED [ 65%] test/test_smoke.py::test_smoke[webbrowser] PASSED [ 65%] test/test_smoke.py::test_smoke[wsgiref] PASSED [ 65%] test/test_smoke.py::test_smoke[xml] PASSED [ 65%] test/test_smoke.py::test_smoke[xmlrpc] PASSED [ 66%] test/test_smoke.py::test_smoke[zipapp] PASSED [ 66%] test/test_smoke.py::test_smoke[zipfile] PASSED [ 66%] test/test_smoke.py::test_smoke[zipimport] PASSED [ 66%] test/test_smoke.py::test_smoke[zoneinfo] PASSED [ 67%] test/test_smoke.py::test_smoke[array] PASSED [ 67%] test/test_smoke.py::test_smoke[binascii] PASSED [ 67%] test/test_smoke.py::test_smoke[cmath] PASSED [ 68%] test/test_smoke.py::test_smoke[fcntl] PASSED [ 68%] test/test_smoke.py::test_smoke[grp] PASSED [ 68%] test/test_smoke.py::test_smoke[math] PASSED [ 68%] test/test_smoke.py::test_smoke[mmap] PASSED [ 69%] test/test_smoke.py::test_smoke[pyexpat] PASSED [ 69%] test/test_smoke.py::test_smoke[readline] PASSED [ 69%] test/test_smoke.py::test_smoke[resource] PASSED [ 69%] test/test_smoke.py::test_smoke[select] PASSED [ 70%] test/test_smoke.py::test_smoke[syslog] PASSED [ 70%] test/test_smoke.py::test_smoke[termios] PASSED [ 70%] test/test_smoke.py::test_smoke[unicodedata] PASSED [ 71%] test/test_smoke.py::test_smoke[xxlimited] PASSED [ 71%] test/test_smoke.py::test_smoke[xxlimited_35] PASSED [ 71%] test/test_smoke.py::test_smoke[xxsubtype] PASSED [ 71%] test/test_smoke.py::test_smoke[zlib] PASSED [ 72%] test/test_smoke.py::test_smoke[annotated_types] PASSED [ 72%] test/test_smoke.py::test_smoke[attr] PASSED [ 72%] test/test_smoke.py::test_smoke[attrs] PASSED [ 72%] test/test_smoke.py::test_smoke[autocommand] PASSED [ 73%] test/test_smoke.py::test_smoke[boost] PASSED [ 73%] test/test_smoke.py::test_smoke[build] PASSED [ 73%] test/test_smoke.py::test_smoke[drv_libxml2] PASSED [ 73%] test/test_smoke.py::test_smoke[hypothesis] PASSED [ 74%] test/test_smoke.py::test_smoke[iniconfig] PASSED [ 74%] test/test_smoke.py::test_smoke[installer] PASSED [ 74%] test/test_smoke.py::test_smoke[jinja2] PASSED [ 75%] test/test_smoke.py::test_smoke[libmount] PASSED [ 75%] test/test_smoke.py::test_smoke[libxml2] PASSED [ 75%] test/test_smoke.py::test_smoke[libxml2mod] PASSED [ 75%] test/test_smoke.py::test_smoke[markdown2] PASSED [ 76%] test/test_smoke.py::test_smoke[markupsafe] PASSED [ 76%] test/test_smoke.py::test_smoke[more_itertools] PASSED [ 76%] test/test_smoke.py::test_smoke[packaging] PASSED [ 76%] test/test_smoke.py::test_smoke[pdoc_pyo3_sample_library] PASSED [ 77%] test/test_smoke.py::test_smoke[pkg_resources] PASSED [ 77%] test/test_smoke.py::test_smoke[platformdirs] PASSED [ 77%] test/test_smoke.py::test_smoke[pluggy] PASSED [ 78%] test/test_smoke.py::test_smoke[pydantic] PASSED [ 78%] test/test_smoke.py::test_smoke[pydantic_core] PASSED [ 78%] test/test_smoke.py::test_smoke[pygments] PASSED [ 78%] test/test_smoke.py::test_smoke[pyproject_hooks] PASSED [ 79%] test/test_smoke.py::test_smoke[pytest] PASSED [ 79%] test/test_smoke.py::test_smoke[pytest_timeout] PASSED [ 79%] test/test_smoke.py::test_smoke[setuptools] PASSED [ 79%] test/test_smoke.py::test_smoke[sortedcontainers] PASSED [ 80%] test/test_smoke.py::test_smoke[typing_extensions] PASSED [ 80%] test/test_smoke.py::test_smoke[typing_inspection] PASSED [ 80%] test/test_smoke.py::test_smoke[wheel] PASSED [ 81%] test/test_smoke.py::test_smoke[unittest.mock] PASSED [ 81%] test/test_snapshot.py::test_snapshots[html-ast_parsing] PASSED [ 81%] test/test_snapshot.py::test_snapshots[html-collections_abc] PASSED [ 81%] test/test_snapshot.py::test_snapshots[html-demo] PASSED [ 82%] test/test_snapshot.py::test_snapshots[html-enums] PASSED [ 82%] test/test_snapshot.py::test_snapshots[html-flavors_google] FAILED [ 82%] test/test_snapshot.py::test_snapshots[html-flavors_numpy] FAILED [ 82%] test/test_snapshot.py::test_snapshots[html-flavors_rst] PASSED [ 83%] test/test_snapshot.py::test_snapshots[html-example_customtemplate] PASSED [ 83%] test/test_snapshot.py::test_snapshots[html-example_darkmode] PASSED [ 83%] test/test_snapshot.py::test_snapshots[html-example_mkdocs] PASSED [ 84%] test/test_snapshot.py::test_snapshots[html-demo_long] PASSED [ 84%] test/test_snapshot.py::test_snapshots[html-demo_eager] PASSED [ 84%] test/test_snapshot.py::test_snapshots[html-demopackage] PASSED [ 84%] test/test_snapshot.py::test_snapshots[html-misc] PASSED [ 85%] test/test_snapshot.py::test_snapshots[html-misc_py310] PASSED [ 85%] test/test_snapshot.py::test_snapshots[html-misc_py312] PASSED [ 85%] test/test_snapshot.py::test_snapshots[html-misc_py313_0] PASSED [ 85%] test/test_snapshot.py::test_snapshots[html-misc_py313_1] PASSED [ 86%] test/test_snapshot.py::test_snapshots[html-math_demo] PASSED [ 86%] test/test_snapshot.py::test_snapshots[html-math_misc] PASSED [ 86%] test/test_snapshot.py::test_snapshots[html-mermaid_demo] PASSED [ 86%] test/test_snapshot.py::test_snapshots[html-render_options] PASSED [ 87%] test/test_snapshot.py::test_snapshots[html-pyo3_sample_library] PASSED [ 87%] test/test_snapshot.py::test_snapshots[html-top_level_reimports] PASSED [ 87%] test/test_snapshot.py::test_snapshots[html-type_checking_imports] PASSED [ 88%] test/test_snapshot.py::test_snapshots[html-typed_dict] PASSED [ 88%] test/test_snapshot.py::test_snapshots[html-type_stubs] PASSED [ 88%] test/test_snapshot.py::test_snapshots[html-visibility] PASSED [ 88%] test/test_snapshot.py::test_snapshots[html-with_pydantic] PASSED [ 89%] test/test_snapshot.py::test_snapshots[repr-ast_parsing] PASSED [ 89%] test/test_snapshot.py::test_snapshots[repr-collections_abc] PASSED [ 89%] test/test_snapshot.py::test_snapshots[repr-demo] PASSED [ 89%] test/test_snapshot.py::test_snapshots[repr-enums] PASSED [ 90%] test/test_snapshot.py::test_snapshots[repr-flavors_google] PASSED [ 90%] test/test_snapshot.py::test_snapshots[repr-flavors_numpy] PASSED [ 90%] test/test_snapshot.py::test_snapshots[repr-flavors_rst] PASSED [ 91%] test/test_snapshot.py::test_snapshots[repr-example_customtemplate] PASSED [ 91%] test/test_snapshot.py::test_snapshots[repr-example_darkmode] PASSED [ 91%] test/test_snapshot.py::test_snapshots[repr-example_mkdocs] PASSED [ 91%] test/test_snapshot.py::test_snapshots[repr-demo_long] PASSED [ 92%] test/test_snapshot.py::test_snapshots[repr-demo_eager] PASSED [ 92%] test/test_snapshot.py::test_snapshots[repr-demopackage] PASSED [ 92%] test/test_snapshot.py::test_snapshots[repr-demopackage_dir] PASSED [ 92%] test/test_snapshot.py::test_snapshots[repr-misc] PASSED [ 93%] test/test_snapshot.py::test_snapshots[repr-misc_py310] PASSED [ 93%] test/test_snapshot.py::test_snapshots[repr-misc_py312] PASSED [ 93%] test/test_snapshot.py::test_snapshots[repr-misc_py313_0] PASSED [ 94%] test/test_snapshot.py::test_snapshots[repr-misc_py313_1] PASSED [ 94%] test/test_snapshot.py::test_snapshots[repr-math_demo] PASSED [ 94%] test/test_snapshot.py::test_snapshots[repr-math_misc] PASSED [ 94%] test/test_snapshot.py::test_snapshots[repr-mermaid_demo] PASSED [ 95%] test/test_snapshot.py::test_snapshots[repr-render_options] PASSED [ 95%] test/test_snapshot.py::test_snapshots[repr-pyo3_sample_library] PASSED [ 95%] test/test_snapshot.py::test_snapshots[repr-top_level_reimports] PASSED [ 95%] test/test_snapshot.py::test_snapshots[repr-type_checking_imports] PASSED [ 96%] test/test_snapshot.py::test_snapshots[repr-typed_dict] PASSED [ 96%] test/test_snapshot.py::test_snapshots[repr-type_stubs] PASSED [ 96%] test/test_snapshot.py::test_snapshots[repr-visibility] PASSED [ 97%] test/test_snapshot.py::test_snapshots[repr-with_pydantic] PASSED [ 97%] test/test_web.py::test_head_index PASSED [ 97%] test/test_web.py::test_get_index PASSED [ 97%] test/test_web.py::test_get_search_json PASSED [ 98%] test/test_web.py::test_get_module PASSED [ 98%] test/test_web.py::test_get_module_url_escape_sequences PASSED [ 98%] test/test_web.py::test_get_dependency PASSED [ 98%] test/test_web.py::test_get_module_err PASSED [ 99%] test/test_web.py::test_get_module_mtime PASSED [ 99%] test/test_web.py::test_get_unknown PASSED [ 99%] test/test_web.py::test_get_not_normalized PASSED [100%] =================================== FAILURES =================================== _____________________ test_snapshots[html-flavors_google] ______________________ snapshot = Snapshot(flavors_google), format = 'html' monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f051f31c440> @pytest.mark.parametrize("snapshot", snapshots, ids=[x.id for x in snapshots]) @pytest.mark.parametrize("format", ["html", "repr"]) def test_snapshots(snapshot: Snapshot, format: str, monkeypatch): """ Compare pdoc's rendered output against stored snapshots. """ monkeypatch.chdir(snapshot_dir) if sys.version_info < snapshot.min_version: pytest.skip( f"Snapshot only works on Python {'.'.join(str(x) for x in snapshot.min_version)} and above." ) expected = snapshot.outfile(format).read_text("utf8") actual = snapshot.make(format) > assert actual == expected, ( f"Rendered output does not match for snapshot {snapshot.id}. " "Run `python3 ./test/test_snapshot.py` to update snapshots." ) E AssertionError: Rendered output does not match for snapshot flavors_google. Run `python3 ./test/test_snapshot.py` to update snapshots. E assert '\n\n\n \n \n \n flavors_google API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_google

\n\n

Example Google style docstrings.

\n\n

This module demonstrates documentation as specified by the Google Python\nStyle Guide. Docstrings may extend over multiple lines. Sections are created\nwith a section header and a colon followed by a block of indented text.

\n\n
Example:
\n\n
\n

Examples can be given using either the Example or Examples\n sections. Sections support any reStructuredText formatting, including\n literal blocks::

\n\n
$ python example_google.py\n
\n
\n\n

Section breaks are created by resuming unindented text. Section breaks\nare also implicitly created anytime a new section starts.

\n\n
Attributes:
\n\n
    \n
  • module_level_variable1 (int): Module level variables may be documented in\neither the Attributes section of the module docstring, or in an\ninline docstring immediately following the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n\n
Todo:
\n\n
\n
    \n
  • For module TODOs
  • \n
  • You have to also use sphinx.ext.todo extension
  • \n
\n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html\n  4#   License: BSD-3\n  5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html\n  6#   License: CC BY 3.0\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example Google style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `Google Python\n 13Style Guide`_. Docstrings may extend over multiple lines. Sections are created\n 14with a section header and a colon followed by a block of indented text.\n 15\n 16Example:\n 17    Examples can be given using either the ``Example`` or ``Examples``\n 18    sections. Sections support any reStructuredText formatting, including\n 19    literal blocks::\n 20\n 21        $ python example_google.py\n 22\n 23Section breaks are created by resuming unindented text. Section breaks\n 24are also implicitly created anytime a new section starts.\n 25\n 26Attributes:\n 27    module_level_variable1 (int): Module level variables may be documented in\n 28        either the ``Attributes`` section of the module docstring, or in an\n 29        inline docstring immediately following the variable.\n 30\n 31        Either form is acceptable, but the two should not be mixed. Choose\n 32        one convention to document module level variables and be consistent\n 33        with it.\n 34\n 35Todo:\n 36    * For module TODOs\n 37    * You have to also use ``sphinx.ext.todo`` extension\n 38\n 39.. _Google Python Style Guide:\n 40   http://google.github.io/styleguide/pyguide.html\n 41\n 42"""\n 43__docformat__ = "google"\n 44\n 45from typing import Any, Mapping, Sequence, Tuple\n 46\n 47\n 48module_level_variable1 = 12345\n 49\n 50module_level_variable2 = 98765\n 51"""int: Module level variable documented inline.\n 52\n 53The docstring may span multiple lines. The type may optionally be specified\n 54on the first line, separated by a colon.\n 55"""\n 56\n 57\n 58def function_with_types_in_docstring(param1, param2):\n 59    """Example function with types documented in the docstring.\n 60\n 61    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 62    return types are annotated according to `PEP 484`_, they do not need to be\n 63    included in the docstring:\n 64\n 65    Args:\n 66        param1 (int): The first parameter.\n 67        param2 (str): The second parameter.\n 68\n 69    Returns:\n 70        bool: The return value. True for success, False otherwise.\n 71\n 72    .. _PEP 484:\n 73        https://www.python.org/dev/peps/pep-0484/\n 74\n 75    """\n 76\n 77\n 78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 79    """Example function with PEP 484 type annotations.\n 80\n 81    Args:\n 82        param1: The first parameter.\n 83        param2: The second parameter.\n 84\n 85    Returns:\n 86        The return value. True for success, False otherwise.\n 87\n 88    """\n 89    raise NotImplementedError\n 90\n 91\n 92def module_level_function(param1, param2=None, *args, **kwargs):\n 93    """This is an example of a module level function.\n 94\n 95    Function parameters should be documented in the ``Args`` section. The name\n 96    of each parameter is required. The type and description of each parameter\n 97    is optional, but should be included if not obvious.\n 98\n 99    If *args or **kwargs are accepted,\n100    they should be listed as ``*args`` and ``**kwargs``.\n101\n102    The format for a parameter is::\n103\n104        name (type): description\n105            The description may span multiple lines. Following\n106            lines should be indented. The "(type)" is optional.\n107\n108            Multiple paragraphs are supported in parameter\n109            descriptions.\n110\n111    Args:\n112        param1 (int): The first parameter.\n113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n114            Second line of description should be indented.\n115        *args: Variable length argument list.\n116        **kwargs: Arbitrary keyword arguments.\n117\n118    Returns:\n119        bool: True if successful, False otherwise.\n120\n121        The return type is optional and may be specified at the beginning of\n122        the ``Returns`` section followed by a colon.\n123\n124        The ``Returns`` section may span multiple lines and paragraphs.\n125        Following lines should be indented to match the first line.\n126\n127        The ``Returns`` section supports any reStructuredText formatting,\n128        including literal blocks::\n129\n130            {\n131                'param1': param1,\n132                'param2': param2\n133            }\n134\n135    Raises:\n136        AttributeError: The ``Raises`` section is a list of all exceptions\n137            that are relevant to the interface.\n138        ValueError: If `param2` is equal to `param1`.\n139\n140    """\n141    if param1 == param2:\n142        raise ValueError('param1 may not be equal to param2')\n143    return True\n144\n145\n146def example_generator(n):\n147    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n148\n149    Args:\n150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n151\n152    Yields:\n153        int: The next number in the range of 0 to `n` - 1.\n154\n155    Examples:\n156        Examples should be written in doctest format, and should illustrate how\n157        to use the function.\n158\n159        >>> print([i for i in example_generator(4)])\n160        [0, 1, 2, 3]\n161\n162    """\n163    for i in range(n):\n164        yield i\n165\n166\n167class ExampleError(Exception):\n168    """Exceptions are documented in the same way as classes.\n169\n170    The __init__ method may be documented in either the class level\n171    docstring, or as a docstring on the __init__ method itself.\n172\n173    Either form is acceptable, but the two should not be mixed. Choose one\n174    convention to document the __init__ method and be consistent with it.\n175\n176    Note:\n177        Do not include the `self` parameter in the ``Args`` section.\n178\n179    Args:\n180        msg (str): Human readable string describing the exception.\n181        code (:obj:`int`, optional): Error code.\n182\n183    Attributes:\n184        msg (str): Human readable string describing the exception.\n185        code (int): Exception error code.\n186\n187    """\n188\n189    def __init__(self, msg, code):\n190        self.msg = msg\n191        self.code = code\n192\n193    def add_note(self, note: str):\n194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n195\n196    def with_traceback(self, object, /):\n197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n198\n199class ExampleClass(object):\n200    """The summary line for a class docstring should fit on one line.\n201\n202    If the class has public attributes, they may be documented here\n203    in an ``Attributes`` section and follow the same formatting as a\n204    function's ``Args`` section. Alternatively, attributes may be documented\n205    inline with the attribute's declaration (see __init__ method below).\n206\n207    Properties created with the ``@property`` decorator should be documented\n208    in the property's getter method.\n209\n210    Attributes:\n211        attr1 (str): Description of `attr1`.\n212        attr2 (:obj:`int`, optional): Description of `attr2`.\n213\n214    """\n215\n216    def __init__(self, param1, param2, param3):\n217        """Example of docstring on the __init__ method.\n218\n219        The __init__ method may be documented in either the class level\n220        docstring, or as a docstring on the __init__ method itself.\n221\n222        Either form is acceptable, but the two should not be mixed. Choose one\n223        convention to document the __init__ method and be consistent with it.\n224\n225        Note:\n226            Do not include the `self` parameter in the ``Args`` section.\n227\n228        Args:\n229            param1 (str): Description of `param1`.\n230            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n231                lines are supported.\n232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n233\n234        """\n235        self.attr1 = param1\n236        self.attr2 = param2\n237        self.attr3 = param3  #: Doc comment *inline* with attribute\n238\n239        #: list of str: Doc comment *before* attribute, with type specified\n240        self.attr4 = ['attr4']\n241\n242        self.attr5 = None\n243        """str: Docstring *after* attribute, with type specified."""\n244\n245    @property\n246    def readonly_property(self):\n247        """str: Properties should be documented in their getter method."""\n248        return 'readonly_property'\n249\n250    @property\n251    def readwrite_property(self):\n252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n253        should only be documented in their getter method.\n254\n255        If the setter method contains notable behavior, it should be\n256        mentioned here.\n257        """\n258        return ['readwrite_property']\n259\n260    @readwrite_property.setter\n261    def readwrite_property(self, value):\n262        value\n263\n264    def example_method(self, param1, param2):\n265        """Class methods are similar to regular functions.\n266\n267        Note:\n268            Do not include the `self` parameter in the ``Args`` section.\n269\n270        Args:\n271            param1: The first parameter.\n272            param2: The second parameter.\n273\n274        Returns:\n275            True if successful, False otherwise.\n276\n277        """\n278        return True\n279\n280    def __special__(self):\n281        """By default special members with docstrings are not included.\n282\n283        Special members are any methods or attributes that start with and\n284        end with a double underscore. Any special member with a docstring\n285        will be included in the output, if\n286        ``napoleon_include_special_with_doc`` is set to True.\n287\n288        This behavior can be enabled by changing the following setting in\n289        Sphinx's conf.py::\n290\n291            napoleon_include_special_with_doc = True\n292\n293        """\n294        pass\n295\n296    def __special_without_docstring__(self):\n297        pass\n298\n299    def _private(self):\n300        """By default private members are not included.\n301\n302        Private members are any methods or attributes that start with an\n303        underscore and are *not* special. By default they are not included\n304        in the output.\n305\n306        This behavior can be changed such that private members *are* included\n307        by changing the following setting in Sphinx's conf.py::\n308\n309            napoleon_include_private_with_doc = True\n310\n311        """\n312        pass\n313\n314    def _private_without_docstring(self):\n315        pass\n316\n317\n318def fetch_smalltable_rows(table_handle: Any,\n319                          keys: Sequence[str],\n320                          require_all_keys: bool = False,\n321) -> Mapping[bytes, Tuple[str]]:\n322    """Fetches rows from a Smalltable.\n323\n324    Retrieves rows pertaining to the given keys from the Table instance\n325    represented by table_handle.  String keys will be UTF-8 encoded.\n326\n327    Args:\n328        table_handle: An open smalltable.Table instance.\n329        keys: A sequence of strings representing the key of each table\n330          row to fetch.  String keys will be UTF-8 encoded.\n331        require_all_keys: Optional; If require_all_keys is True only\n332          rows with values set for all keys will be returned.\n333\n334    Returns:\n335        A dict mapping keys to the corresponding table row data\n336        fetched. Each row is represented as a tuple of strings. For\n337        example:\n338\n339        {b'Serak': ('Rigel VII', 'Preparer'),\n340         b'Zim': ('Irk', 'Invader'),\n341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n342\n343        Returned keys are always bytes.  If a key from the keys argument is\n344        missing from the dictionary, then that row was not found in the\n345        table (and require_all_keys must have been False).\n346\n347    Raises:\n348        IOError: An error occurred accessing the smalltable.\n349    """\n350    raise NotImplementedError\n351\n352\n353def fetch_smalltable_rows2(table_handle: Any,\n354                          keys: Sequence[str],\n355                          require_all_keys: bool = False,\n356) -> Mapping[bytes, Tuple[str]]:\n357    """Fetches rows from a Smalltable.\n358\n359    Retrieves rows pertaining to the given keys from the Table instance\n360    represented by table_handle.  String keys will be UTF-8 encoded.\n361\n362    Args:\n363      table_handle:\n364        An open smalltable.Table instance.\n365      keys:\n366        A sequence of strings representing the key of each table row to\n367        fetch.  String keys will be UTF-8 encoded.\n368      require_all_keys:\n369        Optional; If require_all_keys is True only rows with values set\n370        for all keys will be returned.\n371\n372    Returns:\n373      A dict mapping keys to the corresponding table row data\n374      fetched. Each row is represented as a tuple of strings. For\n375      example:\n376\n377      {b'Serak': ('Rigel VII', 'Preparer'),\n378       b'Zim': ('Irk', 'Invader'),\n379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n380\n381      Returned keys are always bytes.  If a key from the keys argument is\n382      missing from the dictionary, then that row was not found in the\n383      table (and require_all_keys must have been False).\n384\n385    Raises:\n386      IOError: An error occurred accessing the smalltable.\n387    """\n388    raise NotImplementedError\n389\n390\n391class SampleClass:\n392    """Summary of class here.\n393\n394    Longer class information....\n395    Longer class information....\n396\n397    Attributes:\n398        likes_spam: A boolean indicating if we like SPAM or not.\n399        eggs: An integer count of the eggs we have laid.\n400    """\n401\n402    def __init__(self, likes_spam=False):\n403        """Inits SampleClass with blah."""\n404        self.likes_spam = likes_spam\n405        self.eggs = 0\n406\n407    def public_method(self):\n408        """Performs operation blah."""\n409\n410\n411def invalid_format(test):\n412    """\n413    In this example, there is no colon after the argument and an empty section.\n414\n415    Args:\n416      test\n417        there is a colon missing in the previous line\n418    Returns:\n419\n420    """\n421\n422\n423def example_code():\n424    """\n425    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n426\n427    Example:\n428\n429        ```python\n430        tmp = a2()\n431\n432        tmp2 = a()\n433        ```\n434    """\n435\n436\n437def newline_after_args(test: str):\n438    """\n439    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n440\n441    Args:\n442\n443      test\n444        there is unexpected whitespace before test.\n445    """\n446\n447\n448def alternative_section_names(test: str):\n449    """\n450    In this example, we check whether alternative section names aliased to\n451    'Args' are handled properly.\n452\n453    Parameters:\n454        test: the test string\n455    """\n456\n457def keyword_arguments(**kwargs):\n458    """\n459    This an example for a function with keyword arguments documented in the docstring.\n460\n461    Args:\n462        **kwargs: A dictionary containing user info.\n463\n464    Keyword Arguments:\n465        str_arg (str): First string argument.\n466        int_arg (int): Second integer argument.\n467    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
59def function_with_types_in_docstring(param1, param2):\n60    """Example function with types documented in the docstring.\n61\n62    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n63    return types are annotated according to `PEP 484`_, they do not need to be\n64    included in the docstring:\n65\n66    Args:\n67        param1 (int): The first parameter.\n68        param2 (str): The second parameter.\n69\n70    Returns:\n71        bool: The return value. True for success, False otherwise.\n72\n73    .. _PEP 484:\n74        https://www.python.org/dev/peps/pep-0484/\n75\n76    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str): The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

bool: The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n80    """Example function with PEP 484 type annotations.\n81\n82    Args:\n83        param1: The first parameter.\n84        param2: The second parameter.\n85\n86    Returns:\n87        The return value. True for success, False otherwise.\n88\n89    """\n90    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
 93def module_level_function(param1, param2=None, *args, **kwargs):\n 94    """This is an example of a module level function.\n 95\n 96    Function parameters should be documented in the ``Args`` section. The name\n 97    of each parameter is required. The type and description of each parameter\n 98    is optional, but should be included if not obvious.\n 99\n100    If *args or **kwargs are accepted,\n101    they should be listed as ``*args`` and ``**kwargs``.\n102\n103    The format for a parameter is::\n104\n105        name (type): description\n106            The description may span multiple lines. Following\n107            lines should be indented. The "(type)" is optional.\n108\n109            Multiple paragraphs are supported in parameter\n110            descriptions.\n111\n112    Args:\n113        param1 (int): The first parameter.\n114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n115            Second line of description should be indented.\n116        *args: Variable length argument list.\n117        **kwargs: Arbitrary keyword arguments.\n118\n119    Returns:\n120        bool: True if successful, False otherwise.\n121\n122        The return type is optional and may be specified at the beginning of\n123        the ``Returns`` section followed by a colon.\n124\n125        The ``Returns`` section may span multiple lines and paragraphs.\n126        Following lines should be indented to match the first line.\n127\n128        The ``Returns`` section supports any reStructuredText formatting,\n129        including literal blocks::\n130\n131            {\n132                'param1': param1,\n133                'param2': param2\n134            }\n135\n136    Raises:\n137        AttributeError: The ``Raises`` section is a list of all exceptions\n138            that are relevant to the interface.\n139        ValueError: If `param2` is equal to `param1`.\n140\n141    """\n142    if param1 == param2:\n143        raise ValueError('param1 may not be equal to param2')\n144    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Args section. The name\nof each parameter is required. The type and description of each parameter\nis optional, but should be included if not obvious.

\n\n

If *args or **kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name (type): description\n    The description may span multiple lines. Following\n    lines should be indented. The "(type)" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str, optional): The second parameter. Defaults to None.\nSecond line of description should be indented.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns:
\n\n
\n

bool: True if successful, False otherwise.

\n \n

The return type is optional and may be specified at the beginning of\n the Returns section followed by a colon.

\n \n

The Returns section may span multiple lines and paragraphs.\n Following lines should be indented to match the first line.

\n \n

The Returns section supports any reStructuredText formatting,\n including literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n
\n\n
Raises:
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
147def example_generator(n):\n148    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n149\n150    Args:\n151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n152\n153    Yields:\n154        int: The next number in the range of 0 to `n` - 1.\n155\n156    Examples:\n157        Examples should be written in doctest format, and should illustrate how\n158        to use the function.\n159\n160        >>> print([i for i in example_generator(4)])\n161        [0, 1, 2, 3]\n162\n163    """\n164    for i in range(n):\n165        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Arguments:
\n\n
    \n
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields:
\n\n
\n

int: The next number in the range of 0 to n - 1.

\n
\n\n
Examples:
\n\n
\n

Examples should be written in doctest format, and should illustrate how\n to use the function.

\n \n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
168class ExampleError(Exception):\n169    """Exceptions are documented in the same way as classes.\n170\n171    The __init__ method may be documented in either the class level\n172    docstring, or as a docstring on the __init__ method itself.\n173\n174    Either form is acceptable, but the two should not be mixed. Choose one\n175    convention to document the __init__ method and be consistent with it.\n176\n177    Note:\n178        Do not include the `self` parameter in the ``Args`` section.\n179\n180    Args:\n181        msg (str): Human readable string describing the exception.\n182        code (:obj:`int`, optional): Error code.\n183\n184    Attributes:\n185        msg (str): Human readable string describing the exception.\n186        code (int): Exception error code.\n187\n188    """\n189\n190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n193\n194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n196\n197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int, optional): Error code.
  • \n
\n\n
Attributes:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int): Exception error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
200class ExampleClass(object):\n201    """The summary line for a class docstring should fit on one line.\n202\n203    If the class has public attributes, they may be documented here\n204    in an ``Attributes`` section and follow the same formatting as a\n205    function's ``Args`` section. Alternatively, attributes may be documented\n206    inline with the attribute's declaration (see __init__ method below).\n207\n208    Properties created with the ``@property`` decorator should be documented\n209    in the property's getter method.\n210\n211    Attributes:\n212        attr1 (str): Description of `attr1`.\n213        attr2 (:obj:`int`, optional): Description of `attr2`.\n214\n215    """\n216\n217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n245\n246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n250\n251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n260\n261    @readwrite_property.setter\n262    def readwrite_property(self, value):\n263        value\n264\n265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n280\n281    def __special__(self):\n282        """By default special members with docstrings are not included.\n283\n284        Special members are any methods or attributes that start with and\n285        end with a double underscore. Any special member with a docstring\n286        will be included in the output, if\n287        ``napoleon_include_special_with_doc`` is set to True.\n288\n289        This behavior can be enabled by changing the following setting in\n290        Sphinx's conf.py::\n291\n292            napoleon_include_special_with_doc = True\n293\n294        """\n295        pass\n296\n297    def __special_without_docstring__(self):\n298        pass\n299\n300    def _private(self):\n301        """By default private members are not included.\n302\n303        Private members are any methods or attributes that start with an\n304        underscore and are *not* special. By default they are not included\n305        in the output.\n306\n307        This behavior can be changed such that private members *are* included\n308        by changing the following setting in Sphinx's conf.py::\n309\n310            napoleon_include_private_with_doc = True\n311\n312        """\n313        pass\n314\n315    def _private_without_docstring(self):\n316        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes:
\n\n
    \n
  • attr1 (str): Description of attr1.
  • \n
  • attr2 (int, optional): Description of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1 (str): Description of param1.
  • \n
  • param2 (int, optional): Description of param2. Multiple\nlines are supported.
  • \n
  • param3 (list of str): Description of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

True if successful, False otherwise.

\n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n fetch_smalltable_rows(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
319def fetch_smalltable_rows(table_handle: Any,\n320                          keys: Sequence[str],\n321                          require_all_keys: bool = False,\n322) -> Mapping[bytes, Tuple[str]]:\n323    """Fetches rows from a Smalltable.\n324\n325    Retrieves rows pertaining to the given keys from the Table instance\n326    represented by table_handle.  String keys will be UTF-8 encoded.\n327\n328    Args:\n329        table_handle: An open smalltable.Table instance.\n330        keys: A sequence of strings representing the key of each table\n331          row to fetch.  String keys will be UTF-8 encoded.\n332        require_all_keys: Optional; If require_all_keys is True only\n333          rows with values set for all keys will be returned.\n334\n335    Returns:\n336        A dict mapping keys to the corresponding table row data\n337        fetched. Each row is represented as a tuple of strings. For\n338        example:\n339\n340        {b'Serak': ('Rigel VII', 'Preparer'),\n341         b'Zim': ('Irk', 'Invader'),\n342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n343\n344        Returned keys are always bytes.  If a key from the keys argument is\n345        missing from the dictionary, then that row was not found in the\n346        table (and require_all_keys must have been False).\n347\n348    Raises:\n349        IOError: An error occurred accessing the smalltable.\n350    """\n351    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table\nrow to fetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only\nrows with values set for all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n fetch_smalltable_rows2(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
354def fetch_smalltable_rows2(table_handle: Any,\n355                          keys: Sequence[str],\n356                          require_all_keys: bool = False,\n357) -> Mapping[bytes, Tuple[str]]:\n358    """Fetches rows from a Smalltable.\n359\n360    Retrieves rows pertaining to the given keys from the Table instance\n361    represented by table_handle.  String keys will be UTF-8 encoded.\n362\n363    Args:\n364      table_handle:\n365        An open smalltable.Table instance.\n366      keys:\n367        A sequence of strings representing the key of each table row to\n368        fetch.  String keys will be UTF-8 encoded.\n369      require_all_keys:\n370        Optional; If require_all_keys is True only rows with values set\n371        for all keys will be returned.\n372\n373    Returns:\n374      A dict mapping keys to the corresponding table row data\n375      fetched. Each row is represented as a tuple of strings. For\n376      example:\n377\n378      {b'Serak': ('Rigel VII', 'Preparer'),\n379       b'Zim': ('Irk', 'Invader'),\n380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n381\n382      Returned keys are always bytes.  If a key from the keys argument is\n383      missing from the dictionary, then that row was not found in the\n384      table (and require_all_keys must have been False).\n385\n386    Raises:\n387      IOError: An error occurred accessing the smalltable.\n388    """\n389    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table row to\nfetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only rows with values set\nfor all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n class\n SampleClass:\n\n \n\n
\n \n
392class SampleClass:\n393    """Summary of class here.\n394\n395    Longer class information....\n396    Longer class information....\n397\n398    Attributes:\n399        likes_spam: A boolean indicating if we like SPAM or not.\n400        eggs: An integer count of the eggs we have laid.\n401    """\n402\n403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n407\n408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Summary of class here.

\n\n

Longer class information....\nLonger class information....

\n\n
Attributes:
\n\n
    \n
  • likes_spam: A boolean indicating if we like SPAM or not.
  • \n
  • eggs: An integer count of the eggs we have laid.
  • \n
\n
\n\n\n
\n \n
\n \n SampleClass(likes_spam=False)\n\n \n\n
\n \n
403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n
\n\n\n

Inits SampleClass with blah.

\n
\n\n\n
\n
\n
\n likes_spam\n\n \n
\n \n \n \n\n
\n
\n
\n eggs\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n public_method(self):\n\n \n\n
\n \n
408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Performs operation blah.

\n
\n\n\n
\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
412def invalid_format(test):\n413    """\n414    In this example, there is no colon after the argument and an empty section.\n415\n416    Args:\n417      test\n418        there is a colon missing in the previous line\n419    Returns:\n420\n421    """\n
\n\n\n

In this example, there is no colon after the argument and an empty section.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is a colon missing in the previous line
  • \n
\n\n

Returns:

\n
\n\n\n
\n
\n \n
\n \n def\n example_code():\n\n \n\n
\n \n
424def example_code():\n425    """\n426    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n427\n428    Example:\n429\n430        ```python\n431        tmp = a2()\n432\n433        tmp2 = a()\n434        ```\n435    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/issues/264.

\n\n
Example:
\n\n
\n
\n
tmp = a2()\n\ntmp2 = a()\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n newline_after_args(test: str):\n\n \n\n
\n \n
438def newline_after_args(test: str):\n439    """\n440    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n441\n442    Args:\n443\n444      test\n445        there is unexpected whitespace before test.\n446    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/pull/458.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is unexpected whitespace before test.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n alternative_section_names(test: str):\n\n \n\n
\n \n
449def alternative_section_names(test: str):\n450    """\n451    In this example, we check whether alternative section names aliased to\n452    'Args' are handled properly.\n453\n454    Parameters:\n455        test: the test string\n456    """\n
\n\n\n

In this example, we check whether alternative section names aliased to\n\'Args\' are handled properly.

\n\n
Arguments:
\n\n
    \n
  • test: the test string
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n keyword_arguments(**kwargs):\n\n \n\n
\n \n
458def keyword_arguments(**kwargs):\n459    """\n460    This an example for a function with keyword arguments documented in the docstring.\n461\n462    Args:\n463        **kwargs: A dictionary containing user info.\n464\n465    Keyword Arguments:\n466        str_arg (str): First string argument.\n467        int_arg (int): Second integer argument.\n468    """\n
\n\n\n

This an example for a function with keyword arguments documented in the docstring.

\n\n
Arguments:
\n\n
    \n
  • **kwargs: A dictionary containing user info.
  • \n
\n\n
Keyword Args:
\n\n
    \n
  • str_arg (str): First string argument.
  • \n
  • int_arg (int): Second integer argument.
  • \n
\n
\n\n\n
\n
\n\n' == '\n\n\n \n \n \n flavors_google API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_google

\n\n

Example Google style docstrings.

\n\n

This module demonstrates documentation as specified by the Google Python\nStyle Guide. Docstrings may extend over multiple lines. Sections are created\nwith a section header and a colon followed by a block of indented text.

\n\n
Example:
\n\n
\n

Examples can be given using either the Example or Examples\n sections. Sections support any reStructuredText formatting, including\n literal blocks::

\n\n
$ python example_google.py\n
\n
\n\n

Section breaks are created by resuming unindented text. Section breaks\nare also implicitly created anytime a new section starts.

\n\n
Attributes:
\n\n
    \n
  • module_level_variable1 (int): Module level variables may be documented in\neither the Attributes section of the module docstring, or in an\ninline docstring immediately following the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n\n
Todo:
\n\n
\n
    \n
  • For module TODOs
  • \n
  • You have to also use sphinx.ext.todo extension
  • \n
\n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html\n  4#   License: BSD-3\n  5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html\n  6#   License: CC BY 3.0\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example Google style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `Google Python\n 13Style Guide`_. Docstrings may extend over multiple lines. Sections are created\n 14with a section header and a colon followed by a block of indented text.\n 15\n 16Example:\n 17    Examples can be given using either the ``Example`` or ``Examples``\n 18    sections. Sections support any reStructuredText formatting, including\n 19    literal blocks::\n 20\n 21        $ python example_google.py\n 22\n 23Section breaks are created by resuming unindented text. Section breaks\n 24are also implicitly created anytime a new section starts.\n 25\n 26Attributes:\n 27    module_level_variable1 (int): Module level variables may be documented in\n 28        either the ``Attributes`` section of the module docstring, or in an\n 29        inline docstring immediately following the variable.\n 30\n 31        Either form is acceptable, but the two should not be mixed. Choose\n 32        one convention to document module level variables and be consistent\n 33        with it.\n 34\n 35Todo:\n 36    * For module TODOs\n 37    * You have to also use ``sphinx.ext.todo`` extension\n 38\n 39.. _Google Python Style Guide:\n 40   http://google.github.io/styleguide/pyguide.html\n 41\n 42"""\n 43__docformat__ = "google"\n 44\n 45from typing import Any, Mapping, Sequence, Tuple\n 46\n 47\n 48module_level_variable1 = 12345\n 49\n 50module_level_variable2 = 98765\n 51"""int: Module level variable documented inline.\n 52\n 53The docstring may span multiple lines. The type may optionally be specified\n 54on the first line, separated by a colon.\n 55"""\n 56\n 57\n 58def function_with_types_in_docstring(param1, param2):\n 59    """Example function with types documented in the docstring.\n 60\n 61    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 62    return types are annotated according to `PEP 484`_, they do not need to be\n 63    included in the docstring:\n 64\n 65    Args:\n 66        param1 (int): The first parameter.\n 67        param2 (str): The second parameter.\n 68\n 69    Returns:\n 70        bool: The return value. True for success, False otherwise.\n 71\n 72    .. _PEP 484:\n 73        https://www.python.org/dev/peps/pep-0484/\n 74\n 75    """\n 76\n 77\n 78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 79    """Example function with PEP 484 type annotations.\n 80\n 81    Args:\n 82        param1: The first parameter.\n 83        param2: The second parameter.\n 84\n 85    Returns:\n 86        The return value. True for success, False otherwise.\n 87\n 88    """\n 89    raise NotImplementedError\n 90\n 91\n 92def module_level_function(param1, param2=None, *args, **kwargs):\n 93    """This is an example of a module level function.\n 94\n 95    Function parameters should be documented in the ``Args`` section. The name\n 96    of each parameter is required. The type and description of each parameter\n 97    is optional, but should be included if not obvious.\n 98\n 99    If *args or **kwargs are accepted,\n100    they should be listed as ``*args`` and ``**kwargs``.\n101\n102    The format for a parameter is::\n103\n104        name (type): description\n105            The description may span multiple lines. Following\n106            lines should be indented. The "(type)" is optional.\n107\n108            Multiple paragraphs are supported in parameter\n109            descriptions.\n110\n111    Args:\n112        param1 (int): The first parameter.\n113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n114            Second line of description should be indented.\n115        *args: Variable length argument list.\n116        **kwargs: Arbitrary keyword arguments.\n117\n118    Returns:\n119        bool: True if successful, False otherwise.\n120\n121        The return type is optional and may be specified at the beginning of\n122        the ``Returns`` section followed by a colon.\n123\n124        The ``Returns`` section may span multiple lines and paragraphs.\n125        Following lines should be indented to match the first line.\n126\n127        The ``Returns`` section supports any reStructuredText formatting,\n128        including literal blocks::\n129\n130            {\n131                'param1': param1,\n132                'param2': param2\n133            }\n134\n135    Raises:\n136        AttributeError: The ``Raises`` section is a list of all exceptions\n137            that are relevant to the interface.\n138        ValueError: If `param2` is equal to `param1`.\n139\n140    """\n141    if param1 == param2:\n142        raise ValueError('param1 may not be equal to param2')\n143    return True\n144\n145\n146def example_generator(n):\n147    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n148\n149    Args:\n150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n151\n152    Yields:\n153        int: The next number in the range of 0 to `n` - 1.\n154\n155    Examples:\n156        Examples should be written in doctest format, and should illustrate how\n157        to use the function.\n158\n159        >>> print([i for i in example_generator(4)])\n160        [0, 1, 2, 3]\n161\n162    """\n163    for i in range(n):\n164        yield i\n165\n166\n167class ExampleError(Exception):\n168    """Exceptions are documented in the same way as classes.\n169\n170    The __init__ method may be documented in either the class level\n171    docstring, or as a docstring on the __init__ method itself.\n172\n173    Either form is acceptable, but the two should not be mixed. Choose one\n174    convention to document the __init__ method and be consistent with it.\n175\n176    Note:\n177        Do not include the `self` parameter in the ``Args`` section.\n178\n179    Args:\n180        msg (str): Human readable string describing the exception.\n181        code (:obj:`int`, optional): Error code.\n182\n183    Attributes:\n184        msg (str): Human readable string describing the exception.\n185        code (int): Exception error code.\n186\n187    """\n188\n189    def __init__(self, msg, code):\n190        self.msg = msg\n191        self.code = code\n192\n193    def add_note(self, note: str):\n194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n195\n196    def with_traceback(self, object, /):\n197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n198\n199class ExampleClass(object):\n200    """The summary line for a class docstring should fit on one line.\n201\n202    If the class has public attributes, they may be documented here\n203    in an ``Attributes`` section and follow the same formatting as a\n204    function's ``Args`` section. Alternatively, attributes may be documented\n205    inline with the attribute's declaration (see __init__ method below).\n206\n207    Properties created with the ``@property`` decorator should be documented\n208    in the property's getter method.\n209\n210    Attributes:\n211        attr1 (str): Description of `attr1`.\n212        attr2 (:obj:`int`, optional): Description of `attr2`.\n213\n214    """\n215\n216    def __init__(self, param1, param2, param3):\n217        """Example of docstring on the __init__ method.\n218\n219        The __init__ method may be documented in either the class level\n220        docstring, or as a docstring on the __init__ method itself.\n221\n222        Either form is acceptable, but the two should not be mixed. Choose one\n223        convention to document the __init__ method and be consistent with it.\n224\n225        Note:\n226            Do not include the `self` parameter in the ``Args`` section.\n227\n228        Args:\n229            param1 (str): Description of `param1`.\n230            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n231                lines are supported.\n232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n233\n234        """\n235        self.attr1 = param1\n236        self.attr2 = param2\n237        self.attr3 = param3  #: Doc comment *inline* with attribute\n238\n239        #: list of str: Doc comment *before* attribute, with type specified\n240        self.attr4 = ['attr4']\n241\n242        self.attr5 = None\n243        """str: Docstring *after* attribute, with type specified."""\n244\n245    @property\n246    def readonly_property(self):\n247        """str: Properties should be documented in their getter method."""\n248        return 'readonly_property'\n249\n250    @property\n251    def readwrite_property(self):\n252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n253        should only be documented in their getter method.\n254\n255        If the setter method contains notable behavior, it should be\n256        mentioned here.\n257        """\n258        return ['readwrite_property']\n259\n260    @readwrite_property.setter\n261    def readwrite_property(self, value):\n262        value\n263\n264    def example_method(self, param1, param2):\n265        """Class methods are similar to regular functions.\n266\n267        Note:\n268            Do not include the `self` parameter in the ``Args`` section.\n269\n270        Args:\n271            param1: The first parameter.\n272            param2: The second parameter.\n273\n274        Returns:\n275            True if successful, False otherwise.\n276\n277        """\n278        return True\n279\n280    def __special__(self):\n281        """By default special members with docstrings are not included.\n282\n283        Special members are any methods or attributes that start with and\n284        end with a double underscore. Any special member with a docstring\n285        will be included in the output, if\n286        ``napoleon_include_special_with_doc`` is set to True.\n287\n288        This behavior can be enabled by changing the following setting in\n289        Sphinx's conf.py::\n290\n291            napoleon_include_special_with_doc = True\n292\n293        """\n294        pass\n295\n296    def __special_without_docstring__(self):\n297        pass\n298\n299    def _private(self):\n300        """By default private members are not included.\n301\n302        Private members are any methods or attributes that start with an\n303        underscore and are *not* special. By default they are not included\n304        in the output.\n305\n306        This behavior can be changed such that private members *are* included\n307        by changing the following setting in Sphinx's conf.py::\n308\n309            napoleon_include_private_with_doc = True\n310\n311        """\n312        pass\n313\n314    def _private_without_docstring(self):\n315        pass\n316\n317\n318def fetch_smalltable_rows(table_handle: Any,\n319                          keys: Sequence[str],\n320                          require_all_keys: bool = False,\n321) -> Mapping[bytes, Tuple[str]]:\n322    """Fetches rows from a Smalltable.\n323\n324    Retrieves rows pertaining to the given keys from the Table instance\n325    represented by table_handle.  String keys will be UTF-8 encoded.\n326\n327    Args:\n328        table_handle: An open smalltable.Table instance.\n329        keys: A sequence of strings representing the key of each table\n330          row to fetch.  String keys will be UTF-8 encoded.\n331        require_all_keys: Optional; If require_all_keys is True only\n332          rows with values set for all keys will be returned.\n333\n334    Returns:\n335        A dict mapping keys to the corresponding table row data\n336        fetched. Each row is represented as a tuple of strings. For\n337        example:\n338\n339        {b'Serak': ('Rigel VII', 'Preparer'),\n340         b'Zim': ('Irk', 'Invader'),\n341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n342\n343        Returned keys are always bytes.  If a key from the keys argument is\n344        missing from the dictionary, then that row was not found in the\n345        table (and require_all_keys must have been False).\n346\n347    Raises:\n348        IOError: An error occurred accessing the smalltable.\n349    """\n350    raise NotImplementedError\n351\n352\n353def fetch_smalltable_rows2(table_handle: Any,\n354                          keys: Sequence[str],\n355                          require_all_keys: bool = False,\n356) -> Mapping[bytes, Tuple[str]]:\n357    """Fetches rows from a Smalltable.\n358\n359    Retrieves rows pertaining to the given keys from the Table instance\n360    represented by table_handle.  String keys will be UTF-8 encoded.\n361\n362    Args:\n363      table_handle:\n364        An open smalltable.Table instance.\n365      keys:\n366        A sequence of strings representing the key of each table row to\n367        fetch.  String keys will be UTF-8 encoded.\n368      require_all_keys:\n369        Optional; If require_all_keys is True only rows with values set\n370        for all keys will be returned.\n371\n372    Returns:\n373      A dict mapping keys to the corresponding table row data\n374      fetched. Each row is represented as a tuple of strings. For\n375      example:\n376\n377      {b'Serak': ('Rigel VII', 'Preparer'),\n378       b'Zim': ('Irk', 'Invader'),\n379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n380\n381      Returned keys are always bytes.  If a key from the keys argument is\n382      missing from the dictionary, then that row was not found in the\n383      table (and require_all_keys must have been False).\n384\n385    Raises:\n386      IOError: An error occurred accessing the smalltable.\n387    """\n388    raise NotImplementedError\n389\n390\n391class SampleClass:\n392    """Summary of class here.\n393\n394    Longer class information....\n395    Longer class information....\n396\n397    Attributes:\n398        likes_spam: A boolean indicating if we like SPAM or not.\n399        eggs: An integer count of the eggs we have laid.\n400    """\n401\n402    def __init__(self, likes_spam=False):\n403        """Inits SampleClass with blah."""\n404        self.likes_spam = likes_spam\n405        self.eggs = 0\n406\n407    def public_method(self):\n408        """Performs operation blah."""\n409\n410\n411def invalid_format(test):\n412    """\n413    In this example, there is no colon after the argument and an empty section.\n414\n415    Args:\n416      test\n417        there is a colon missing in the previous line\n418    Returns:\n419\n420    """\n421\n422\n423def example_code():\n424    """\n425    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n426\n427    Example:\n428\n429        ```python\n430        tmp = a2()\n431\n432        tmp2 = a()\n433        ```\n434    """\n435\n436\n437def newline_after_args(test: str):\n438    """\n439    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n440\n441    Args:\n442\n443      test\n444        there is unexpected whitespace before test.\n445    """\n446\n447\n448def alternative_section_names(test: str):\n449    """\n450    In this example, we check whether alternative section names aliased to\n451    'Args' are handled properly.\n452\n453    Parameters:\n454        test: the test string\n455    """\n456\n457def keyword_arguments(**kwargs):\n458    """\n459    This an example for a function with keyword arguments documented in the docstring.\n460\n461    Args:\n462        **kwargs: A dictionary containing user info.\n463\n464    Keyword Arguments:\n465        str_arg (str): First string argument.\n466        int_arg (int): Second integer argument.\n467    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
59def function_with_types_in_docstring(param1, param2):\n60    """Example function with types documented in the docstring.\n61\n62    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n63    return types are annotated according to `PEP 484`_, they do not need to be\n64    included in the docstring:\n65\n66    Args:\n67        param1 (int): The first parameter.\n68        param2 (str): The second parameter.\n69\n70    Returns:\n71        bool: The return value. True for success, False otherwise.\n72\n73    .. _PEP 484:\n74        https://www.python.org/dev/peps/pep-0484/\n75\n76    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str): The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

bool: The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n80    """Example function with PEP 484 type annotations.\n81\n82    Args:\n83        param1: The first parameter.\n84        param2: The second parameter.\n85\n86    Returns:\n87        The return value. True for success, False otherwise.\n88\n89    """\n90    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
 93def module_level_function(param1, param2=None, *args, **kwargs):\n 94    """This is an example of a module level function.\n 95\n 96    Function parameters should be documented in the ``Args`` section. The name\n 97    of each parameter is required. The type and description of each parameter\n 98    is optional, but should be included if not obvious.\n 99\n100    If *args or **kwargs are accepted,\n101    they should be listed as ``*args`` and ``**kwargs``.\n102\n103    The format for a parameter is::\n104\n105        name (type): description\n106            The description may span multiple lines. Following\n107            lines should be indented. The "(type)" is optional.\n108\n109            Multiple paragraphs are supported in parameter\n110            descriptions.\n111\n112    Args:\n113        param1 (int): The first parameter.\n114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n115            Second line of description should be indented.\n116        *args: Variable length argument list.\n117        **kwargs: Arbitrary keyword arguments.\n118\n119    Returns:\n120        bool: True if successful, False otherwise.\n121\n122        The return type is optional and may be specified at the beginning of\n123        the ``Returns`` section followed by a colon.\n124\n125        The ``Returns`` section may span multiple lines and paragraphs.\n126        Following lines should be indented to match the first line.\n127\n128        The ``Returns`` section supports any reStructuredText formatting,\n129        including literal blocks::\n130\n131            {\n132                'param1': param1,\n133                'param2': param2\n134            }\n135\n136    Raises:\n137        AttributeError: The ``Raises`` section is a list of all exceptions\n138            that are relevant to the interface.\n139        ValueError: If `param2` is equal to `param1`.\n140\n141    """\n142    if param1 == param2:\n143        raise ValueError('param1 may not be equal to param2')\n144    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Args section. The name\nof each parameter is required. The type and description of each parameter\nis optional, but should be included if not obvious.

\n\n

If args or *kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name (type): description\n    The description may span multiple lines. Following\n    lines should be indented. The "(type)" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str, optional): The second parameter. Defaults to None.\nSecond line of description should be indented.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns:
\n\n
\n

bool: True if successful, False otherwise.

\n \n

The return type is optional and may be specified at the beginning of\n the Returns section followed by a colon.

\n \n

The Returns section may span multiple lines and paragraphs.\n Following lines should be indented to match the first line.

\n \n

The Returns section supports any reStructuredText formatting,\n including literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n
\n\n
Raises:
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
147def example_generator(n):\n148    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n149\n150    Args:\n151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n152\n153    Yields:\n154        int: The next number in the range of 0 to `n` - 1.\n155\n156    Examples:\n157        Examples should be written in doctest format, and should illustrate how\n158        to use the function.\n159\n160        >>> print([i for i in example_generator(4)])\n161        [0, 1, 2, 3]\n162\n163    """\n164    for i in range(n):\n165        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Arguments:
\n\n
    \n
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields:
\n\n
\n

int: The next number in the range of 0 to n - 1.

\n
\n\n
Examples:
\n\n
\n

Examples should be written in doctest format, and should illustrate how\n to use the function.

\n \n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
168class ExampleError(Exception):\n169    """Exceptions are documented in the same way as classes.\n170\n171    The __init__ method may be documented in either the class level\n172    docstring, or as a docstring on the __init__ method itself.\n173\n174    Either form is acceptable, but the two should not be mixed. Choose one\n175    convention to document the __init__ method and be consistent with it.\n176\n177    Note:\n178        Do not include the `self` parameter in the ``Args`` section.\n179\n180    Args:\n181        msg (str): Human readable string describing the exception.\n182        code (:obj:`int`, optional): Error code.\n183\n184    Attributes:\n185        msg (str): Human readable string describing the exception.\n186        code (int): Exception error code.\n187\n188    """\n189\n190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n193\n194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n196\n197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int, optional): Error code.
  • \n
\n\n
Attributes:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int): Exception error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
200class ExampleClass(object):\n201    """The summary line for a class docstring should fit on one line.\n202\n203    If the class has public attributes, they may be documented here\n204    in an ``Attributes`` section and follow the same formatting as a\n205    function's ``Args`` section. Alternatively, attributes may be documented\n206    inline with the attribute's declaration (see __init__ method below).\n207\n208    Properties created with the ``@property`` decorator should be documented\n209    in the property's getter method.\n210\n211    Attributes:\n212        attr1 (str): Description of `attr1`.\n213        attr2 (:obj:`int`, optional): Description of `attr2`.\n214\n215    """\n216\n217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n245\n246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n250\n251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n260\n261    @readwrite_property.setter\n262    def readwrite_property(self, value):\n263        value\n264\n265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n280\n281    def __special__(self):\n282        """By default special members with docstrings are not included.\n283\n284        Special members are any methods or attributes that start with and\n285        end with a double underscore. Any special member with a docstring\n286        will be included in the output, if\n287        ``napoleon_include_special_with_doc`` is set to True.\n288\n289        This behavior can be enabled by changing the following setting in\n290        Sphinx's conf.py::\n291\n292            napoleon_include_special_with_doc = True\n293\n294        """\n295        pass\n296\n297    def __special_without_docstring__(self):\n298        pass\n299\n300    def _private(self):\n301        """By default private members are not included.\n302\n303        Private members are any methods or attributes that start with an\n304        underscore and are *not* special. By default they are not included\n305        in the output.\n306\n307        This behavior can be changed such that private members *are* included\n308        by changing the following setting in Sphinx's conf.py::\n309\n310            napoleon_include_private_with_doc = True\n311\n312        """\n313        pass\n314\n315    def _private_without_docstring(self):\n316        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes:
\n\n
    \n
  • attr1 (str): Description of attr1.
  • \n
  • attr2 (int, optional): Description of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1 (str): Description of param1.
  • \n
  • param2 (int, optional): Description of param2. Multiple\nlines are supported.
  • \n
  • param3 (list of str): Description of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

True if successful, False otherwise.

\n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n fetch_smalltable_rows(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
319def fetch_smalltable_rows(table_handle: Any,\n320                          keys: Sequence[str],\n321                          require_all_keys: bool = False,\n322) -> Mapping[bytes, Tuple[str]]:\n323    """Fetches rows from a Smalltable.\n324\n325    Retrieves rows pertaining to the given keys from the Table instance\n326    represented by table_handle.  String keys will be UTF-8 encoded.\n327\n328    Args:\n329        table_handle: An open smalltable.Table instance.\n330        keys: A sequence of strings representing the key of each table\n331          row to fetch.  String keys will be UTF-8 encoded.\n332        require_all_keys: Optional; If require_all_keys is True only\n333          rows with values set for all keys will be returned.\n334\n335    Returns:\n336        A dict mapping keys to the corresponding table row data\n337        fetched. Each row is represented as a tuple of strings. For\n338        example:\n339\n340        {b'Serak': ('Rigel VII', 'Preparer'),\n341         b'Zim': ('Irk', 'Invader'),\n342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n343\n344        Returned keys are always bytes.  If a key from the keys argument is\n345        missing from the dictionary, then that row was not found in the\n346        table (and require_all_keys must have been False).\n347\n348    Raises:\n349        IOError: An error occurred accessing the smalltable.\n350    """\n351    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table\nrow to fetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only\nrows with values set for all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n fetch_smalltable_rows2(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
354def fetch_smalltable_rows2(table_handle: Any,\n355                          keys: Sequence[str],\n356                          require_all_keys: bool = False,\n357) -> Mapping[bytes, Tuple[str]]:\n358    """Fetches rows from a Smalltable.\n359\n360    Retrieves rows pertaining to the given keys from the Table instance\n361    represented by table_handle.  String keys will be UTF-8 encoded.\n362\n363    Args:\n364      table_handle:\n365        An open smalltable.Table instance.\n366      keys:\n367        A sequence of strings representing the key of each table row to\n368        fetch.  String keys will be UTF-8 encoded.\n369      require_all_keys:\n370        Optional; If require_all_keys is True only rows with values set\n371        for all keys will be returned.\n372\n373    Returns:\n374      A dict mapping keys to the corresponding table row data\n375      fetched. Each row is represented as a tuple of strings. For\n376      example:\n377\n378      {b'Serak': ('Rigel VII', 'Preparer'),\n379       b'Zim': ('Irk', 'Invader'),\n380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n381\n382      Returned keys are always bytes.  If a key from the keys argument is\n383      missing from the dictionary, then that row was not found in the\n384      table (and require_all_keys must have been False).\n385\n386    Raises:\n387      IOError: An error occurred accessing the smalltable.\n388    """\n389    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table row to\nfetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only rows with values set\nfor all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n class\n SampleClass:\n\n \n\n
\n \n
392class SampleClass:\n393    """Summary of class here.\n394\n395    Longer class information....\n396    Longer class information....\n397\n398    Attributes:\n399        likes_spam: A boolean indicating if we like SPAM or not.\n400        eggs: An integer count of the eggs we have laid.\n401    """\n402\n403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n407\n408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Summary of class here.

\n\n

Longer class information....\nLonger class information....

\n\n
Attributes:
\n\n
    \n
  • likes_spam: A boolean indicating if we like SPAM or not.
  • \n
  • eggs: An integer count of the eggs we have laid.
  • \n
\n
\n\n\n
\n \n
\n \n SampleClass(likes_spam=False)\n\n \n\n
\n \n
403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n
\n\n\n

Inits SampleClass with blah.

\n
\n\n\n
\n
\n
\n likes_spam\n\n \n
\n \n \n \n\n
\n
\n
\n eggs\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n public_method(self):\n\n \n\n
\n \n
408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Performs operation blah.

\n
\n\n\n
\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
412def invalid_format(test):\n413    """\n414    In this example, there is no colon after the argument and an empty section.\n415\n416    Args:\n417      test\n418        there is a colon missing in the previous line\n419    Returns:\n420\n421    """\n
\n\n\n

In this example, there is no colon after the argument and an empty section.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is a colon missing in the previous line
  • \n
\n\n

Returns:

\n
\n\n\n
\n
\n \n
\n \n def\n example_code():\n\n \n\n
\n \n
424def example_code():\n425    """\n426    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n427\n428    Example:\n429\n430        ```python\n431        tmp = a2()\n432\n433        tmp2 = a()\n434        ```\n435    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/issues/264.

\n\n
Example:
\n\n
\n
\n
tmp = a2()\n\ntmp2 = a()\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n newline_after_args(test: str):\n\n \n\n
\n \n
438def newline_after_args(test: str):\n439    """\n440    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n441\n442    Args:\n443\n444      test\n445        there is unexpected whitespace before test.\n446    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/pull/458.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is unexpected whitespace before test.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n alternative_section_names(test: str):\n\n \n\n
\n \n
449def alternative_section_names(test: str):\n450    """\n451    In this example, we check whether alternative section names aliased to\n452    'Args' are handled properly.\n453\n454    Parameters:\n455        test: the test string\n456    """\n
\n\n\n

In this example, we check whether alternative section names aliased to\n\'Args\' are handled properly.

\n\n
Arguments:
\n\n
    \n
  • test: the test string
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n keyword_arguments(**kwargs):\n\n \n\n
\n \n
458def keyword_arguments(**kwargs):\n459    """\n460    This an example for a function with keyword arguments documented in the docstring.\n461\n462    Args:\n463        **kwargs: A dictionary containing user info.\n464\n465    Keyword Arguments:\n466        str_arg (str): First string argument.\n467        int_arg (int): Second integer argument.\n468    """\n
\n\n\n

This an example for a function with keyword arguments documented in the docstring.

\n\n
Arguments:
\n\n
    \n
  • **kwargs: A dictionary containing user info.
  • \n
\n\n
Keyword Args:
\n\n
    \n
  • str_arg (str): First string argument.
  • \n
  • int_arg (int): Second integer argument.
  • \n
\n
\n\n\n
\n
\n\n' E E E E E E E E flavors_google API documentation E E E E E E E E E E
E
E

E flavors_google

E E

Example Google style docstrings.

E E

This module demonstrates documentation as specified by the Google Python E Style Guide. Docstrings may extend over multiple lines. Sections are created E with a section header and a colon followed by a block of indented text.

E E
Example:
E E
E

Examples can be given using either the Example or Examples E sections. Sections support any reStructuredText formatting, including E literal blocks::

E E
$ python example_google.py
E           
E
E E

Section breaks are created by resuming unindented text. Section breaks E are also implicitly created anytime a new section starts.

E E
Attributes:
E E
    E
  • module_level_variable1 (int): Module level variables may be documented in E either the Attributes section of the module docstring, or in an E inline docstring immediately following the variable.

    E E

    Either form is acceptable, but the two should not be mixed. Choose E one convention to document module level variables and be consistent E with it.

  • E
E E
Todo:
E E
E
    E
  • For module TODOs
  • E
  • You have to also use sphinx.ext.todo extension
  • E
E
E
E E E E E E
  1# Examples taken from:
E             2#
E             3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
E             4#   License: BSD-3
E             5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html
E             6#   License: CC BY 3.0
E             7#
E             8# flake8: noqa
E             9# fmt: off
E            10"""Example Google style docstrings.
E            11
E            12This module demonstrates documentation as specified by the `Google Python
E            13Style Guide`_. Docstrings may extend over multiple lines. Sections are created
E            14with a section header and a colon followed by a block of indented text.
E            15
E            16Example:
E            17    Examples can be given using either the ``Example`` or ``Examples``
E            18    sections. Sections support any reStructuredText formatting, including
E            19    literal blocks::
E            20
E            21        $ python example_google.py
E            22
E            23Section breaks are created by resuming unindented text. Section breaks
E            24are also implicitly created anytime a new section starts.
E            25
E            26Attributes:
E            27    module_level_variable1 (int): Module level variables may be documented in
E            28        either the ``Attributes`` section of the module docstring, or in an
E            29        inline docstring immediately following the variable.
E            30
E            31        Either form is acceptable, but the two should not be mixed. Choose
E            32        one convention to document module level variables and be consistent
E            33        with it.
E            34
E            35Todo:
E            36    * For module TODOs
E            37    * You have to also use ``sphinx.ext.todo`` extension
E            38
E            39.. _Google Python Style Guide:
E            40   http://google.github.io/styleguide/pyguide.html
E            41
E            42"""
E            43__docformat__ = "google"
E            44
E            45from typing import Any, Mapping, Sequence, Tuple
E            46
E            47
E            48module_level_variable1 = 12345
E            49
E            50module_level_variable2 = 98765
E            51"""int: Module level variable documented inline.
E            52
E            53The docstring may span multiple lines. The type may optionally be specified
E            54on the first line, separated by a colon.
E            55"""
E            56
E            57
E            58def function_with_types_in_docstring(param1, param2):
E            59    """Example function with types documented in the docstring.
E            60
E            61    `PEP 484`_ type annotations are supported. If attribute, parameter, and
E            62    return types are annotated according to `PEP 484`_, they do not need to be
E            63    included in the docstring:
E            64
E            65    Args:
E            66        param1 (int): The first parameter.
E            67        param2 (str): The second parameter.
E            68
E            69    Returns:
E            70        bool: The return value. True for success, False otherwise.
E            71
E            72    .. _PEP 484:
E            73        https://www.python.org/dev/peps/pep-0484/
E            74
E            75    """
E            76
E            77
E            78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
E            79    """Example function with PEP 484 type annotations.
E            80
E            81    Args:
E            82        param1: The first parameter.
E            83        param2: The second parameter.
E            84
E            85    Returns:
E            86        The return value. True for success, False otherwise.
E            87
E            88    """
E            89    raise NotImplementedError
E            90
E            91
E            92def module_level_function(param1, param2=None, *args, **kwargs):
E            93    """This is an example of a module level function.
E            94
E            95    Function parameters should be documented in the ``Args`` section. The name
E            96    of each parameter is required. The type and description of each parameter
E            97    is optional, but should be included if not obvious.
E            98
E            99    If *args or **kwargs are accepted,
E           100    they should be listed as ``*args`` and ``**kwargs``.
E           101
E           102    The format for a parameter is::
E           103
E           104        name (type): description
E           105            The description may span multiple lines. Following
E           106            lines should be indented. The "(type)" is optional.
E           107
E           108            Multiple paragraphs are supported in parameter
E           109            descriptions.
E           110
E           111    Args:
E           112        param1 (int): The first parameter.
E           113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
E           114            Second line of description should be indented.
E           115        *args: Variable length argument list.
E           116        **kwargs: Arbitrary keyword arguments.
E           117
E           118    Returns:
E           119        bool: True if successful, False otherwise.
E           120
E           121        The return type is optional and may be specified at the beginning of
E           122        the ``Returns`` section followed by a colon.
E           123
E           124        The ``Returns`` section may span multiple lines and paragraphs.
E           125        Following lines should be indented to match the first line.
E           126
E           127        The ``Returns`` section supports any reStructuredText formatting,
E           128        including literal blocks::
E           129
E           130            {
E           131                'param1': param1,
E           132                'param2': param2
E           133            }
E           134
E           135    Raises:
E           136        AttributeError: The ``Raises`` section is a list of all exceptions
E           137            that are relevant to the interface.
E           138        ValueError: If `param2` is equal to `param1`.
E           139
E           140    """
E           141    if param1 == param2:
E           142        raise ValueError('param1 may not be equal to param2')
E           143    return True
E           144
E           145
E           146def example_generator(n):
E           147    """Generators have a ``Yields`` section instead of a ``Returns`` section.
E           148
E           149    Args:
E           150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.
E           151
E           152    Yields:
E           153        int: The next number in the range of 0 to `n` - 1.
E           154
E           155    Examples:
E           156        Examples should be written in doctest format, and should illustrate how
E           157        to use the function.
E           158
E           159        >>> print([i for i in example_generator(4)])
E           160        [0, 1, 2, 3]
E           161
E           162    """
E           163    for i in range(n):
E           164        yield i
E           165
E           166
E           167class ExampleError(Exception):
E           168    """Exceptions are documented in the same way as classes.
E           169
E           170    The __init__ method may be documented in either the class level
E           171    docstring, or as a docstring on the __init__ method itself.
E           172
E           173    Either form is acceptable, but the two should not be mixed. Choose one
E           174    convention to document the __init__ method and be consistent with it.
E           175
E           176    Note:
E           177        Do not include the `self` parameter in the ``Args`` section.
E           178
E           179    Args:
E           180        msg (str): Human readable string describing the exception.
E           181        code (:obj:`int`, optional): Error code.
E           182
E           183    Attributes:
E           184        msg (str): Human readable string describing the exception.
E           185        code (int): Exception error code.
E           186
E           187    """
E           188
E           189    def __init__(self, msg, code):
E           190        self.msg = msg
E           191        self.code = code
E           192
E           193    def add_note(self, note: str):
E           194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           195
E           196    def with_traceback(self, object, /):
E           197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           198
E           199class ExampleClass(object):
E           200    """The summary line for a class docstring should fit on one line.
E           201
E           202    If the class has public attributes, they may be documented here
E           203    in an ``Attributes`` section and follow the same formatting as a
E           204    function's ``Args`` section. Alternatively, attributes may be documented
E           205    inline with the attribute's declaration (see __init__ method below).
E           206
E           207    Properties created with the ``@property`` decorator should be documented
E           208    in the property's getter method.
E           209
E           210    Attributes:
E           211        attr1 (str): Description of `attr1`.
E           212        attr2 (:obj:`int`, optional): Description of `attr2`.
E           213
E           214    """
E           215
E           216    def __init__(self, param1, param2, param3):
E           217        """Example of docstring on the __init__ method.
E           218
E           219        The __init__ method may be documented in either the class level
E           220        docstring, or as a docstring on the __init__ method itself.
E           221
E           222        Either form is acceptable, but the two should not be mixed. Choose one
E           223        convention to document the __init__ method and be consistent with it.
E           224
E           225        Note:
E           226            Do not include the `self` parameter in the ``Args`` section.
E           227
E           228        Args:
E           229            param1 (str): Description of `param1`.
E           230            param2 (:obj:`int`, optional): Description of `param2`. Multiple
E           231                lines are supported.
E           232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
E           233
E           234        """
E           235        self.attr1 = param1
E           236        self.attr2 = param2
E           237        self.attr3 = param3  #: Doc comment *inline* with attribute
E           238
E           239        #: list of str: Doc comment *before* attribute, with type specified
E           240        self.attr4 = ['attr4']
E           241
E           242        self.attr5 = None
E           243        """str: Docstring *after* attribute, with type specified."""
E           244
E           245    @property
E           246    def readonly_property(self):
E           247        """str: Properties should be documented in their getter method."""
E           248        return 'readonly_property'
E           249
E           250    @property
E           251    def readwrite_property(self):
E           252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           253        should only be documented in their getter method.
E           254
E           255        If the setter method contains notable behavior, it should be
E           256        mentioned here.
E           257        """
E           258        return ['readwrite_property']
E           259
E           260    @readwrite_property.setter
E           261    def readwrite_property(self, value):
E           262        value
E           263
E           264    def example_method(self, param1, param2):
E           265        """Class methods are similar to regular functions.
E           266
E           267        Note:
E           268            Do not include the `self` parameter in the ``Args`` section.
E           269
E           270        Args:
E           271            param1: The first parameter.
E           272            param2: The second parameter.
E           273
E           274        Returns:
E           275            True if successful, False otherwise.
E           276
E           277        """
E           278        return True
E           279
E           280    def __special__(self):
E           281        """By default special members with docstrings are not included.
E           282
E           283        Special members are any methods or attributes that start with and
E           284        end with a double underscore. Any special member with a docstring
E           285        will be included in the output, if
E           286        ``napoleon_include_special_with_doc`` is set to True.
E           287
E           288        This behavior can be enabled by changing the following setting in
E           289        Sphinx's conf.py::
E           290
E           291            napoleon_include_special_with_doc = True
E           292
E           293        """
E           294        pass
E           295
E           296    def __special_without_docstring__(self):
E           297        pass
E           298
E           299    def _private(self):
E           300        """By default private members are not included.
E           301
E           302        Private members are any methods or attributes that start with an
E           303        underscore and are *not* special. By default they are not included
E           304        in the output.
E           305
E           306        This behavior can be changed such that private members *are* included
E           307        by changing the following setting in Sphinx's conf.py::
E           308
E           309            napoleon_include_private_with_doc = True
E           310
E           311        """
E           312        pass
E           313
E           314    def _private_without_docstring(self):
E           315        pass
E           316
E           317
E           318def fetch_smalltable_rows(table_handle: Any,
E           319                          keys: Sequence[str],
E           320                          require_all_keys: bool = False,
E           321) -> Mapping[bytes, Tuple[str]]:
E           322    """Fetches rows from a Smalltable.
E           323
E           324    Retrieves rows pertaining to the given keys from the Table instance
E           325    represented by table_handle.  String keys will be UTF-8 encoded.
E           326
E           327    Args:
E           328        table_handle: An open smalltable.Table instance.
E           329        keys: A sequence of strings representing the key of each table
E           330          row to fetch.  String keys will be UTF-8 encoded.
E           331        require_all_keys: Optional; If require_all_keys is True only
E           332          rows with values set for all keys will be returned.
E           333
E           334    Returns:
E           335        A dict mapping keys to the corresponding table row data
E           336        fetched. Each row is represented as a tuple of strings. For
E           337        example:
E           338
E           339        {b'Serak': ('Rigel VII', 'Preparer'),
E           340         b'Zim': ('Irk', 'Invader'),
E           341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}
E           342
E           343        Returned keys are always bytes.  If a key from the keys argument is
E           344        missing from the dictionary, then that row was not found in the
E           345        table (and require_all_keys must have been False).
E           346
E           347    Raises:
E           348        IOError: An error occurred accessing the smalltable.
E           349    """
E           350    raise NotImplementedError
E           351
E           352
E           353def fetch_smalltable_rows2(table_handle: Any,
E           354                          keys: Sequence[str],
E           355                          require_all_keys: bool = False,
E           356) -> Mapping[bytes, Tuple[str]]:
E           357    """Fetches rows from a Smalltable.
E           358
E           359    Retrieves rows pertaining to the given keys from the Table instance
E           360    represented by table_handle.  String keys will be UTF-8 encoded.
E           361
E           362    Args:
E           363      table_handle:
E           364        An open smalltable.Table instance.
E           365      keys:
E           366        A sequence of strings representing the key of each table row to
E           367        fetch.  String keys will be UTF-8 encoded.
E           368      require_all_keys:
E           369        Optional; If require_all_keys is True only rows with values set
E           370        for all keys will be returned.
E           371
E           372    Returns:
E           373      A dict mapping keys to the corresponding table row data
E           374      fetched. Each row is represented as a tuple of strings. For
E           375      example:
E           376
E           377      {b'Serak': ('Rigel VII', 'Preparer'),
E           378       b'Zim': ('Irk', 'Invader'),
E           379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}
E           380
E           381      Returned keys are always bytes.  If a key from the keys argument is
E           382      missing from the dictionary, then that row was not found in the
E           383      table (and require_all_keys must have been False).
E           384
E           385    Raises:
E           386      IOError: An error occurred accessing the smalltable.
E           387    """
E           388    raise NotImplementedError
E           389
E           390
E           391class SampleClass:
E           392    """Summary of class here.
E           393
E           394    Longer class information....
E           395    Longer class information....
E           396
E           397    Attributes:
E           398        likes_spam: A boolean indicating if we like SPAM or not.
E           399        eggs: An integer count of the eggs we have laid.
E           400    """
E           401
E           402    def __init__(self, likes_spam=False):
E           403        """Inits SampleClass with blah."""
E           404        self.likes_spam = likes_spam
E           405        self.eggs = 0
E           406
E           407    def public_method(self):
E           408        """Performs operation blah."""
E           409
E           410
E           411def invalid_format(test):
E           412    """
E           413    In this example, there is no colon after the argument and an empty section.
E           414
E           415    Args:
E           416      test
E           417        there is a colon missing in the previous line
E           418    Returns:
E           419
E           420    """
E           421
E           422
E           423def example_code():
E           424    """
E           425    Test case for https://github.com/mitmproxy/pdoc/issues/264.
E           426
E           427    Example:
E           428
E           429        ```python
E           430        tmp = a2()
E           431
E           432        tmp2 = a()
E           433        ```
E           434    """
E           435
E           436
E           437def newline_after_args(test: str):
E           438    """
E           439    Test case for https://github.com/mitmproxy/pdoc/pull/458.
E           440
E           441    Args:
E           442
E           443      test
E           444        there is unexpected whitespace before test.
E           445    """
E           446
E           447
E           448def alternative_section_names(test: str):
E           449    """
E           450    In this example, we check whether alternative section names aliased to
E           451    'Args' are handled properly.
E           452
E           453    Parameters:
E           454        test: the test string
E           455    """
E           456
E           457def keyword_arguments(**kwargs):
E           458    """
E           459    This an example for a function with keyword arguments documented in the docstring.
E           460
E           461    Args:
E           462        **kwargs: A dictionary containing user info.
E           463
E           464    Keyword Arguments:
E           465        str_arg (str): First string argument.
E           466        int_arg (int): Second integer argument.
E           467    """
E           
E E E
E
E
E module_level_variable1 = E 12345 E E E
E E E E E
E
E
E module_level_variable2 = E 98765 E E E
E E E

int: Module level variable documented inline.

E E

The docstring may span multiple lines. The type may optionally be specified E on the first line, separated by a colon.

E
E E E
E
E E
E E def E function_with_types_in_docstring(param1, param2): E E E E
E E
59def function_with_types_in_docstring(param1, param2):
E           60    """Example function with types documented in the docstring.
E           61
E           62    `PEP 484`_ type annotations are supported. If attribute, parameter, and
E           63    return types are annotated according to `PEP 484`_, they do not need to be
E           64    included in the docstring:
E           65
E           66    Args:
E           67        param1 (int): The first parameter.
E           68        param2 (str): The second parameter.
E           69
E           70    Returns:
E           71        bool: The return value. True for success, False otherwise.
E           72
E           73    .. _PEP 484:
E           74        https://www.python.org/dev/peps/pep-0484/
E           75
E           76    """
E           
E E E

Example function with types documented in the docstring.

E E

PEP 484 type annotations are supported. If attribute, parameter, and E return types are annotated according to PEP 484, they do not need to be E included in the docstring:

E E
Arguments:
E E
    E
  • param1 (int): The first parameter.
  • E
  • param2 (str): The second parameter.
  • E
E E
Returns:
E E
E

bool: The return value. True for success, False otherwise.

E
E
E E E
E
E E
E E def E function_with_pep484_type_annotations(param1: int, param2: str) -> bool: E E E E
E E
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
E           80    """Example function with PEP 484 type annotations.
E           81
E           82    Args:
E           83        param1: The first parameter.
E           84        param2: The second parameter.
E           85
E           86    Returns:
E           87        The return value. True for success, False otherwise.
E           88
E           89    """
E           90    raise NotImplementedError
E           
E E E

Example function with PEP 484 type annotations.

E E
Arguments:
E E
    E
  • param1: The first parameter.
  • E
  • param2: The second parameter.
  • E
E E
Returns:
E E
E

The return value. True for success, False otherwise.

E
E
E E E
E
E E
E E def E module_level_function(param1, param2=None, *args, **kwargs): E E E E
E E
 93def module_level_function(param1, param2=None, *args, **kwargs):
E            94    """This is an example of a module level function.
E            95
E            96    Function parameters should be documented in the ``Args`` section. The name
E            97    of each parameter is required. The type and description of each parameter
E            98    is optional, but should be included if not obvious.
E            99
E           100    If *args or **kwargs are accepted,
E           101    they should be listed as ``*args`` and ``**kwargs``.
E           102
E           103    The format for a parameter is::
E           104
E           105        name (type): description
E           106            The description may span multiple lines. Following
E           107            lines should be indented. The "(type)" is optional.
E           108
E           109            Multiple paragraphs are supported in parameter
E           110            descriptions.
E           111
E           112    Args:
E           113        param1 (int): The first parameter.
E           114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
E           115            Second line of description should be indented.
E           116        *args: Variable length argument list.
E           117        **kwargs: Arbitrary keyword arguments.
E           118
E           119    Returns:
E           120        bool: True if successful, False otherwise.
E           121
E           122        The return type is optional and may be specified at the beginning of
E           123        the ``Returns`` section followed by a colon.
E           124
E           125        The ``Returns`` section may span multiple lines and paragraphs.
E           126        Following lines should be indented to match the first line.
E           127
E           128        The ``Returns`` section supports any reStructuredText formatting,
E           129        including literal blocks::
E           130
E           131            {
E           132                'param1': param1,
E           133                'param2': param2
E           134            }
E           135
E           136    Raises:
E           137        AttributeError: The ``Raises`` section is a list of all exceptions
E           138            that are relevant to the interface.
E           139        ValueError: If `param2` is equal to `param1`.
E           140
E           141    """
E           142    if param1 == param2:
E           143        raise ValueError('param1 may not be equal to param2')
E           144    return True
E           
E E E

This is an example of a module level function.

E E

Function parameters should be documented in the Args section. The name E of each parameter is required. The type and description of each parameter E is optional, but should be included if not obvious.

E E -

If args or *kwargs are accepted, E ? ^^^^ ^^^^^ E +

If *args or **kwargs are accepted, E ? ^ ^ E they should be listed as *args and **kwargs.

E E

The format for a parameter is::

E E
name (type): description
E               The description may span multiple lines. Following
E               lines should be indented. The "(type)" is optional.
E           
E               Multiple paragraphs are supported in parameter
E               descriptions.
E           
E E
Arguments:
E E
    E
  • param1 (int): The first parameter.
  • E
  • param2 (str, optional): The second parameter. Defaults to None. E Second line of description should be indented.
  • E -
  • *args: Variable length argument list.
  • E ? - E +
  • *args: Variable length argument list.
  • E ? + E -
  • **kwargs: Arbitrary keyword arguments.
  • E ? -- E +
  • **kwargs: Arbitrary keyword arguments.
  • E ? ++ E
E E
Returns:
E E
E

bool: True if successful, False otherwise.

E E

The return type is optional and may be specified at the beginning of E the Returns section followed by a colon.

E E

The Returns section may span multiple lines and paragraphs. E Following lines should be indented to match the first line.

E E

The Returns section supports any reStructuredText formatting, E including literal blocks::

E E
{
E               'param1': param1,
E               'param2': param2
E           }
E           
E
E E
Raises:
E E
    E
  • AttributeError: The Raises section is a list of all exceptions E that are relevant to the interface.
  • E
  • ValueError: If param2 is equal to param1.
  • E
E
E E E
E
E E
E E def E example_generator(n): E E E E
E E
147def example_generator(n):
E           148    """Generators have a ``Yields`` section instead of a ``Returns`` section.
E           149
E           150    Args:
E           151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.
E           152
E           153    Yields:
E           154        int: The next number in the range of 0 to `n` - 1.
E           155
E           156    Examples:
E           157        Examples should be written in doctest format, and should illustrate how
E           158        to use the function.
E           159
E           160        >>> print([i for i in example_generator(4)])
E           161        [0, 1, 2, 3]
E           162
E           163    """
E           164    for i in range(n):
E           165        yield i
E           
E E E

Generators have a Yields section instead of a Returns section.

E E
Arguments:
E E
    E
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
  • E
E E
Yields:
E E
E

int: The next number in the range of 0 to n - 1.

E
E E
Examples:
E E
E

Examples should be written in doctest format, and should illustrate how E to use the function.

E E
E
>>> print([i for i in example_generator(4)])
E           [0, 1, 2, 3]
E           
E
E
E
E E E
E
E E
E E class E ExampleError(builtins.Exception): E E E E
E E
168class ExampleError(Exception):
E           169    """Exceptions are documented in the same way as classes.
E           170
E           171    The __init__ method may be documented in either the class level
E           172    docstring, or as a docstring on the __init__ method itself.
E           173
E           174    Either form is acceptable, but the two should not be mixed. Choose one
E           175    convention to document the __init__ method and be consistent with it.
E           176
E           177    Note:
E           178        Do not include the `self` parameter in the ``Args`` section.
E           179
E           180    Args:
E           181        msg (str): Human readable string describing the exception.
E           182        code (:obj:`int`, optional): Error code.
E           183
E           184    Attributes:
E           185        msg (str): Human readable string describing the exception.
E           186        code (int): Exception error code.
E           187
E           188    """
E           189
E           190    def __init__(self, msg, code):
E           191        self.msg = msg
E           192        self.code = code
E           193
E           194    def add_note(self, note: str):
E           195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           196
E           197    def with_traceback(self, object, /):
E           198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           
E E E

Exceptions are documented in the same way as classes.

E E

The __init__ method may be documented in either the class level E docstring, or as a docstring on the __init__ method itself.

E E

Either form is acceptable, but the two should not be mixed. Choose one E convention to document the __init__ method and be consistent with it.

E E
Note:
E E
E

Do not include the self parameter in the Args section.

E
E E
Arguments:
E E
    E
  • msg (str): Human readable string describing the exception.
  • E
  • code (int, optional): Error code.
  • E
E E
Attributes:
E E
    E
  • msg (str): Human readable string describing the exception.
  • E
  • code (int): Exception error code.
  • E
E
E E E
E E
E E ExampleError(msg, code) E E E E
E E
190    def __init__(self, msg, code):
E           191        self.msg = msg
E           192        self.code = code
E           
E E E E E
E
E
E msg E E E
E E E E E
E
E
E code E E E
E E E E E
E
E E
E E def E add_note(self, note: str): E E E E
E E
194    def add_note(self, note: str):
E           195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           
E E E

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

E
E E E
E
E E
E E def E with_traceback(self, object, /): E E E E
E E
197    def with_traceback(self, object, /):
E           198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           
E E E

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

E
E E E
E
E
E E
E E class E ExampleClass: E E E E
E E
200class ExampleClass(object):
E           201    """The summary line for a class docstring should fit on one line.
E           202
E           203    If the class has public attributes, they may be documented here
E           204    in an ``Attributes`` section and follow the same formatting as a
E           205    function's ``Args`` section. Alternatively, attributes may be documented
E           206    inline with the attribute's declaration (see __init__ method below).
E           207
E           208    Properties created with the ``@property`` decorator should be documented
E           209    in the property's getter method.
E           210
E           211    Attributes:
E           212        attr1 (str): Description of `attr1`.
E           213        attr2 (:obj:`int`, optional): Description of `attr2`.
E           214
E           215    """
E           216
E           217    def __init__(self, param1, param2, param3):
E           218        """Example of docstring on the __init__ method.
E           219
E           220        The __init__ method may be documented in either the class level
E           221        docstring, or as a docstring on the __init__ method itself.
E           222
E           223        Either form is acceptable, but the two should not be mixed. Choose one
E           224        convention to document the __init__ method and be consistent with it.
E           225
E           226        Note:
E           227            Do not include the `self` parameter in the ``Args`` section.
E           228
E           229        Args:
E           230            param1 (str): Description of `param1`.
E           231            param2 (:obj:`int`, optional): Description of `param2`. Multiple
E           232                lines are supported.
E           233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
E           234
E           235        """
E           236        self.attr1 = param1
E           237        self.attr2 = param2
E           238        self.attr3 = param3  #: Doc comment *inline* with attribute
E           239
E           240        #: list of str: Doc comment *before* attribute, with type specified
E           241        self.attr4 = ['attr4']
E           242
E           243        self.attr5 = None
E           244        """str: Docstring *after* attribute, with type specified."""
E           245
E           246    @property
E           247    def readonly_property(self):
E           248        """str: Properties should be documented in their getter method."""
E           249        return 'readonly_property'
E           250
E           251    @property
E           252    def readwrite_property(self):
E           253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           254        should only be documented in their getter method.
E           255
E           256        If the setter method contains notable behavior, it should be
E           257        mentioned here.
E           258        """
E           259        return ['readwrite_property']
E           260
E           261    @readwrite_property.setter
E           262    def readwrite_property(self, value):
E           263        value
E           264
E           265    def example_method(self, param1, param2):
E           266        """Class methods are similar to regular functions.
E           267
E           268        Note:
E           269            Do not include the `self` parameter in the ``Args`` section.
E           270
E           271        Args:
E           272            param1: The first parameter.
E           273            param2: The second parameter.
E           274
E           275        Returns:
E           276            True if successful, False otherwise.
E           277
E           278        """
E           279        return True
E           280
E           281    def __special__(self):
E           282        """By default special members with docstrings are not included.
E           283
E           284        Special members are any methods or attributes that start with and
E           285        end with a double underscore. Any special member with a docstring
E           286        will be included in the output, if
E           287        ``napoleon_include_special_with_doc`` is set to True.
E           288
E           289        This behavior can be enabled by changing the following setting in
E           290        Sphinx's conf.py::
E           291
E           292            napoleon_include_special_with_doc = True
E           293
E           294        """
E           295        pass
E           296
E           297    def __special_without_docstring__(self):
E           298        pass
E           299
E           300    def _private(self):
E           301        """By default private members are not included.
E           302
E           303        Private members are any methods or attributes that start with an
E           304        underscore and are *not* special. By default they are not included
E           305        in the output.
E           306
E           307        This behavior can be changed such that private members *are* included
E           308        by changing the following setting in Sphinx's conf.py::
E           309
E           310            napoleon_include_private_with_doc = True
E           311
E           312        """
E           313        pass
E           314
E           315    def _private_without_docstring(self):
E           316        pass
E           
E E E

The summary line for a class docstring should fit on one line.

E E

If the class has public attributes, they may be documented here E in an Attributes section and follow the same formatting as a E function's Args section. Alternatively, attributes may be documented E inline with the attribute's declaration (see __init__ method below).

E E

Properties created with the @property decorator should be documented E in the property's getter method.

E E
Attributes:
E E
    E
  • attr1 (str): Description of attr1.
  • E
  • attr2 (int, optional): Description of attr2.
  • E
E
E E E
E E
E E ExampleClass(param1, param2, param3) E E E E
E E
217    def __init__(self, param1, param2, param3):
E           218        """Example of docstring on the __init__ method.
E           219
E           220        The __init__ method may be documented in either the class level
E           221        docstring, or as a docstring on the __init__ method itself.
E           222
E           223        Either form is acceptable, but the two should not be mixed. Choose one
E           224        convention to document the __init__ method and be consistent with it.
E           225
E           226        Note:
E           227            Do not include the `self` parameter in the ``Args`` section.
E           228
E           229        Args:
E           230            param1 (str): Description of `param1`.
E           231            param2 (:obj:`int`, optional): Description of `param2`. Multiple
E           232                lines are supported.
E           233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
E           234
E           235        """
E           236        self.attr1 = param1
E           237        self.attr2 = param2
E           238        self.attr3 = param3  #: Doc comment *inline* with attribute
E           239
E           240        #: list of str: Doc comment *before* attribute, with type specified
E           241        self.attr4 = ['attr4']
E           242
E           243        self.attr5 = None
E           244        """str: Docstring *after* attribute, with type specified."""
E           
E E E

Example of docstring on the __init__ method.

E E

The __init__ method may be documented in either the class level E docstring, or as a docstring on the __init__ method itself.

E E

Either form is acceptable, but the two should not be mixed. Choose one E convention to document the __init__ method and be consistent with it.

E E
Note:
E E
E

Do not include the self parameter in the Args section.

E
E E
Arguments:
E E
    E
  • param1 (str): Description of param1.
  • E
  • param2 (int, optional): Description of param2. Multiple E lines are supported.
  • E
  • param3 (list of str): Description of param3.
  • E
E
E E E
E
E
E attr1 E E E
E E E E E
E
E
E attr2 E E E
E E E E E
E
E
E attr3 E E E
E E E E E
E
E
E attr4 E E E
E E E E E
E
E
E attr5 E E E
E E E

str: Docstring after attribute, with type specified.

E
E E E
E
E E
E readonly_property E E E E
E E
246    @property
E           247    def readonly_property(self):
E           248        """str: Properties should be documented in their getter method."""
E           249        return 'readonly_property'
E           
E E E

str: Properties should be documented in their getter method.

E
E E E
E
E E
E readwrite_property E E E E
E E
251    @property
E           252    def readwrite_property(self):
E           253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           254        should only be documented in their getter method.
E           255
E           256        If the setter method contains notable behavior, it should be
E           257        mentioned here.
E           258        """
E           259        return ['readwrite_property']
E           
E E E

list of str: Properties with both a getter and setter E should only be documented in their getter method.

E E

If the setter method contains notable behavior, it should be E mentioned here.

E
E E E
E
E E
E E def E example_method(self, param1, param2): E E E E
E E
265    def example_method(self, param1, param2):
E           266        """Class methods are similar to regular functions.
E           267
E           268        Note:
E           269            Do not include the `self` parameter in the ``Args`` section.
E           270
E           271        Args:
E           272            param1: The first parameter.
E           273            param2: The second parameter.
E           274
E           275        Returns:
E           276            True if successful, False otherwise.
E           277
E           278        """
E           279        return True
E           
E E E

Class methods are similar to regular functions.

E E
Note:
E E
E

Do not include the self parameter in the Args section.

E
E E
Arguments:
E E
    E
  • param1: The first parameter.
  • E
  • param2: The second parameter.
  • E
E E
Returns:
E E
E

True if successful, False otherwise.

E
E
E E E
E
E
E E
E E def E fetch_smalltable_rows( table_handle: Any, keys: Sequence[str], require_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]: E E E E
E E
319def fetch_smalltable_rows(table_handle: Any,
E           320                          keys: Sequence[str],
E           321                          require_all_keys: bool = False,
E           322) -> Mapping[bytes, Tuple[str]]:
E           323    """Fetches rows from a Smalltable.
E           324
E           325    Retrieves rows pertaining to the given keys from the Table instance
E           326    represented by table_handle.  String keys will be UTF-8 encoded.
E           327
E           328    Args:
E           329        table_handle: An open smalltable.Table instance.
E           330        keys: A sequence of strings representing the key of each table
E           331          row to fetch.  String keys will be UTF-8 encoded.
E           332        require_all_keys: Optional; If require_all_keys is True only
E           333          rows with values set for all keys will be returned.
E           334
E           335    Returns:
E           336        A dict mapping keys to the corresponding table row data
E           337        fetched. Each row is represented as a tuple of strings. For
E           338        example:
E           339
E           340        {b'Serak': ('Rigel VII', 'Preparer'),
E           341         b'Zim': ('Irk', 'Invader'),
E           342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}
E           343
E           344        Returned keys are always bytes.  If a key from the keys argument is
E           345        missing from the dictionary, then that row was not found in the
E           346        table (and require_all_keys must have been False).
E           347
E           348    Raises:
E           349        IOError: An error occurred accessing the smalltable.
E           350    """
E           351    raise NotImplementedError
E           
E E E

Fetches rows from a Smalltable.

E E

Retrieves rows pertaining to the given keys from the Table instance E represented by table_handle. String keys will be UTF-8 encoded.

E E
Arguments:
E E
    E
  • table_handle: An open smalltable.Table instance.
  • E
  • keys: A sequence of strings representing the key of each table E row to fetch. String keys will be UTF-8 encoded.
  • E
  • require_all_keys: Optional; If require_all_keys is True only E rows with values set for all keys will be returned.
  • E
E E
Returns:
E E
E

A dict mapping keys to the corresponding table row data E fetched. Each row is represented as a tuple of strings. For E example:

E E

{b'Serak': ('Rigel VII', 'Preparer'), E b'Zim': ('Irk', 'Invader'), E b'Lrrr': ('Omicron Persei 8', 'Emperor')}

E E

Returned keys are always bytes. If a key from the keys argument is E missing from the dictionary, then that row was not found in the E table (and require_all_keys must have been False).

E
E E
Raises:
E E
    E
  • IOError: An error occurred accessing the smalltable.
  • E
E
E E E
E
E E
E E def E fetch_smalltable_rows2( table_handle: Any, keys: Sequence[str], require_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]: E E E E
E E
354def fetch_smalltable_rows2(table_handle: Any,
E           355                          keys: Sequence[str],
E           356                          require_all_keys: bool = False,
E           357) -> Mapping[bytes, Tuple[str]]:
E           358    """Fetches rows from a Smalltable.
E           359
E           360    Retrieves rows pertaining to the given keys from the Table instance
E           361    represented by table_handle.  String keys will be UTF-8 encoded.
E           362
E           363    Args:
E           364      table_handle:
E           365        An open smalltable.Table instance.
E           366      keys:
E           367        A sequence of strings representing the key of each table row to
E           368        fetch.  String keys will be UTF-8 encoded.
E           369      require_all_keys:
E           370        Optional; If require_all_keys is True only rows with values set
E           371        for all keys will be returned.
E           372
E           373    Returns:
E           374      A dict mapping keys to the corresponding table row data
E           375      fetched. Each row is represented as a tuple of strings. For
E           376      example:
E           377
E           378      {b'Serak': ('Rigel VII', 'Preparer'),
E           379       b'Zim': ('Irk', 'Invader'),
E           380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}
E           381
E           382      Returned keys are always bytes.  If a key from the keys argument is
E           383      missing from the dictionary, then that row was not found in the
E           384      table (and require_all_keys must have been False).
E           385
E           386    Raises:
E           387      IOError: An error occurred accessing the smalltable.
E           388    """
E           389    raise NotImplementedError
E           
E E E

Fetches rows from a Smalltable.

E E

Retrieves rows pertaining to the given keys from the Table instance E represented by table_handle. String keys will be UTF-8 encoded.

E E
Arguments:
E E
    E
  • table_handle: An open smalltable.Table instance.
  • E
  • keys: A sequence of strings representing the key of each table row to E fetch. String keys will be UTF-8 encoded.
  • E
  • require_all_keys: Optional; If require_all_keys is True only rows with values set E for all keys will be returned.
  • E
E E
Returns:
E E
E

A dict mapping keys to the corresponding table row data E fetched. Each row is represented as a tuple of strings. For E example:

E E

{b'Serak': ('Rigel VII', 'Preparer'), E b'Zim': ('Irk', 'Invader'), E b'Lrrr': ('Omicron Persei 8', 'Emperor')}

E E

Returned keys are always bytes. If a key from the keys argument is E missing from the dictionary, then that row was not found in the E table (and require_all_keys must have been False).

E
E E
Raises:
E E
    E
  • IOError: An error occurred accessing the smalltable.
  • E
E
E E E
E
E E
E E class E SampleClass: E E E E
E E
392class SampleClass:
E           393    """Summary of class here.
E           394
E           395    Longer class information....
E           396    Longer class information....
E           397
E           398    Attributes:
E           399        likes_spam: A boolean indicating if we like SPAM or not.
E           400        eggs: An integer count of the eggs we have laid.
E           401    """
E           402
E           403    def __init__(self, likes_spam=False):
E           404        """Inits SampleClass with blah."""
E           405        self.likes_spam = likes_spam
E           406        self.eggs = 0
E           407
E           408    def public_method(self):
E           409        """Performs operation blah."""
E           
E E E

Summary of class here.

E E

Longer class information.... E Longer class information....

E E
Attributes:
E E
    E
  • likes_spam: A boolean indicating if we like SPAM or not.
  • E
  • eggs: An integer count of the eggs we have laid.
  • E
E
E E E
E E
E E SampleClass(likes_spam=False) E E E E
E E
403    def __init__(self, likes_spam=False):
E           404        """Inits SampleClass with blah."""
E           405        self.likes_spam = likes_spam
E           406        self.eggs = 0
E           
E E E

Inits SampleClass with blah.

E
E E E
E
E
E likes_spam E E E
E E E E E
E
E
E eggs E E E
E E E E E
E
E E
E E def E public_method(self): E E E E
E E
408    def public_method(self):
E           409        """Performs operation blah."""
E           
E E E

Performs operation blah.

E
E E E
E
E
E E
E E def E invalid_format(test): E E E E
E E
412def invalid_format(test):
E           413    """
E           414    In this example, there is no colon after the argument and an empty section.
E           415
E           416    Args:
E           417      test
E           418        there is a colon missing in the previous line
E           419    Returns:
E           420
E           421    """
E           
E E E

In this example, there is no colon after the argument and an empty section.

E E
Arguments:
E E
    E
  • test E there is a colon missing in the previous line
  • E
E E

Returns:

E
E E E
E
E E
E E def E example_code(): E E E E
E E
424def example_code():
E           425    """
E           426    Test case for https://github.com/mitmproxy/pdoc/issues/264.
E           427
E           428    Example:
E           429
E           430        ```python
E           431        tmp = a2()
E           432
E           433        tmp2 = a()
E           434        ```
E           435    """
E           
E E E

Test case for https://github.com/mitmproxy/pdoc/issues/264.

E E
Example:
E E
E
E
tmp = a2()
E           
E           tmp2 = a()
E           
E
E
E
E E E
E
E E
E E def E newline_after_args(test: str): E E E E
E E
438def newline_after_args(test: str):
E           439    """
E           440    Test case for https://github.com/mitmproxy/pdoc/pull/458.
E           441
E           442    Args:
E           443
E           444      test
E           445        there is unexpected whitespace before test.
E           446    """
E           
E E E

Test case for https://github.com/mitmproxy/pdoc/pull/458.

E E
Arguments:
E E
    E
  • test E there is unexpected whitespace before test.
  • E
E
E E E
E
E E
E E def E alternative_section_names(test: str): E E E E
E E
449def alternative_section_names(test: str):
E           450    """
E           451    In this example, we check whether alternative section names aliased to
E           452    'Args' are handled properly.
E           453
E           454    Parameters:
E           455        test: the test string
E           456    """
E           
E E E

In this example, we check whether alternative section names aliased to E 'Args' are handled properly.

E E
Arguments:
E E
    E
  • test: the test string
  • E
E
E E E
E
E E
E E def E keyword_arguments(**kwargs): E E E E
E E
458def keyword_arguments(**kwargs):
E           459    """
E           460    This an example for a function with keyword arguments documented in the docstring.
E           461
E           462    Args:
E           463        **kwargs: A dictionary containing user info.
E           464
E           465    Keyword Arguments:
E           466        str_arg (str): First string argument.
E           467        int_arg (int): Second integer argument.
E           468    """
E           
E E E

This an example for a function with keyword arguments documented in the docstring.

E E
Arguments:
E E
    E -
  • **kwargs: A dictionary containing user info.
  • E ? -- E +
  • **kwargs: A dictionary containing user info.
  • E ? ++ E
E E
Keyword Args:
E E
    E
  • str_arg (str): First string argument.
  • E
  • int_arg (int): Second integer argument.
  • E
E
E E E
E
E E /build/pdoc/src/pdoc-16.0.0/test/test_snapshot.py:184: AssertionError ______________________ test_snapshots[html-flavors_numpy] ______________________ snapshot = Snapshot(flavors_numpy), format = 'html' monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f051021b460> @pytest.mark.parametrize("snapshot", snapshots, ids=[x.id for x in snapshots]) @pytest.mark.parametrize("format", ["html", "repr"]) def test_snapshots(snapshot: Snapshot, format: str, monkeypatch): """ Compare pdoc's rendered output against stored snapshots. """ monkeypatch.chdir(snapshot_dir) if sys.version_info < snapshot.min_version: pytest.skip( f"Snapshot only works on Python {'.'.join(str(x) for x in snapshot.min_version)} and above." ) expected = snapshot.outfile(format).read_text("utf8") actual = snapshot.make(format) > assert actual == expected, ( f"Rendered output does not match for snapshot {snapshot.id}. " "Run `python3 ./test/test_snapshot.py` to update snapshots." ) E AssertionError: Rendered output does not match for snapshot flavors_numpy. Run `python3 ./test/test_snapshot.py` to update snapshots. E assert '\n\n\n \n \n \n flavors_numpy API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_numpy

\n\n

Example NumPy-style docstrings.

\n\n

This module demonstrates documentation as specified by the NumPy\nDocumentation HOWTO. Docstrings may extend over multiple lines. Sections\nare created with a section header followed by an underline of equal length.

\n\n
Example
\n\n

Examples can be given using either the Example or Examples\nsections. Sections support any reStructuredText formatting, including\nliteral blocks::

\n\n
$ python example_numpy.py\n
\n\n

Section breaks are created with two blank lines. Section breaks are also\nimplicitly created anytime a new section starts. Section bodies may be\nindented:

\n\n
Notes
\n\n

This is an example of an indented section. It\'s like any other section,\nbut the body is indented to help it stand out from surrounding text.\nIf a section is indented, then a section break is created by\nresuming unindented text.

\n\n
Attributes
\n\n
    \n
  • module_level_variable1 (int):\nModule level variables may be documented in either the Attributes\nsection of the module docstring, or in an inline docstring immediately\nfollowing the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html\n  4#   License: BSD-3\n  5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py\n  6#   License: BSD-2\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example NumPy-style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `NumPy\n 13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections\n 14are created with a section header followed by an underline of equal length.\n 15\n 16Example\n 17-------\n 18Examples can be given using either the ``Example`` or ``Examples``\n 19sections. Sections support any reStructuredText formatting, including\n 20literal blocks::\n 21\n 22    $ python example_numpy.py\n 23\n 24\n 25Section breaks are created with two blank lines. Section breaks are also\n 26implicitly created anytime a new section starts. Section bodies *may* be\n 27indented:\n 28\n 29Notes\n 30-----\n 31    This is an example of an indented section. It's like any other section,\n 32    but the body is indented to help it stand out from surrounding text.\n 33\n 34If a section is indented, then a section break is created by\n 35resuming unindented text.\n 36\n 37Attributes\n 38----------\n 39module_level_variable1 : int\n 40    Module level variables may be documented in either the ``Attributes``\n 41    section of the module docstring, or in an inline docstring immediately\n 42    following the variable.\n 43\n 44    Either form is acceptable, but the two should not be mixed. Choose\n 45    one convention to document module level variables and be consistent\n 46    with it.\n 47\n 48\n 49.. _NumPy Documentation HOWTO:\n 50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n 51\n 52"""\n 53__docformat__ = "numpy"\n 54\n 55\n 56module_level_variable1 = 12345\n 57\n 58module_level_variable2 = 98765\n 59"""int: Module level variable documented inline.\n 60\n 61The docstring may span multiple lines. The type may optionally be specified\n 62on the first line, separated by a colon.\n 63"""\n 64\n 65\n 66def function_with_types_in_docstring(param1, param2):\n 67    """Example function with types documented in the docstring.\n 68\n 69    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 70    return types are annotated according to `PEP 484`_, they do not need to be\n 71    included in the docstring:\n 72\n 73    Parameters\n 74    ----------\n 75    param1 : int\n 76        The first parameter.\n 77    param2 : str\n 78        The second parameter.\n 79\n 80    Returns\n 81    -------\n 82    bool\n 83        True if successful, False otherwise.\n 84\n 85    .. _PEP 484:\n 86        https://www.python.org/dev/peps/pep-0484/\n 87\n 88    """\n 89\n 90\n 91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 92    """Example function with PEP 484 type annotations.\n 93\n 94    The return type must be duplicated in the docstring to comply\n 95    with the NumPy docstring style.\n 96\n 97    Parameters\n 98    ----------\n 99    param1\n100        The first parameter.\n101    param2\n102        The second parameter.\n103\n104    Returns\n105    -------\n106    bool\n107        True if successful, False otherwise.\n108\n109    """\n110    raise NotImplementedError\n111\n112\n113def module_level_function(param1, param2=None, *args, **kwargs):\n114    """This is an example of a module level function.\n115\n116    Function parameters should be documented in the ``Parameters`` section.\n117    The name of each parameter is required. The type and description of each\n118    parameter is optional, but should be included if not obvious.\n119\n120    If *args or **kwargs are accepted,\n121    they should be listed as ``*args`` and ``**kwargs``.\n122\n123    The format for a parameter is::\n124\n125        name : type\n126            description\n127\n128            The description may span multiple lines. Following lines\n129            should be indented to match the first line of the description.\n130            The ": type" is optional.\n131\n132            Multiple paragraphs are supported in parameter\n133            descriptions.\n134\n135    Parameters\n136    ----------\n137    param1 : int\n138        The first parameter.\n139    param2 : :obj:`str`, optional\n140        The second parameter.\n141    *args\n142        Variable length argument list.\n143    **kwargs\n144        Arbitrary keyword arguments.\n145\n146    Returns\n147    -------\n148    bool\n149        True if successful, False otherwise.\n150\n151        The return type is not optional. The ``Returns`` section may span\n152        multiple lines and paragraphs. Following lines should be indented to\n153        match the first line of the description.\n154\n155        The ``Returns`` section supports any reStructuredText formatting,\n156        including literal blocks::\n157\n158            {\n159                'param1': param1,\n160                'param2': param2\n161            }\n162\n163    Raises\n164    ------\n165    AttributeError\n166        The ``Raises`` section is a list of all exceptions\n167        that are relevant to the interface.\n168    ValueError\n169        If `param2` is equal to `param1`.\n170\n171    """\n172    if param1 == param2:\n173        raise ValueError('param1 may not be equal to param2')\n174    return True\n175\n176\n177def example_generator(n):\n178    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n179\n180    Parameters\n181    ----------\n182    n : int\n183        The upper limit of the range to generate, from 0 to `n` - 1.\n184\n185    Yields\n186    ------\n187    int\n188        The next number in the range of 0 to `n` - 1.\n189\n190    Examples\n191    --------\n192    Examples should be written in doctest format, and should illustrate how\n193    to use the function.\n194\n195    >>> print([i for i in example_generator(4)])\n196    [0, 1, 2, 3]\n197\n198    """\n199    for i in range(n):\n200        yield i\n201\n202\n203class ExampleError(Exception):\n204    """Exceptions are documented in the same way as classes.\n205\n206    The __init__ method may be documented in either the class level\n207    docstring, or as a docstring on the __init__ method itself.\n208\n209    Either form is acceptable, but the two should not be mixed. Choose one\n210    convention to document the __init__ method and be consistent with it.\n211\n212    Note\n213    ----\n214    Do not include the `self` parameter in the ``Parameters`` section.\n215\n216    Parameters\n217    ----------\n218    msg : str\n219        Human readable string describing the exception.\n220    code : :obj:`int`, optional\n221        Numeric error code.\n222\n223    Attributes\n224    ----------\n225    msg : str\n226        Human readable string describing the exception.\n227    code : int\n228        Numeric error code.\n229\n230    """\n231\n232    def __init__(self, msg, code):\n233        self.msg = msg\n234        self.code = code\n235\n236    def add_note(self, note: str):\n237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n238\n239    def with_traceback(self, object, /):\n240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n241\n242class ExampleClass(object):\n243    """The summary line for a class docstring should fit on one line.\n244\n245    If the class has public attributes, they may be documented here\n246    in an ``Attributes`` section and follow the same formatting as a\n247    function's ``Args`` section. Alternatively, attributes may be documented\n248    inline with the attribute's declaration (see __init__ method below).\n249\n250    Properties created with the ``@property`` decorator should be documented\n251    in the property's getter method.\n252\n253    Attributes\n254    ----------\n255    attr1 : str\n256        Description of `attr1`.\n257    attr2 : :obj:`int`, optional\n258        Description of `attr2`.\n259\n260    """\n261\n262    def __init__(self, param1, param2, param3):\n263        """Example of docstring on the __init__ method.\n264\n265        The __init__ method may be documented in either the class level\n266        docstring, or as a docstring on the __init__ method itself.\n267\n268        Either form is acceptable, but the two should not be mixed. Choose one\n269        convention to document the __init__ method and be consistent with it.\n270\n271        Note\n272        ----\n273        Do not include the `self` parameter in the ``Parameters`` section.\n274\n275        Parameters\n276        ----------\n277        param1 : str\n278            Description of `param1`.\n279        param2 : :obj:`list` of :obj:`str`\n280            Description of `param2`. Multiple\n281            lines are supported.\n282        param3 : :obj:`int`, optional\n283            Description of `param3`.\n284\n285        """\n286        self.attr1 = param1\n287        self.attr2 = param2\n288        self.attr3 = param3  #: Doc comment *inline* with attribute\n289\n290        #: list of str: Doc comment *before* attribute, with type specified\n291        self.attr4 = ["attr4"]\n292\n293        self.attr5 = None\n294        """str: Docstring *after* attribute, with type specified."""\n295\n296    @property\n297    def readonly_property(self):\n298        """str: Properties should be documented in their getter method."""\n299        return "readonly_property"\n300\n301    @property\n302    def readwrite_property(self):\n303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n304        should only be documented in their getter method.\n305\n306        If the setter method contains notable behavior, it should be\n307        mentioned here.\n308        """\n309        return ["readwrite_property"]\n310\n311    @readwrite_property.setter\n312    def readwrite_property(self, value):\n313        value\n314\n315    def example_method(self, param1, param2):\n316        """Class methods are similar to regular functions.\n317\n318        Note\n319        ----\n320        Do not include the `self` parameter in the ``Parameters`` section.\n321\n322        Parameters\n323        ----------\n324        param1\n325            The first parameter.\n326        param2\n327            The second parameter.\n328\n329        Returns\n330        -------\n331        bool\n332            True if successful, False otherwise.\n333\n334        """\n335        return True\n336\n337    def __special__(self):\n338        """By default special members with docstrings are not included.\n339\n340        Special members are any methods or attributes that start with and\n341        end with a double underscore. Any special member with a docstring\n342        will be included in the output, if\n343        ``napoleon_include_special_with_doc`` is set to True.\n344\n345        This behavior can be enabled by changing the following setting in\n346        Sphinx's conf.py::\n347\n348            napoleon_include_special_with_doc = True\n349\n350        """\n351        pass\n352\n353    def __special_without_docstring__(self):\n354        pass\n355\n356    def _private(self):\n357        """By default private members are not included.\n358\n359        Private members are any methods or attributes that start with an\n360        underscore and are *not* special. By default they are not included\n361        in the output.\n362\n363        This behavior can be changed such that private members *are* included\n364        by changing the following setting in Sphinx's conf.py::\n365\n366            napoleon_include_private_with_doc = True\n367\n368        """\n369        pass\n370\n371    def _private_without_docstring(self):\n372        pass\n373\n374\n375def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n376    r"""Summarize the function in one line.\n377\n378    Several sentences providing an extended description. Refer to\n379    variables using back-ticks, e.g. `var`.\n380\n381    Parameters\n382    ----------\n383    var1 : array_like\n384        Array_like means all those objects -- lists, nested lists, etc. --\n385        that can be converted to an array.  We can also refer to\n386        variables like `var1`.\n387    var2 : int\n388        The type above can either refer to an actual Python type\n389        (e.g. ``int``), or describe the type of the variable in more\n390        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n391    *args : iterable\n392        Other arguments.\n393    long_var_name : {'hi', 'ho'}, optional\n394        Choices in brackets, default first when optional.\n395    **kwargs : dict\n396        Keyword arguments.\n397\n398    Returns\n399    -------\n400    type\n401        Explanation of anonymous return value of type ``type``.\n402    describe : type\n403        Explanation of return value named `describe`.\n404    out : type\n405        Explanation of `out`.\n406    type_without_description\n407\n408    Other Parameters\n409    ----------------\n410    only_seldom_used_keywords : type\n411        Explanation.\n412    common_parameters_listed_above : type\n413        Explanation.\n414\n415    Raises\n416    ------\n417    BadException\n418        Because you shouldn't have done that.\n419\n420    See Also\n421    --------\n422    numpy.array : Relationship (optional).\n423    numpy.ndarray : Relationship (optional), which could be fairly long, in\n424                    which case the line wraps here.\n425    numpy.dot, numpy.linalg.norm, numpy.eye\n426\n427    Notes\n428    -----\n429    Notes about the implementation algorithm (if needed).\n430\n431    This can have multiple paragraphs.\n432\n433    You may include some math:\n434\n435    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n436\n437    And even use a Greek symbol like :math:`\\omega` inline.\n438\n439    References\n440    ----------\n441    Cite the relevant literature, e.g. [1]_.  You may also cite these\n442    references in the notes section above.\n443\n444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n445       expert systems and adaptive co-kriging for environmental habitat\n446       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n447       and neural-network techniques," Computers & Geosciences, vol. 22,\n448       pp. 585-588, 1996.\n449\n450    Examples\n451    --------\n452    These are written in doctest format, and should illustrate how to\n453    use the function.\n454\n455    >>> a = [1, 2, 3]\n456    >>> print([x + 3 for x in a])\n457    [4, 5, 6]\n458    >>> print("a\\nb")\n459    a\n460    b\n461    """\n462    # After closing class docstring, there should be one blank line to\n463    # separate following codes (according to PEP257).\n464    # But for function, method and module, there should be no blank lines\n465    # after closing the docstring.\n466    pass\n467\n468\n469def invalid_format(test):\n470    """\n471    In this example, there is no description for the test argument\n472\n473    Parameters\n474    ----------\n475    param1\n476\n477    """\n478\n479def invalid_format2() -> None:\n480    """\n481    Another example without description, but this time indented.\n482\n483    Returns\n484    -------\n485        Text describing the return value.\n486    """\n487\n488def invalid_format3() -> None:\n489    """\n490    Another example with a multiline text.\n491\n492    Returns\n493    -------\n494        Multiline text\n495        describing the return value.\n496    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
67def function_with_types_in_docstring(param1, param2):\n68    """Example function with types documented in the docstring.\n69\n70    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n71    return types are annotated according to `PEP 484`_, they do not need to be\n72    included in the docstring:\n73\n74    Parameters\n75    ----------\n76    param1 : int\n77        The first parameter.\n78    param2 : str\n79        The second parameter.\n80\n81    Returns\n82    -------\n83    bool\n84        True if successful, False otherwise.\n85\n86    .. _PEP 484:\n87        https://www.python.org/dev/peps/pep-0484/\n88\n89    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str):\nThe second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 93    """Example function with PEP 484 type annotations.\n 94\n 95    The return type must be duplicated in the docstring to comply\n 96    with the NumPy docstring style.\n 97\n 98    Parameters\n 99    ----------\n100    param1\n101        The first parameter.\n102    param2\n103        The second parameter.\n104\n105    Returns\n106    -------\n107    bool\n108        True if successful, False otherwise.\n109\n110    """\n111    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n

The return type must be duplicated in the docstring to comply\nwith the NumPy docstring style.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
114def module_level_function(param1, param2=None, *args, **kwargs):\n115    """This is an example of a module level function.\n116\n117    Function parameters should be documented in the ``Parameters`` section.\n118    The name of each parameter is required. The type and description of each\n119    parameter is optional, but should be included if not obvious.\n120\n121    If *args or **kwargs are accepted,\n122    they should be listed as ``*args`` and ``**kwargs``.\n123\n124    The format for a parameter is::\n125\n126        name : type\n127            description\n128\n129            The description may span multiple lines. Following lines\n130            should be indented to match the first line of the description.\n131            The ": type" is optional.\n132\n133            Multiple paragraphs are supported in parameter\n134            descriptions.\n135\n136    Parameters\n137    ----------\n138    param1 : int\n139        The first parameter.\n140    param2 : :obj:`str`, optional\n141        The second parameter.\n142    *args\n143        Variable length argument list.\n144    **kwargs\n145        Arbitrary keyword arguments.\n146\n147    Returns\n148    -------\n149    bool\n150        True if successful, False otherwise.\n151\n152        The return type is not optional. The ``Returns`` section may span\n153        multiple lines and paragraphs. Following lines should be indented to\n154        match the first line of the description.\n155\n156        The ``Returns`` section supports any reStructuredText formatting,\n157        including literal blocks::\n158\n159            {\n160                'param1': param1,\n161                'param2': param2\n162            }\n163\n164    Raises\n165    ------\n166    AttributeError\n167        The ``Raises`` section is a list of all exceptions\n168        that are relevant to the interface.\n169    ValueError\n170        If `param2` is equal to `param1`.\n171\n172    """\n173    if param1 == param2:\n174        raise ValueError('param1 may not be equal to param2')\n175    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Parameters section.\nThe name of each parameter is required. The type and description of each\nparameter is optional, but should be included if not obvious.

\n\n

If *args or **kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name : type\n    description\n\n    The description may span multiple lines. Following lines\n    should be indented to match the first line of the description.\n    The ": type" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str, optional):\nThe second parameter.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n\n

The return type is not optional. The Returns section may span\nmultiple lines and paragraphs. Following lines should be indented to\nmatch the first line of the description.

\n\n

The Returns section supports any reStructuredText formatting,\nincluding literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n\n
Raises
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
178def example_generator(n):\n179    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n180\n181    Parameters\n182    ----------\n183    n : int\n184        The upper limit of the range to generate, from 0 to `n` - 1.\n185\n186    Yields\n187    ------\n188    int\n189        The next number in the range of 0 to `n` - 1.\n190\n191    Examples\n192    --------\n193    Examples should be written in doctest format, and should illustrate how\n194    to use the function.\n195\n196    >>> print([i for i in example_generator(4)])\n197    [0, 1, 2, 3]\n198\n199    """\n200    for i in range(n):\n201        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Parameters
\n\n
    \n
  • n (int):\nThe upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields
\n\n
    \n
  • int: The next number in the range of 0 to n - 1.
  • \n
\n\n
Examples
\n\n

Examples should be written in doctest format, and should illustrate how\nto use the function.

\n\n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
204class ExampleError(Exception):\n205    """Exceptions are documented in the same way as classes.\n206\n207    The __init__ method may be documented in either the class level\n208    docstring, or as a docstring on the __init__ method itself.\n209\n210    Either form is acceptable, but the two should not be mixed. Choose one\n211    convention to document the __init__ method and be consistent with it.\n212\n213    Note\n214    ----\n215    Do not include the `self` parameter in the ``Parameters`` section.\n216\n217    Parameters\n218    ----------\n219    msg : str\n220        Human readable string describing the exception.\n221    code : :obj:`int`, optional\n222        Numeric error code.\n223\n224    Attributes\n225    ----------\n226    msg : str\n227        Human readable string describing the exception.\n228    code : int\n229        Numeric error code.\n230\n231    """\n232\n233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n236\n237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n239\n240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int, optional):\nNumeric error code.
  • \n
\n\n
Attributes
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int):\nNumeric error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
243class ExampleClass(object):\n244    """The summary line for a class docstring should fit on one line.\n245\n246    If the class has public attributes, they may be documented here\n247    in an ``Attributes`` section and follow the same formatting as a\n248    function's ``Args`` section. Alternatively, attributes may be documented\n249    inline with the attribute's declaration (see __init__ method below).\n250\n251    Properties created with the ``@property`` decorator should be documented\n252    in the property's getter method.\n253\n254    Attributes\n255    ----------\n256    attr1 : str\n257        Description of `attr1`.\n258    attr2 : :obj:`int`, optional\n259        Description of `attr2`.\n260\n261    """\n262\n263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n296\n297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n301\n302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n311\n312    @readwrite_property.setter\n313    def readwrite_property(self, value):\n314        value\n315\n316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n337\n338    def __special__(self):\n339        """By default special members with docstrings are not included.\n340\n341        Special members are any methods or attributes that start with and\n342        end with a double underscore. Any special member with a docstring\n343        will be included in the output, if\n344        ``napoleon_include_special_with_doc`` is set to True.\n345\n346        This behavior can be enabled by changing the following setting in\n347        Sphinx's conf.py::\n348\n349            napoleon_include_special_with_doc = True\n350\n351        """\n352        pass\n353\n354    def __special_without_docstring__(self):\n355        pass\n356\n357    def _private(self):\n358        """By default private members are not included.\n359\n360        Private members are any methods or attributes that start with an\n361        underscore and are *not* special. By default they are not included\n362        in the output.\n363\n364        This behavior can be changed such that private members *are* included\n365        by changing the following setting in Sphinx's conf.py::\n366\n367            napoleon_include_private_with_doc = True\n368\n369        """\n370        pass\n371\n372    def _private_without_docstring(self):\n373        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes
\n\n
    \n
  • attr1 (str):\nDescription of attr1.
  • \n
  • attr2 (int, optional):\nDescription of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1 (str):\nDescription of param1.
  • \n
  • param2 (list of str):\nDescription of param2. Multiple\nlines are supported.
  • \n
  • param3 (int, optional):\nDescription of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n foo(var1, var2, *args, long_var_name='hi', **kwargs):\n\n \n\n
\n \n
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n377    r"""Summarize the function in one line.\n378\n379    Several sentences providing an extended description. Refer to\n380    variables using back-ticks, e.g. `var`.\n381\n382    Parameters\n383    ----------\n384    var1 : array_like\n385        Array_like means all those objects -- lists, nested lists, etc. --\n386        that can be converted to an array.  We can also refer to\n387        variables like `var1`.\n388    var2 : int\n389        The type above can either refer to an actual Python type\n390        (e.g. ``int``), or describe the type of the variable in more\n391        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n392    *args : iterable\n393        Other arguments.\n394    long_var_name : {'hi', 'ho'}, optional\n395        Choices in brackets, default first when optional.\n396    **kwargs : dict\n397        Keyword arguments.\n398\n399    Returns\n400    -------\n401    type\n402        Explanation of anonymous return value of type ``type``.\n403    describe : type\n404        Explanation of return value named `describe`.\n405    out : type\n406        Explanation of `out`.\n407    type_without_description\n408\n409    Other Parameters\n410    ----------------\n411    only_seldom_used_keywords : type\n412        Explanation.\n413    common_parameters_listed_above : type\n414        Explanation.\n415\n416    Raises\n417    ------\n418    BadException\n419        Because you shouldn't have done that.\n420\n421    See Also\n422    --------\n423    numpy.array : Relationship (optional).\n424    numpy.ndarray : Relationship (optional), which could be fairly long, in\n425                    which case the line wraps here.\n426    numpy.dot, numpy.linalg.norm, numpy.eye\n427\n428    Notes\n429    -----\n430    Notes about the implementation algorithm (if needed).\n431\n432    This can have multiple paragraphs.\n433\n434    You may include some math:\n435\n436    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n437\n438    And even use a Greek symbol like :math:`\\omega` inline.\n439\n440    References\n441    ----------\n442    Cite the relevant literature, e.g. [1]_.  You may also cite these\n443    references in the notes section above.\n444\n445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n446       expert systems and adaptive co-kriging for environmental habitat\n447       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n448       and neural-network techniques," Computers & Geosciences, vol. 22,\n449       pp. 585-588, 1996.\n450\n451    Examples\n452    --------\n453    These are written in doctest format, and should illustrate how to\n454    use the function.\n455\n456    >>> a = [1, 2, 3]\n457    >>> print([x + 3 for x in a])\n458    [4, 5, 6]\n459    >>> print("a\\nb")\n460    a\n461    b\n462    """\n463    # After closing class docstring, there should be one blank line to\n464    # separate following codes (according to PEP257).\n465    # But for function, method and module, there should be no blank lines\n466    # after closing the docstring.\n467    pass\n
\n\n\n

Summarize the function in one line.

\n\n

Several sentences providing an extended description. Refer to\nvariables using back-ticks, e.g. var.

\n\n
Parameters
\n\n
    \n
  • var1 (array_like):\nArray_like means all those objects -- lists, nested lists, etc. --\nthat can be converted to an array. We can also refer to\nvariables like var1.
  • \n
  • var2 (int):\nThe type above can either refer to an actual Python type\n(e.g. int), or describe the type of the variable in more\ndetail, e.g. (N,) ndarray or array_like.
  • \n
  • *args (iterable):\nOther arguments.
  • \n
  • long_var_name ({\'hi\', \'ho\'}, optional):\nChoices in brackets, default first when optional.
  • \n
  • **kwargs (dict):\nKeyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • type: Explanation of anonymous return value of type type.
  • \n
  • describe (type):\nExplanation of return value named describe.
  • \n
  • out (type):\nExplanation of out.
  • \n
  • type_without_description
  • \n
\n\n
Other Parameters
\n\n
    \n
  • only_seldom_used_keywords (type):\nExplanation.
  • \n
  • common_parameters_listed_above (type):\nExplanation.
  • \n
\n\n
Raises
\n\n
    \n
  • BadException: Because you shouldn\'t have done that.
  • \n
\n\n
See Also
\n\n

numpy.array: Relationship (optional).
\nnumpy.ndarray: Relationship (optional), which could be fairly long, in\nwhich case the line wraps here.
\nnumpy.dot,, numpy.linalg.norm,, numpy.eye

\n\n
Notes
\n\n

Notes about the implementation algorithm (if needed).

\n\n

This can have multiple paragraphs.

\n\n

You may include some math:

\n\n

$$X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}$$

\n\n

And even use a Greek symbol like \\( \\omega \\) inline.

\n\n
References
\n\n

Cite the relevant literature, e.g. 1. You may also cite these\nreferences in the notes section above.

\n\n
Examples
\n\n

These are written in doctest format, and should illustrate how to\nuse the function.

\n\n
\n
>>> a = [1, 2, 3]\n>>> print([x + 3 for x in a])\n[4, 5, 6]\n>>> print("a\\nb")\na\nb\n
\n
\n\n
\n
\n
    \n
  1. \n

    O. McNoleg, "The integration of GIS, remote sensing,\nexpert systems and adaptive co-kriging for environmental habitat\nmodelling of the Highland Haggis using object-oriented, fuzzy-logic\nand neural-network techniques," Computers & Geosciences, vol. 22,\npp. 585-588, 1996. 

    \n
  2. \n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
470def invalid_format(test):\n471    """\n472    In this example, there is no description for the test argument\n473\n474    Parameters\n475    ----------\n476    param1\n477\n478    """\n
\n\n\n

In this example, there is no description for the test argument

\n\n
Parameters
\n\n
    \n
  • param1
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format2() -> None:\n\n \n\n
\n \n
480def invalid_format2() -> None:\n481    """\n482    Another example without description, but this time indented.\n483\n484    Returns\n485    -------\n486        Text describing the return value.\n487    """\n
\n\n\n

Another example without description, but this time indented.

\n\n
Returns
\n\n
    \n
  • Text describing the return value.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format3() -> None:\n\n \n\n
\n \n
489def invalid_format3() -> None:\n490    """\n491    Another example with a multiline text.\n492\n493    Returns\n494    -------\n495        Multiline text\n496        describing the return value.\n497    """\n
\n\n\n

Another example with a multiline text.

\n\n
Returns
\n\n
    \n
  • Multiline text
  • \n
  • describing the return value.
  • \n
\n
\n\n\n
\n
\n\n' == '\n\n\n \n \n \n flavors_numpy API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_numpy

\n\n

Example NumPy-style docstrings.

\n\n

This module demonstrates documentation as specified by the NumPy\nDocumentation HOWTO. Docstrings may extend over multiple lines. Sections\nare created with a section header followed by an underline of equal length.

\n\n
Example
\n\n

Examples can be given using either the Example or Examples\nsections. Sections support any reStructuredText formatting, including\nliteral blocks::

\n\n
$ python example_numpy.py\n
\n\n

Section breaks are created with two blank lines. Section breaks are also\nimplicitly created anytime a new section starts. Section bodies may be\nindented:

\n\n
Notes
\n\n

This is an example of an indented section. It\'s like any other section,\nbut the body is indented to help it stand out from surrounding text.\nIf a section is indented, then a section break is created by\nresuming unindented text.

\n\n
Attributes
\n\n
    \n
  • module_level_variable1 (int):\nModule level variables may be documented in either the Attributes\nsection of the module docstring, or in an inline docstring immediately\nfollowing the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html\n  4#   License: BSD-3\n  5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py\n  6#   License: BSD-2\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example NumPy-style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `NumPy\n 13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections\n 14are created with a section header followed by an underline of equal length.\n 15\n 16Example\n 17-------\n 18Examples can be given using either the ``Example`` or ``Examples``\n 19sections. Sections support any reStructuredText formatting, including\n 20literal blocks::\n 21\n 22    $ python example_numpy.py\n 23\n 24\n 25Section breaks are created with two blank lines. Section breaks are also\n 26implicitly created anytime a new section starts. Section bodies *may* be\n 27indented:\n 28\n 29Notes\n 30-----\n 31    This is an example of an indented section. It's like any other section,\n 32    but the body is indented to help it stand out from surrounding text.\n 33\n 34If a section is indented, then a section break is created by\n 35resuming unindented text.\n 36\n 37Attributes\n 38----------\n 39module_level_variable1 : int\n 40    Module level variables may be documented in either the ``Attributes``\n 41    section of the module docstring, or in an inline docstring immediately\n 42    following the variable.\n 43\n 44    Either form is acceptable, but the two should not be mixed. Choose\n 45    one convention to document module level variables and be consistent\n 46    with it.\n 47\n 48\n 49.. _NumPy Documentation HOWTO:\n 50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n 51\n 52"""\n 53__docformat__ = "numpy"\n 54\n 55\n 56module_level_variable1 = 12345\n 57\n 58module_level_variable2 = 98765\n 59"""int: Module level variable documented inline.\n 60\n 61The docstring may span multiple lines. The type may optionally be specified\n 62on the first line, separated by a colon.\n 63"""\n 64\n 65\n 66def function_with_types_in_docstring(param1, param2):\n 67    """Example function with types documented in the docstring.\n 68\n 69    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 70    return types are annotated according to `PEP 484`_, they do not need to be\n 71    included in the docstring:\n 72\n 73    Parameters\n 74    ----------\n 75    param1 : int\n 76        The first parameter.\n 77    param2 : str\n 78        The second parameter.\n 79\n 80    Returns\n 81    -------\n 82    bool\n 83        True if successful, False otherwise.\n 84\n 85    .. _PEP 484:\n 86        https://www.python.org/dev/peps/pep-0484/\n 87\n 88    """\n 89\n 90\n 91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 92    """Example function with PEP 484 type annotations.\n 93\n 94    The return type must be duplicated in the docstring to comply\n 95    with the NumPy docstring style.\n 96\n 97    Parameters\n 98    ----------\n 99    param1\n100        The first parameter.\n101    param2\n102        The second parameter.\n103\n104    Returns\n105    -------\n106    bool\n107        True if successful, False otherwise.\n108\n109    """\n110    raise NotImplementedError\n111\n112\n113def module_level_function(param1, param2=None, *args, **kwargs):\n114    """This is an example of a module level function.\n115\n116    Function parameters should be documented in the ``Parameters`` section.\n117    The name of each parameter is required. The type and description of each\n118    parameter is optional, but should be included if not obvious.\n119\n120    If *args or **kwargs are accepted,\n121    they should be listed as ``*args`` and ``**kwargs``.\n122\n123    The format for a parameter is::\n124\n125        name : type\n126            description\n127\n128            The description may span multiple lines. Following lines\n129            should be indented to match the first line of the description.\n130            The ": type" is optional.\n131\n132            Multiple paragraphs are supported in parameter\n133            descriptions.\n134\n135    Parameters\n136    ----------\n137    param1 : int\n138        The first parameter.\n139    param2 : :obj:`str`, optional\n140        The second parameter.\n141    *args\n142        Variable length argument list.\n143    **kwargs\n144        Arbitrary keyword arguments.\n145\n146    Returns\n147    -------\n148    bool\n149        True if successful, False otherwise.\n150\n151        The return type is not optional. The ``Returns`` section may span\n152        multiple lines and paragraphs. Following lines should be indented to\n153        match the first line of the description.\n154\n155        The ``Returns`` section supports any reStructuredText formatting,\n156        including literal blocks::\n157\n158            {\n159                'param1': param1,\n160                'param2': param2\n161            }\n162\n163    Raises\n164    ------\n165    AttributeError\n166        The ``Raises`` section is a list of all exceptions\n167        that are relevant to the interface.\n168    ValueError\n169        If `param2` is equal to `param1`.\n170\n171    """\n172    if param1 == param2:\n173        raise ValueError('param1 may not be equal to param2')\n174    return True\n175\n176\n177def example_generator(n):\n178    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n179\n180    Parameters\n181    ----------\n182    n : int\n183        The upper limit of the range to generate, from 0 to `n` - 1.\n184\n185    Yields\n186    ------\n187    int\n188        The next number in the range of 0 to `n` - 1.\n189\n190    Examples\n191    --------\n192    Examples should be written in doctest format, and should illustrate how\n193    to use the function.\n194\n195    >>> print([i for i in example_generator(4)])\n196    [0, 1, 2, 3]\n197\n198    """\n199    for i in range(n):\n200        yield i\n201\n202\n203class ExampleError(Exception):\n204    """Exceptions are documented in the same way as classes.\n205\n206    The __init__ method may be documented in either the class level\n207    docstring, or as a docstring on the __init__ method itself.\n208\n209    Either form is acceptable, but the two should not be mixed. Choose one\n210    convention to document the __init__ method and be consistent with it.\n211\n212    Note\n213    ----\n214    Do not include the `self` parameter in the ``Parameters`` section.\n215\n216    Parameters\n217    ----------\n218    msg : str\n219        Human readable string describing the exception.\n220    code : :obj:`int`, optional\n221        Numeric error code.\n222\n223    Attributes\n224    ----------\n225    msg : str\n226        Human readable string describing the exception.\n227    code : int\n228        Numeric error code.\n229\n230    """\n231\n232    def __init__(self, msg, code):\n233        self.msg = msg\n234        self.code = code\n235\n236    def add_note(self, note: str):\n237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n238\n239    def with_traceback(self, object, /):\n240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n241\n242class ExampleClass(object):\n243    """The summary line for a class docstring should fit on one line.\n244\n245    If the class has public attributes, they may be documented here\n246    in an ``Attributes`` section and follow the same formatting as a\n247    function's ``Args`` section. Alternatively, attributes may be documented\n248    inline with the attribute's declaration (see __init__ method below).\n249\n250    Properties created with the ``@property`` decorator should be documented\n251    in the property's getter method.\n252\n253    Attributes\n254    ----------\n255    attr1 : str\n256        Description of `attr1`.\n257    attr2 : :obj:`int`, optional\n258        Description of `attr2`.\n259\n260    """\n261\n262    def __init__(self, param1, param2, param3):\n263        """Example of docstring on the __init__ method.\n264\n265        The __init__ method may be documented in either the class level\n266        docstring, or as a docstring on the __init__ method itself.\n267\n268        Either form is acceptable, but the two should not be mixed. Choose one\n269        convention to document the __init__ method and be consistent with it.\n270\n271        Note\n272        ----\n273        Do not include the `self` parameter in the ``Parameters`` section.\n274\n275        Parameters\n276        ----------\n277        param1 : str\n278            Description of `param1`.\n279        param2 : :obj:`list` of :obj:`str`\n280            Description of `param2`. Multiple\n281            lines are supported.\n282        param3 : :obj:`int`, optional\n283            Description of `param3`.\n284\n285        """\n286        self.attr1 = param1\n287        self.attr2 = param2\n288        self.attr3 = param3  #: Doc comment *inline* with attribute\n289\n290        #: list of str: Doc comment *before* attribute, with type specified\n291        self.attr4 = ["attr4"]\n292\n293        self.attr5 = None\n294        """str: Docstring *after* attribute, with type specified."""\n295\n296    @property\n297    def readonly_property(self):\n298        """str: Properties should be documented in their getter method."""\n299        return "readonly_property"\n300\n301    @property\n302    def readwrite_property(self):\n303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n304        should only be documented in their getter method.\n305\n306        If the setter method contains notable behavior, it should be\n307        mentioned here.\n308        """\n309        return ["readwrite_property"]\n310\n311    @readwrite_property.setter\n312    def readwrite_property(self, value):\n313        value\n314\n315    def example_method(self, param1, param2):\n316        """Class methods are similar to regular functions.\n317\n318        Note\n319        ----\n320        Do not include the `self` parameter in the ``Parameters`` section.\n321\n322        Parameters\n323        ----------\n324        param1\n325            The first parameter.\n326        param2\n327            The second parameter.\n328\n329        Returns\n330        -------\n331        bool\n332            True if successful, False otherwise.\n333\n334        """\n335        return True\n336\n337    def __special__(self):\n338        """By default special members with docstrings are not included.\n339\n340        Special members are any methods or attributes that start with and\n341        end with a double underscore. Any special member with a docstring\n342        will be included in the output, if\n343        ``napoleon_include_special_with_doc`` is set to True.\n344\n345        This behavior can be enabled by changing the following setting in\n346        Sphinx's conf.py::\n347\n348            napoleon_include_special_with_doc = True\n349\n350        """\n351        pass\n352\n353    def __special_without_docstring__(self):\n354        pass\n355\n356    def _private(self):\n357        """By default private members are not included.\n358\n359        Private members are any methods or attributes that start with an\n360        underscore and are *not* special. By default they are not included\n361        in the output.\n362\n363        This behavior can be changed such that private members *are* included\n364        by changing the following setting in Sphinx's conf.py::\n365\n366            napoleon_include_private_with_doc = True\n367\n368        """\n369        pass\n370\n371    def _private_without_docstring(self):\n372        pass\n373\n374\n375def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n376    r"""Summarize the function in one line.\n377\n378    Several sentences providing an extended description. Refer to\n379    variables using back-ticks, e.g. `var`.\n380\n381    Parameters\n382    ----------\n383    var1 : array_like\n384        Array_like means all those objects -- lists, nested lists, etc. --\n385        that can be converted to an array.  We can also refer to\n386        variables like `var1`.\n387    var2 : int\n388        The type above can either refer to an actual Python type\n389        (e.g. ``int``), or describe the type of the variable in more\n390        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n391    *args : iterable\n392        Other arguments.\n393    long_var_name : {'hi', 'ho'}, optional\n394        Choices in brackets, default first when optional.\n395    **kwargs : dict\n396        Keyword arguments.\n397\n398    Returns\n399    -------\n400    type\n401        Explanation of anonymous return value of type ``type``.\n402    describe : type\n403        Explanation of return value named `describe`.\n404    out : type\n405        Explanation of `out`.\n406    type_without_description\n407\n408    Other Parameters\n409    ----------------\n410    only_seldom_used_keywords : type\n411        Explanation.\n412    common_parameters_listed_above : type\n413        Explanation.\n414\n415    Raises\n416    ------\n417    BadException\n418        Because you shouldn't have done that.\n419\n420    See Also\n421    --------\n422    numpy.array : Relationship (optional).\n423    numpy.ndarray : Relationship (optional), which could be fairly long, in\n424                    which case the line wraps here.\n425    numpy.dot, numpy.linalg.norm, numpy.eye\n426\n427    Notes\n428    -----\n429    Notes about the implementation algorithm (if needed).\n430\n431    This can have multiple paragraphs.\n432\n433    You may include some math:\n434\n435    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n436\n437    And even use a Greek symbol like :math:`\\omega` inline.\n438\n439    References\n440    ----------\n441    Cite the relevant literature, e.g. [1]_.  You may also cite these\n442    references in the notes section above.\n443\n444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n445       expert systems and adaptive co-kriging for environmental habitat\n446       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n447       and neural-network techniques," Computers & Geosciences, vol. 22,\n448       pp. 585-588, 1996.\n449\n450    Examples\n451    --------\n452    These are written in doctest format, and should illustrate how to\n453    use the function.\n454\n455    >>> a = [1, 2, 3]\n456    >>> print([x + 3 for x in a])\n457    [4, 5, 6]\n458    >>> print("a\\nb")\n459    a\n460    b\n461    """\n462    # After closing class docstring, there should be one blank line to\n463    # separate following codes (according to PEP257).\n464    # But for function, method and module, there should be no blank lines\n465    # after closing the docstring.\n466    pass\n467\n468\n469def invalid_format(test):\n470    """\n471    In this example, there is no description for the test argument\n472\n473    Parameters\n474    ----------\n475    param1\n476\n477    """\n478\n479def invalid_format2() -> None:\n480    """\n481    Another example without description, but this time indented.\n482\n483    Returns\n484    -------\n485        Text describing the return value.\n486    """\n487\n488def invalid_format3() -> None:\n489    """\n490    Another example with a multiline text.\n491\n492    Returns\n493    -------\n494        Multiline text\n495        describing the return value.\n496    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
67def function_with_types_in_docstring(param1, param2):\n68    """Example function with types documented in the docstring.\n69\n70    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n71    return types are annotated according to `PEP 484`_, they do not need to be\n72    included in the docstring:\n73\n74    Parameters\n75    ----------\n76    param1 : int\n77        The first parameter.\n78    param2 : str\n79        The second parameter.\n80\n81    Returns\n82    -------\n83    bool\n84        True if successful, False otherwise.\n85\n86    .. _PEP 484:\n87        https://www.python.org/dev/peps/pep-0484/\n88\n89    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str):\nThe second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 93    """Example function with PEP 484 type annotations.\n 94\n 95    The return type must be duplicated in the docstring to comply\n 96    with the NumPy docstring style.\n 97\n 98    Parameters\n 99    ----------\n100    param1\n101        The first parameter.\n102    param2\n103        The second parameter.\n104\n105    Returns\n106    -------\n107    bool\n108        True if successful, False otherwise.\n109\n110    """\n111    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n

The return type must be duplicated in the docstring to comply\nwith the NumPy docstring style.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
114def module_level_function(param1, param2=None, *args, **kwargs):\n115    """This is an example of a module level function.\n116\n117    Function parameters should be documented in the ``Parameters`` section.\n118    The name of each parameter is required. The type and description of each\n119    parameter is optional, but should be included if not obvious.\n120\n121    If *args or **kwargs are accepted,\n122    they should be listed as ``*args`` and ``**kwargs``.\n123\n124    The format for a parameter is::\n125\n126        name : type\n127            description\n128\n129            The description may span multiple lines. Following lines\n130            should be indented to match the first line of the description.\n131            The ": type" is optional.\n132\n133            Multiple paragraphs are supported in parameter\n134            descriptions.\n135\n136    Parameters\n137    ----------\n138    param1 : int\n139        The first parameter.\n140    param2 : :obj:`str`, optional\n141        The second parameter.\n142    *args\n143        Variable length argument list.\n144    **kwargs\n145        Arbitrary keyword arguments.\n146\n147    Returns\n148    -------\n149    bool\n150        True if successful, False otherwise.\n151\n152        The return type is not optional. The ``Returns`` section may span\n153        multiple lines and paragraphs. Following lines should be indented to\n154        match the first line of the description.\n155\n156        The ``Returns`` section supports any reStructuredText formatting,\n157        including literal blocks::\n158\n159            {\n160                'param1': param1,\n161                'param2': param2\n162            }\n163\n164    Raises\n165    ------\n166    AttributeError\n167        The ``Raises`` section is a list of all exceptions\n168        that are relevant to the interface.\n169    ValueError\n170        If `param2` is equal to `param1`.\n171\n172    """\n173    if param1 == param2:\n174        raise ValueError('param1 may not be equal to param2')\n175    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Parameters section.\nThe name of each parameter is required. The type and description of each\nparameter is optional, but should be included if not obvious.

\n\n

If args or *kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name : type\n    description\n\n    The description may span multiple lines. Following lines\n    should be indented to match the first line of the description.\n    The ": type" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str, optional):\nThe second parameter.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n\n

The return type is not optional. The Returns section may span\nmultiple lines and paragraphs. Following lines should be indented to\nmatch the first line of the description.

\n\n

The Returns section supports any reStructuredText formatting,\nincluding literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n\n
Raises
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
178def example_generator(n):\n179    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n180\n181    Parameters\n182    ----------\n183    n : int\n184        The upper limit of the range to generate, from 0 to `n` - 1.\n185\n186    Yields\n187    ------\n188    int\n189        The next number in the range of 0 to `n` - 1.\n190\n191    Examples\n192    --------\n193    Examples should be written in doctest format, and should illustrate how\n194    to use the function.\n195\n196    >>> print([i for i in example_generator(4)])\n197    [0, 1, 2, 3]\n198\n199    """\n200    for i in range(n):\n201        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Parameters
\n\n
    \n
  • n (int):\nThe upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields
\n\n
    \n
  • int: The next number in the range of 0 to n - 1.
  • \n
\n\n
Examples
\n\n

Examples should be written in doctest format, and should illustrate how\nto use the function.

\n\n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
204class ExampleError(Exception):\n205    """Exceptions are documented in the same way as classes.\n206\n207    The __init__ method may be documented in either the class level\n208    docstring, or as a docstring on the __init__ method itself.\n209\n210    Either form is acceptable, but the two should not be mixed. Choose one\n211    convention to document the __init__ method and be consistent with it.\n212\n213    Note\n214    ----\n215    Do not include the `self` parameter in the ``Parameters`` section.\n216\n217    Parameters\n218    ----------\n219    msg : str\n220        Human readable string describing the exception.\n221    code : :obj:`int`, optional\n222        Numeric error code.\n223\n224    Attributes\n225    ----------\n226    msg : str\n227        Human readable string describing the exception.\n228    code : int\n229        Numeric error code.\n230\n231    """\n232\n233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n236\n237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n239\n240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int, optional):\nNumeric error code.
  • \n
\n\n
Attributes
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int):\nNumeric error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
243class ExampleClass(object):\n244    """The summary line for a class docstring should fit on one line.\n245\n246    If the class has public attributes, they may be documented here\n247    in an ``Attributes`` section and follow the same formatting as a\n248    function's ``Args`` section. Alternatively, attributes may be documented\n249    inline with the attribute's declaration (see __init__ method below).\n250\n251    Properties created with the ``@property`` decorator should be documented\n252    in the property's getter method.\n253\n254    Attributes\n255    ----------\n256    attr1 : str\n257        Description of `attr1`.\n258    attr2 : :obj:`int`, optional\n259        Description of `attr2`.\n260\n261    """\n262\n263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n296\n297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n301\n302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n311\n312    @readwrite_property.setter\n313    def readwrite_property(self, value):\n314        value\n315\n316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n337\n338    def __special__(self):\n339        """By default special members with docstrings are not included.\n340\n341        Special members are any methods or attributes that start with and\n342        end with a double underscore. Any special member with a docstring\n343        will be included in the output, if\n344        ``napoleon_include_special_with_doc`` is set to True.\n345\n346        This behavior can be enabled by changing the following setting in\n347        Sphinx's conf.py::\n348\n349            napoleon_include_special_with_doc = True\n350\n351        """\n352        pass\n353\n354    def __special_without_docstring__(self):\n355        pass\n356\n357    def _private(self):\n358        """By default private members are not included.\n359\n360        Private members are any methods or attributes that start with an\n361        underscore and are *not* special. By default they are not included\n362        in the output.\n363\n364        This behavior can be changed such that private members *are* included\n365        by changing the following setting in Sphinx's conf.py::\n366\n367            napoleon_include_private_with_doc = True\n368\n369        """\n370        pass\n371\n372    def _private_without_docstring(self):\n373        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes
\n\n
    \n
  • attr1 (str):\nDescription of attr1.
  • \n
  • attr2 (int, optional):\nDescription of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1 (str):\nDescription of param1.
  • \n
  • param2 (list of str):\nDescription of param2. Multiple\nlines are supported.
  • \n
  • param3 (int, optional):\nDescription of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n foo(var1, var2, *args, long_var_name='hi', **kwargs):\n\n \n\n
\n \n
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n377    r"""Summarize the function in one line.\n378\n379    Several sentences providing an extended description. Refer to\n380    variables using back-ticks, e.g. `var`.\n381\n382    Parameters\n383    ----------\n384    var1 : array_like\n385        Array_like means all those objects -- lists, nested lists, etc. --\n386        that can be converted to an array.  We can also refer to\n387        variables like `var1`.\n388    var2 : int\n389        The type above can either refer to an actual Python type\n390        (e.g. ``int``), or describe the type of the variable in more\n391        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n392    *args : iterable\n393        Other arguments.\n394    long_var_name : {'hi', 'ho'}, optional\n395        Choices in brackets, default first when optional.\n396    **kwargs : dict\n397        Keyword arguments.\n398\n399    Returns\n400    -------\n401    type\n402        Explanation of anonymous return value of type ``type``.\n403    describe : type\n404        Explanation of return value named `describe`.\n405    out : type\n406        Explanation of `out`.\n407    type_without_description\n408\n409    Other Parameters\n410    ----------------\n411    only_seldom_used_keywords : type\n412        Explanation.\n413    common_parameters_listed_above : type\n414        Explanation.\n415\n416    Raises\n417    ------\n418    BadException\n419        Because you shouldn't have done that.\n420\n421    See Also\n422    --------\n423    numpy.array : Relationship (optional).\n424    numpy.ndarray : Relationship (optional), which could be fairly long, in\n425                    which case the line wraps here.\n426    numpy.dot, numpy.linalg.norm, numpy.eye\n427\n428    Notes\n429    -----\n430    Notes about the implementation algorithm (if needed).\n431\n432    This can have multiple paragraphs.\n433\n434    You may include some math:\n435\n436    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n437\n438    And even use a Greek symbol like :math:`\\omega` inline.\n439\n440    References\n441    ----------\n442    Cite the relevant literature, e.g. [1]_.  You may also cite these\n443    references in the notes section above.\n444\n445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n446       expert systems and adaptive co-kriging for environmental habitat\n447       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n448       and neural-network techniques," Computers & Geosciences, vol. 22,\n449       pp. 585-588, 1996.\n450\n451    Examples\n452    --------\n453    These are written in doctest format, and should illustrate how to\n454    use the function.\n455\n456    >>> a = [1, 2, 3]\n457    >>> print([x + 3 for x in a])\n458    [4, 5, 6]\n459    >>> print("a\\nb")\n460    a\n461    b\n462    """\n463    # After closing class docstring, there should be one blank line to\n464    # separate following codes (according to PEP257).\n465    # But for function, method and module, there should be no blank lines\n466    # after closing the docstring.\n467    pass\n
\n\n\n

Summarize the function in one line.

\n\n

Several sentences providing an extended description. Refer to\nvariables using back-ticks, e.g. var.

\n\n
Parameters
\n\n
    \n
  • var1 (array_like):\nArray_like means all those objects -- lists, nested lists, etc. --\nthat can be converted to an array. We can also refer to\nvariables like var1.
  • \n
  • var2 (int):\nThe type above can either refer to an actual Python type\n(e.g. int), or describe the type of the variable in more\ndetail, e.g. (N,) ndarray or array_like.
  • \n
  • *args (iterable):\nOther arguments.
  • \n
  • long_var_name ({\'hi\', \'ho\'}, optional):\nChoices in brackets, default first when optional.
  • \n
  • **kwargs (dict):\nKeyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • type: Explanation of anonymous return value of type type.
  • \n
  • describe (type):\nExplanation of return value named describe.
  • \n
  • out (type):\nExplanation of out.
  • \n
  • type_without_description
  • \n
\n\n
Other Parameters
\n\n
    \n
  • only_seldom_used_keywords (type):\nExplanation.
  • \n
  • common_parameters_listed_above (type):\nExplanation.
  • \n
\n\n
Raises
\n\n
    \n
  • BadException: Because you shouldn\'t have done that.
  • \n
\n\n
See Also
\n\n

numpy.array: Relationship (optional).
\nnumpy.ndarray: Relationship (optional), which could be fairly long, in\nwhich case the line wraps here.
\nnumpy.dot,, numpy.linalg.norm,, numpy.eye

\n\n
Notes
\n\n

Notes about the implementation algorithm (if needed).

\n\n

This can have multiple paragraphs.

\n\n

You may include some math:

\n\n

$$X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}$$

\n\n

And even use a Greek symbol like \\( \\omega \\) inline.

\n\n
References
\n\n

Cite the relevant literature, e.g. 1. You may also cite these\nreferences in the notes section above.

\n\n
Examples
\n\n

These are written in doctest format, and should illustrate how to\nuse the function.

\n\n
\n
>>> a = [1, 2, 3]\n>>> print([x + 3 for x in a])\n[4, 5, 6]\n>>> print("a\\nb")\na\nb\n
\n
\n\n
\n
\n
    \n
  1. \n

    O. McNoleg, "The integration of GIS, remote sensing,\nexpert systems and adaptive co-kriging for environmental habitat\nmodelling of the Highland Haggis using object-oriented, fuzzy-logic\nand neural-network techniques," Computers & Geosciences, vol. 22,\npp. 585-588, 1996. 

    \n
  2. \n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
470def invalid_format(test):\n471    """\n472    In this example, there is no description for the test argument\n473\n474    Parameters\n475    ----------\n476    param1\n477\n478    """\n
\n\n\n

In this example, there is no description for the test argument

\n\n
Parameters
\n\n
    \n
  • param1
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format2() -> None:\n\n \n\n
\n \n
480def invalid_format2() -> None:\n481    """\n482    Another example without description, but this time indented.\n483\n484    Returns\n485    -------\n486        Text describing the return value.\n487    """\n
\n\n\n

Another example without description, but this time indented.

\n\n
Returns
\n\n
    \n
  • Text describing the return value.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format3() -> None:\n\n \n\n
\n \n
489def invalid_format3() -> None:\n490    """\n491    Another example with a multiline text.\n492\n493    Returns\n494    -------\n495        Multiline text\n496        describing the return value.\n497    """\n
\n\n\n

Another example with a multiline text.

\n\n
Returns
\n\n
    \n
  • Multiline text
  • \n
  • describing the return value.
  • \n
\n
\n\n\n
\n
\n\n' E E E E E E E E flavors_numpy API documentation E E E E E E E E E E
E
E

E flavors_numpy

E E

Example NumPy-style docstrings.

E E

This module demonstrates documentation as specified by the NumPy E Documentation HOWTO. Docstrings may extend over multiple lines. Sections E are created with a section header followed by an underline of equal length.

E E
Example
E E

Examples can be given using either the Example or Examples E sections. Sections support any reStructuredText formatting, including E literal blocks::

E E
$ python example_numpy.py
E           
E E

Section breaks are created with two blank lines. Section breaks are also E implicitly created anytime a new section starts. Section bodies may be E indented:

E E
Notes
E E

This is an example of an indented section. It's like any other section, E but the body is indented to help it stand out from surrounding text. E If a section is indented, then a section break is created by E resuming unindented text.

E E
Attributes
E E
    E
  • module_level_variable1 (int): E Module level variables may be documented in either the Attributes E section of the module docstring, or in an inline docstring immediately E following the variable.

    E E

    Either form is acceptable, but the two should not be mixed. Choose E one convention to document module level variables and be consistent E with it.

  • E
E
E E E E E E
  1# Examples taken from:
E             2#
E             3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
E             4#   License: BSD-3
E             5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py
E             6#   License: BSD-2
E             7#
E             8# flake8: noqa
E             9# fmt: off
E            10"""Example NumPy-style docstrings.
E            11
E            12This module demonstrates documentation as specified by the `NumPy
E            13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections
E            14are created with a section header followed by an underline of equal length.
E            15
E            16Example
E            17-------
E            18Examples can be given using either the ``Example`` or ``Examples``
E            19sections. Sections support any reStructuredText formatting, including
E            20literal blocks::
E            21
E            22    $ python example_numpy.py
E            23
E            24
E            25Section breaks are created with two blank lines. Section breaks are also
E            26implicitly created anytime a new section starts. Section bodies *may* be
E            27indented:
E            28
E            29Notes
E            30-----
E            31    This is an example of an indented section. It's like any other section,
E            32    but the body is indented to help it stand out from surrounding text.
E            33
E            34If a section is indented, then a section break is created by
E            35resuming unindented text.
E            36
E            37Attributes
E            38----------
E            39module_level_variable1 : int
E            40    Module level variables may be documented in either the ``Attributes``
E            41    section of the module docstring, or in an inline docstring immediately
E            42    following the variable.
E            43
E            44    Either form is acceptable, but the two should not be mixed. Choose
E            45    one convention to document module level variables and be consistent
E            46    with it.
E            47
E            48
E            49.. _NumPy Documentation HOWTO:
E            50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
E            51
E            52"""
E            53__docformat__ = "numpy"
E            54
E            55
E            56module_level_variable1 = 12345
E            57
E            58module_level_variable2 = 98765
E            59"""int: Module level variable documented inline.
E            60
E            61The docstring may span multiple lines. The type may optionally be specified
E            62on the first line, separated by a colon.
E            63"""
E            64
E            65
E            66def function_with_types_in_docstring(param1, param2):
E            67    """Example function with types documented in the docstring.
E            68
E            69    `PEP 484`_ type annotations are supported. If attribute, parameter, and
E            70    return types are annotated according to `PEP 484`_, they do not need to be
E            71    included in the docstring:
E            72
E            73    Parameters
E            74    ----------
E            75    param1 : int
E            76        The first parameter.
E            77    param2 : str
E            78        The second parameter.
E            79
E            80    Returns
E            81    -------
E            82    bool
E            83        True if successful, False otherwise.
E            84
E            85    .. _PEP 484:
E            86        https://www.python.org/dev/peps/pep-0484/
E            87
E            88    """
E            89
E            90
E            91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
E            92    """Example function with PEP 484 type annotations.
E            93
E            94    The return type must be duplicated in the docstring to comply
E            95    with the NumPy docstring style.
E            96
E            97    Parameters
E            98    ----------
E            99    param1
E           100        The first parameter.
E           101    param2
E           102        The second parameter.
E           103
E           104    Returns
E           105    -------
E           106    bool
E           107        True if successful, False otherwise.
E           108
E           109    """
E           110    raise NotImplementedError
E           111
E           112
E           113def module_level_function(param1, param2=None, *args, **kwargs):
E           114    """This is an example of a module level function.
E           115
E           116    Function parameters should be documented in the ``Parameters`` section.
E           117    The name of each parameter is required. The type and description of each
E           118    parameter is optional, but should be included if not obvious.
E           119
E           120    If *args or **kwargs are accepted,
E           121    they should be listed as ``*args`` and ``**kwargs``.
E           122
E           123    The format for a parameter is::
E           124
E           125        name : type
E           126            description
E           127
E           128            The description may span multiple lines. Following lines
E           129            should be indented to match the first line of the description.
E           130            The ": type" is optional.
E           131
E           132            Multiple paragraphs are supported in parameter
E           133            descriptions.
E           134
E           135    Parameters
E           136    ----------
E           137    param1 : int
E           138        The first parameter.
E           139    param2 : :obj:`str`, optional
E           140        The second parameter.
E           141    *args
E           142        Variable length argument list.
E           143    **kwargs
E           144        Arbitrary keyword arguments.
E           145
E           146    Returns
E           147    -------
E           148    bool
E           149        True if successful, False otherwise.
E           150
E           151        The return type is not optional. The ``Returns`` section may span
E           152        multiple lines and paragraphs. Following lines should be indented to
E           153        match the first line of the description.
E           154
E           155        The ``Returns`` section supports any reStructuredText formatting,
E           156        including literal blocks::
E           157
E           158            {
E           159                'param1': param1,
E           160                'param2': param2
E           161            }
E           162
E           163    Raises
E           164    ------
E           165    AttributeError
E           166        The ``Raises`` section is a list of all exceptions
E           167        that are relevant to the interface.
E           168    ValueError
E           169        If `param2` is equal to `param1`.
E           170
E           171    """
E           172    if param1 == param2:
E           173        raise ValueError('param1 may not be equal to param2')
E           174    return True
E           175
E           176
E           177def example_generator(n):
E           178    """Generators have a ``Yields`` section instead of a ``Returns`` section.
E           179
E           180    Parameters
E           181    ----------
E           182    n : int
E           183        The upper limit of the range to generate, from 0 to `n` - 1.
E           184
E           185    Yields
E           186    ------
E           187    int
E           188        The next number in the range of 0 to `n` - 1.
E           189
E           190    Examples
E           191    --------
E           192    Examples should be written in doctest format, and should illustrate how
E           193    to use the function.
E           194
E           195    >>> print([i for i in example_generator(4)])
E           196    [0, 1, 2, 3]
E           197
E           198    """
E           199    for i in range(n):
E           200        yield i
E           201
E           202
E           203class ExampleError(Exception):
E           204    """Exceptions are documented in the same way as classes.
E           205
E           206    The __init__ method may be documented in either the class level
E           207    docstring, or as a docstring on the __init__ method itself.
E           208
E           209    Either form is acceptable, but the two should not be mixed. Choose one
E           210    convention to document the __init__ method and be consistent with it.
E           211
E           212    Note
E           213    ----
E           214    Do not include the `self` parameter in the ``Parameters`` section.
E           215
E           216    Parameters
E           217    ----------
E           218    msg : str
E           219        Human readable string describing the exception.
E           220    code : :obj:`int`, optional
E           221        Numeric error code.
E           222
E           223    Attributes
E           224    ----------
E           225    msg : str
E           226        Human readable string describing the exception.
E           227    code : int
E           228        Numeric error code.
E           229
E           230    """
E           231
E           232    def __init__(self, msg, code):
E           233        self.msg = msg
E           234        self.code = code
E           235
E           236    def add_note(self, note: str):
E           237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           238
E           239    def with_traceback(self, object, /):
E           240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           241
E           242class ExampleClass(object):
E           243    """The summary line for a class docstring should fit on one line.
E           244
E           245    If the class has public attributes, they may be documented here
E           246    in an ``Attributes`` section and follow the same formatting as a
E           247    function's ``Args`` section. Alternatively, attributes may be documented
E           248    inline with the attribute's declaration (see __init__ method below).
E           249
E           250    Properties created with the ``@property`` decorator should be documented
E           251    in the property's getter method.
E           252
E           253    Attributes
E           254    ----------
E           255    attr1 : str
E           256        Description of `attr1`.
E           257    attr2 : :obj:`int`, optional
E           258        Description of `attr2`.
E           259
E           260    """
E           261
E           262    def __init__(self, param1, param2, param3):
E           263        """Example of docstring on the __init__ method.
E           264
E           265        The __init__ method may be documented in either the class level
E           266        docstring, or as a docstring on the __init__ method itself.
E           267
E           268        Either form is acceptable, but the two should not be mixed. Choose one
E           269        convention to document the __init__ method and be consistent with it.
E           270
E           271        Note
E           272        ----
E           273        Do not include the `self` parameter in the ``Parameters`` section.
E           274
E           275        Parameters
E           276        ----------
E           277        param1 : str
E           278            Description of `param1`.
E           279        param2 : :obj:`list` of :obj:`str`
E           280            Description of `param2`. Multiple
E           281            lines are supported.
E           282        param3 : :obj:`int`, optional
E           283            Description of `param3`.
E           284
E           285        """
E           286        self.attr1 = param1
E           287        self.attr2 = param2
E           288        self.attr3 = param3  #: Doc comment *inline* with attribute
E           289
E           290        #: list of str: Doc comment *before* attribute, with type specified
E           291        self.attr4 = ["attr4"]
E           292
E           293        self.attr5 = None
E           294        """str: Docstring *after* attribute, with type specified."""
E           295
E           296    @property
E           297    def readonly_property(self):
E           298        """str: Properties should be documented in their getter method."""
E           299        return "readonly_property"
E           300
E           301    @property
E           302    def readwrite_property(self):
E           303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           304        should only be documented in their getter method.
E           305
E           306        If the setter method contains notable behavior, it should be
E           307        mentioned here.
E           308        """
E           309        return ["readwrite_property"]
E           310
E           311    @readwrite_property.setter
E           312    def readwrite_property(self, value):
E           313        value
E           314
E           315    def example_method(self, param1, param2):
E           316        """Class methods are similar to regular functions.
E           317
E           318        Note
E           319        ----
E           320        Do not include the `self` parameter in the ``Parameters`` section.
E           321
E           322        Parameters
E           323        ----------
E           324        param1
E           325            The first parameter.
E           326        param2
E           327            The second parameter.
E           328
E           329        Returns
E           330        -------
E           331        bool
E           332            True if successful, False otherwise.
E           333
E           334        """
E           335        return True
E           336
E           337    def __special__(self):
E           338        """By default special members with docstrings are not included.
E           339
E           340        Special members are any methods or attributes that start with and
E           341        end with a double underscore. Any special member with a docstring
E           342        will be included in the output, if
E           343        ``napoleon_include_special_with_doc`` is set to True.
E           344
E           345        This behavior can be enabled by changing the following setting in
E           346        Sphinx's conf.py::
E           347
E           348            napoleon_include_special_with_doc = True
E           349
E           350        """
E           351        pass
E           352
E           353    def __special_without_docstring__(self):
E           354        pass
E           355
E           356    def _private(self):
E           357        """By default private members are not included.
E           358
E           359        Private members are any methods or attributes that start with an
E           360        underscore and are *not* special. By default they are not included
E           361        in the output.
E           362
E           363        This behavior can be changed such that private members *are* included
E           364        by changing the following setting in Sphinx's conf.py::
E           365
E           366            napoleon_include_private_with_doc = True
E           367
E           368        """
E           369        pass
E           370
E           371    def _private_without_docstring(self):
E           372        pass
E           373
E           374
E           375def foo(var1, var2, *args, long_var_name='hi', **kwargs):
E           376    r"""Summarize the function in one line.
E           377
E           378    Several sentences providing an extended description. Refer to
E           379    variables using back-ticks, e.g. `var`.
E           380
E           381    Parameters
E           382    ----------
E           383    var1 : array_like
E           384        Array_like means all those objects -- lists, nested lists, etc. --
E           385        that can be converted to an array.  We can also refer to
E           386        variables like `var1`.
E           387    var2 : int
E           388        The type above can either refer to an actual Python type
E           389        (e.g. ``int``), or describe the type of the variable in more
E           390        detail, e.g. ``(N,) ndarray`` or ``array_like``.
E           391    *args : iterable
E           392        Other arguments.
E           393    long_var_name : {'hi', 'ho'}, optional
E           394        Choices in brackets, default first when optional.
E           395    **kwargs : dict
E           396        Keyword arguments.
E           397
E           398    Returns
E           399    -------
E           400    type
E           401        Explanation of anonymous return value of type ``type``.
E           402    describe : type
E           403        Explanation of return value named `describe`.
E           404    out : type
E           405        Explanation of `out`.
E           406    type_without_description
E           407
E           408    Other Parameters
E           409    ----------------
E           410    only_seldom_used_keywords : type
E           411        Explanation.
E           412    common_parameters_listed_above : type
E           413        Explanation.
E           414
E           415    Raises
E           416    ------
E           417    BadException
E           418        Because you shouldn't have done that.
E           419
E           420    See Also
E           421    --------
E           422    numpy.array : Relationship (optional).
E           423    numpy.ndarray : Relationship (optional), which could be fairly long, in
E           424                    which case the line wraps here.
E           425    numpy.dot, numpy.linalg.norm, numpy.eye
E           426
E           427    Notes
E           428    -----
E           429    Notes about the implementation algorithm (if needed).
E           430
E           431    This can have multiple paragraphs.
E           432
E           433    You may include some math:
E           434
E           435    .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
E           436
E           437    And even use a Greek symbol like :math:`\omega` inline.
E           438
E           439    References
E           440    ----------
E           441    Cite the relevant literature, e.g. [1]_.  You may also cite these
E           442    references in the notes section above.
E           443
E           444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,
E           445       expert systems and adaptive co-kriging for environmental habitat
E           446       modelling of the Highland Haggis using object-oriented, fuzzy-logic
E           447       and neural-network techniques," Computers & Geosciences, vol. 22,
E           448       pp. 585-588, 1996.
E           449
E           450    Examples
E           451    --------
E           452    These are written in doctest format, and should illustrate how to
E           453    use the function.
E           454
E           455    >>> a = [1, 2, 3]
E           456    >>> print([x + 3 for x in a])
E           457    [4, 5, 6]
E           458    >>> print("a\nb")
E           459    a
E           460    b
E           461    """
E           462    # After closing class docstring, there should be one blank line to
E           463    # separate following codes (according to PEP257).
E           464    # But for function, method and module, there should be no blank lines
E           465    # after closing the docstring.
E           466    pass
E           467
E           468
E           469def invalid_format(test):
E           470    """
E           471    In this example, there is no description for the test argument
E           472
E           473    Parameters
E           474    ----------
E           475    param1
E           476
E           477    """
E           478
E           479def invalid_format2() -> None:
E           480    """
E           481    Another example without description, but this time indented.
E           482
E           483    Returns
E           484    -------
E           485        Text describing the return value.
E           486    """
E           487
E           488def invalid_format3() -> None:
E           489    """
E           490    Another example with a multiline text.
E           491
E           492    Returns
E           493    -------
E           494        Multiline text
E           495        describing the return value.
E           496    """
E           
E E E
E
E
E module_level_variable1 = E 12345 E E E
E E E E E
E
E
E module_level_variable2 = E 98765 E E E
E E E

int: Module level variable documented inline.

E E

The docstring may span multiple lines. The type may optionally be specified E on the first line, separated by a colon.

E
E E E
E
E E
E E def E function_with_types_in_docstring(param1, param2): E E E E
E E
67def function_with_types_in_docstring(param1, param2):
E           68    """Example function with types documented in the docstring.
E           69
E           70    `PEP 484`_ type annotations are supported. If attribute, parameter, and
E           71    return types are annotated according to `PEP 484`_, they do not need to be
E           72    included in the docstring:
E           73
E           74    Parameters
E           75    ----------
E           76    param1 : int
E           77        The first parameter.
E           78    param2 : str
E           79        The second parameter.
E           80
E           81    Returns
E           82    -------
E           83    bool
E           84        True if successful, False otherwise.
E           85
E           86    .. _PEP 484:
E           87        https://www.python.org/dev/peps/pep-0484/
E           88
E           89    """
E           
E E E

Example function with types documented in the docstring.

E E

PEP 484 type annotations are supported. If attribute, parameter, and E return types are annotated according to PEP 484, they do not need to be E included in the docstring:

E E
Parameters
E E
    E
  • param1 (int): E The first parameter.
  • E
  • param2 (str): E The second parameter.
  • E
E E
Returns
E E
    E
  • bool: True if successful, False otherwise.
  • E
E
E E E
E
E E
E E def E function_with_pep484_type_annotations(param1: int, param2: str) -> bool: E E E E
E E
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
E            93    """Example function with PEP 484 type annotations.
E            94
E            95    The return type must be duplicated in the docstring to comply
E            96    with the NumPy docstring style.
E            97
E            98    Parameters
E            99    ----------
E           100    param1
E           101        The first parameter.
E           102    param2
E           103        The second parameter.
E           104
E           105    Returns
E           106    -------
E           107    bool
E           108        True if successful, False otherwise.
E           109
E           110    """
E           111    raise NotImplementedError
E           
E E E

Example function with PEP 484 type annotations.

E E

The return type must be duplicated in the docstring to comply E with the NumPy docstring style.

E E
Parameters
E E
    E
  • param1: The first parameter.
  • E
  • param2: The second parameter.
  • E
E E
Returns
E E
    E
  • bool: True if successful, False otherwise.
  • E
E
E E E
E
E E
E E def E module_level_function(param1, param2=None, *args, **kwargs): E E E E
E E
114def module_level_function(param1, param2=None, *args, **kwargs):
E           115    """This is an example of a module level function.
E           116
E           117    Function parameters should be documented in the ``Parameters`` section.
E           118    The name of each parameter is required. The type and description of each
E           119    parameter is optional, but should be included if not obvious.
E           120
E           121    If *args or **kwargs are accepted,
E           122    they should be listed as ``*args`` and ``**kwargs``.
E           123
E           124    The format for a parameter is::
E           125
E           126        name : type
E           127            description
E           128
E           129            The description may span multiple lines. Following lines
E           130            should be indented to match the first line of the description.
E           131            The ": type" is optional.
E           132
E           133            Multiple paragraphs are supported in parameter
E           134            descriptions.
E           135
E           136    Parameters
E           137    ----------
E           138    param1 : int
E           139        The first parameter.
E           140    param2 : :obj:`str`, optional
E           141        The second parameter.
E           142    *args
E           143        Variable length argument list.
E           144    **kwargs
E           145        Arbitrary keyword arguments.
E           146
E           147    Returns
E           148    -------
E           149    bool
E           150        True if successful, False otherwise.
E           151
E           152        The return type is not optional. The ``Returns`` section may span
E           153        multiple lines and paragraphs. Following lines should be indented to
E           154        match the first line of the description.
E           155
E           156        The ``Returns`` section supports any reStructuredText formatting,
E           157        including literal blocks::
E           158
E           159            {
E           160                'param1': param1,
E           161                'param2': param2
E           162            }
E           163
E           164    Raises
E           165    ------
E           166    AttributeError
E           167        The ``Raises`` section is a list of all exceptions
E           168        that are relevant to the interface.
E           169    ValueError
E           170        If `param2` is equal to `param1`.
E           171
E           172    """
E           173    if param1 == param2:
E           174        raise ValueError('param1 may not be equal to param2')
E           175    return True
E           
E E E

This is an example of a module level function.

E E

Function parameters should be documented in the Parameters section. E The name of each parameter is required. The type and description of each E parameter is optional, but should be included if not obvious.

E E -

If args or *kwargs are accepted, E ? ^^^^ ^^^^^ E +

If *args or **kwargs are accepted, E ? ^ ^ E they should be listed as *args and **kwargs.

E E

The format for a parameter is::

E E
name : type
E               description
E           
E               The description may span multiple lines. Following lines
E               should be indented to match the first line of the description.
E               The ": type" is optional.
E           
E               Multiple paragraphs are supported in parameter
E               descriptions.
E           
E E
Parameters
E E
    E
  • param1 (int): E The first parameter.
  • E
  • param2 (str, optional): E The second parameter.
  • E -
  • *args: Variable length argument list.
  • E ? - E +
  • *args: Variable length argument list.
  • E ? + E -
  • **kwargs: Arbitrary keyword arguments.
  • E ? -- E +
  • **kwargs: Arbitrary keyword arguments.
  • E ? ++ E
E E
Returns
E E
    E
  • bool: True if successful, False otherwise.
  • E
E E

The return type is not optional. The Returns section may span E multiple lines and paragraphs. Following lines should be indented to E match the first line of the description.

E E

The Returns section supports any reStructuredText formatting, E including literal blocks::

E E
{
E               'param1': param1,
E               'param2': param2
E           }
E           
E E
Raises
E E
    E
  • AttributeError: The Raises section is a list of all exceptions E that are relevant to the interface.
  • E
  • ValueError: If param2 is equal to param1.
  • E
E
E E E
E
E E
E E def E example_generator(n): E E E E
E E
178def example_generator(n):
E           179    """Generators have a ``Yields`` section instead of a ``Returns`` section.
E           180
E           181    Parameters
E           182    ----------
E           183    n : int
E           184        The upper limit of the range to generate, from 0 to `n` - 1.
E           185
E           186    Yields
E           187    ------
E           188    int
E           189        The next number in the range of 0 to `n` - 1.
E           190
E           191    Examples
E           192    --------
E           193    Examples should be written in doctest format, and should illustrate how
E           194    to use the function.
E           195
E           196    >>> print([i for i in example_generator(4)])
E           197    [0, 1, 2, 3]
E           198
E           199    """
E           200    for i in range(n):
E           201        yield i
E           
E E E

Generators have a Yields section instead of a Returns section.

E E
Parameters
E E
    E
  • n (int): E The upper limit of the range to generate, from 0 to n - 1.
  • E
E E
Yields
E E
    E
  • int: The next number in the range of 0 to n - 1.
  • E
E E
Examples
E E

Examples should be written in doctest format, and should illustrate how E to use the function.

E E
E
>>> print([i for i in example_generator(4)])
E           [0, 1, 2, 3]
E           
E
E
E E E
E
E E
E E class E ExampleError(builtins.Exception): E E E E
E E
204class ExampleError(Exception):
E           205    """Exceptions are documented in the same way as classes.
E           206
E           207    The __init__ method may be documented in either the class level
E           208    docstring, or as a docstring on the __init__ method itself.
E           209
E           210    Either form is acceptable, but the two should not be mixed. Choose one
E           211    convention to document the __init__ method and be consistent with it.
E           212
E           213    Note
E           214    ----
E           215    Do not include the `self` parameter in the ``Parameters`` section.
E           216
E           217    Parameters
E           218    ----------
E           219    msg : str
E           220        Human readable string describing the exception.
E           221    code : :obj:`int`, optional
E           222        Numeric error code.
E           223
E           224    Attributes
E           225    ----------
E           226    msg : str
E           227        Human readable string describing the exception.
E           228    code : int
E           229        Numeric error code.
E           230
E           231    """
E           232
E           233    def __init__(self, msg, code):
E           234        self.msg = msg
E           235        self.code = code
E           236
E           237    def add_note(self, note: str):
E           238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           239
E           240    def with_traceback(self, object, /):
E           241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           
E E E

Exceptions are documented in the same way as classes.

E E

The __init__ method may be documented in either the class level E docstring, or as a docstring on the __init__ method itself.

E E

Either form is acceptable, but the two should not be mixed. Choose one E convention to document the __init__ method and be consistent with it.

E E
Note
E E

Do not include the self parameter in the Parameters section.

E E
Parameters
E E
    E
  • msg (str): E Human readable string describing the exception.
  • E
  • code (int, optional): E Numeric error code.
  • E
E E
Attributes
E E
    E
  • msg (str): E Human readable string describing the exception.
  • E
  • code (int): E Numeric error code.
  • E
E
E E E
E E
E E ExampleError(msg, code) E E E E
E E
233    def __init__(self, msg, code):
E           234        self.msg = msg
E           235        self.code = code
E           
E E E E E
E
E
E msg E E E
E E E E E
E
E
E code E E E
E E E E E
E
E E
E E def E add_note(self, note: str): E E E E
E E
237    def add_note(self, note: str):
E           238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
E           
E E E

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

E
E E E
E
E E
E E def E with_traceback(self, object, /): E E E E
E E
240    def with_traceback(self, object, /):
E           241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
E           
E E E

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

E
E E E
E
E
E E
E E class E ExampleClass: E E E E
E E
243class ExampleClass(object):
E           244    """The summary line for a class docstring should fit on one line.
E           245
E           246    If the class has public attributes, they may be documented here
E           247    in an ``Attributes`` section and follow the same formatting as a
E           248    function's ``Args`` section. Alternatively, attributes may be documented
E           249    inline with the attribute's declaration (see __init__ method below).
E           250
E           251    Properties created with the ``@property`` decorator should be documented
E           252    in the property's getter method.
E           253
E           254    Attributes
E           255    ----------
E           256    attr1 : str
E           257        Description of `attr1`.
E           258    attr2 : :obj:`int`, optional
E           259        Description of `attr2`.
E           260
E           261    """
E           262
E           263    def __init__(self, param1, param2, param3):
E           264        """Example of docstring on the __init__ method.
E           265
E           266        The __init__ method may be documented in either the class level
E           267        docstring, or as a docstring on the __init__ method itself.
E           268
E           269        Either form is acceptable, but the two should not be mixed. Choose one
E           270        convention to document the __init__ method and be consistent with it.
E           271
E           272        Note
E           273        ----
E           274        Do not include the `self` parameter in the ``Parameters`` section.
E           275
E           276        Parameters
E           277        ----------
E           278        param1 : str
E           279            Description of `param1`.
E           280        param2 : :obj:`list` of :obj:`str`
E           281            Description of `param2`. Multiple
E           282            lines are supported.
E           283        param3 : :obj:`int`, optional
E           284            Description of `param3`.
E           285
E           286        """
E           287        self.attr1 = param1
E           288        self.attr2 = param2
E           289        self.attr3 = param3  #: Doc comment *inline* with attribute
E           290
E           291        #: list of str: Doc comment *before* attribute, with type specified
E           292        self.attr4 = ["attr4"]
E           293
E           294        self.attr5 = None
E           295        """str: Docstring *after* attribute, with type specified."""
E           296
E           297    @property
E           298    def readonly_property(self):
E           299        """str: Properties should be documented in their getter method."""
E           300        return "readonly_property"
E           301
E           302    @property
E           303    def readwrite_property(self):
E           304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           305        should only be documented in their getter method.
E           306
E           307        If the setter method contains notable behavior, it should be
E           308        mentioned here.
E           309        """
E           310        return ["readwrite_property"]
E           311
E           312    @readwrite_property.setter
E           313    def readwrite_property(self, value):
E           314        value
E           315
E           316    def example_method(self, param1, param2):
E           317        """Class methods are similar to regular functions.
E           318
E           319        Note
E           320        ----
E           321        Do not include the `self` parameter in the ``Parameters`` section.
E           322
E           323        Parameters
E           324        ----------
E           325        param1
E           326            The first parameter.
E           327        param2
E           328            The second parameter.
E           329
E           330        Returns
E           331        -------
E           332        bool
E           333            True if successful, False otherwise.
E           334
E           335        """
E           336        return True
E           337
E           338    def __special__(self):
E           339        """By default special members with docstrings are not included.
E           340
E           341        Special members are any methods or attributes that start with and
E           342        end with a double underscore. Any special member with a docstring
E           343        will be included in the output, if
E           344        ``napoleon_include_special_with_doc`` is set to True.
E           345
E           346        This behavior can be enabled by changing the following setting in
E           347        Sphinx's conf.py::
E           348
E           349            napoleon_include_special_with_doc = True
E           350
E           351        """
E           352        pass
E           353
E           354    def __special_without_docstring__(self):
E           355        pass
E           356
E           357    def _private(self):
E           358        """By default private members are not included.
E           359
E           360        Private members are any methods or attributes that start with an
E           361        underscore and are *not* special. By default they are not included
E           362        in the output.
E           363
E           364        This behavior can be changed such that private members *are* included
E           365        by changing the following setting in Sphinx's conf.py::
E           366
E           367            napoleon_include_private_with_doc = True
E           368
E           369        """
E           370        pass
E           371
E           372    def _private_without_docstring(self):
E           373        pass
E           
E E E

The summary line for a class docstring should fit on one line.

E E

If the class has public attributes, they may be documented here E in an Attributes section and follow the same formatting as a E function's Args section. Alternatively, attributes may be documented E inline with the attribute's declaration (see __init__ method below).

E E

Properties created with the @property decorator should be documented E in the property's getter method.

E E
Attributes
E E
    E
  • attr1 (str): E Description of attr1.
  • E
  • attr2 (int, optional): E Description of attr2.
  • E
E
E E E
E E
E E ExampleClass(param1, param2, param3) E E E E
E E
263    def __init__(self, param1, param2, param3):
E           264        """Example of docstring on the __init__ method.
E           265
E           266        The __init__ method may be documented in either the class level
E           267        docstring, or as a docstring on the __init__ method itself.
E           268
E           269        Either form is acceptable, but the two should not be mixed. Choose one
E           270        convention to document the __init__ method and be consistent with it.
E           271
E           272        Note
E           273        ----
E           274        Do not include the `self` parameter in the ``Parameters`` section.
E           275
E           276        Parameters
E           277        ----------
E           278        param1 : str
E           279            Description of `param1`.
E           280        param2 : :obj:`list` of :obj:`str`
E           281            Description of `param2`. Multiple
E           282            lines are supported.
E           283        param3 : :obj:`int`, optional
E           284            Description of `param3`.
E           285
E           286        """
E           287        self.attr1 = param1
E           288        self.attr2 = param2
E           289        self.attr3 = param3  #: Doc comment *inline* with attribute
E           290
E           291        #: list of str: Doc comment *before* attribute, with type specified
E           292        self.attr4 = ["attr4"]
E           293
E           294        self.attr5 = None
E           295        """str: Docstring *after* attribute, with type specified."""
E           
E E E

Example of docstring on the __init__ method.

E E

The __init__ method may be documented in either the class level E docstring, or as a docstring on the __init__ method itself.

E E

Either form is acceptable, but the two should not be mixed. Choose one E convention to document the __init__ method and be consistent with it.

E E
Note
E E

Do not include the self parameter in the Parameters section.

E E
Parameters
E E
    E
  • param1 (str): E Description of param1.
  • E
  • param2 (list of str): E Description of param2. Multiple E lines are supported.
  • E
  • param3 (int, optional): E Description of param3.
  • E
E
E E E
E
E
E attr1 E E E
E E E E E
E
E
E attr2 E E E
E E E E E
E
E
E attr3 E E E
E E E E E
E
E
E attr4 E E E
E E E E E
E
E
E attr5 E E E
E E E

str: Docstring after attribute, with type specified.

E
E E E
E
E E
E readonly_property E E E E
E E
297    @property
E           298    def readonly_property(self):
E           299        """str: Properties should be documented in their getter method."""
E           300        return "readonly_property"
E           
E E E

str: Properties should be documented in their getter method.

E
E E E
E
E E
E readwrite_property E E E E
E E
302    @property
E           303    def readwrite_property(self):
E           304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
E           305        should only be documented in their getter method.
E           306
E           307        If the setter method contains notable behavior, it should be
E           308        mentioned here.
E           309        """
E           310        return ["readwrite_property"]
E           
E E E

list of str: Properties with both a getter and setter E should only be documented in their getter method.

E E

If the setter method contains notable behavior, it should be E mentioned here.

E
E E E
E
E E
E E def E example_method(self, param1, param2): E E E E
E E
316    def example_method(self, param1, param2):
E           317        """Class methods are similar to regular functions.
E           318
E           319        Note
E           320        ----
E           321        Do not include the `self` parameter in the ``Parameters`` section.
E           322
E           323        Parameters
E           324        ----------
E           325        param1
E           326            The first parameter.
E           327        param2
E           328            The second parameter.
E           329
E           330        Returns
E           331        -------
E           332        bool
E           333            True if successful, False otherwise.
E           334
E           335        """
E           336        return True
E           
E E E

Class methods are similar to regular functions.

E E
Note
E E

Do not include the self parameter in the Parameters section.

E E
Parameters
E E
    E
  • param1: The first parameter.
  • E
  • param2: The second parameter.
  • E
E E
Returns
E E
    E
  • bool: True if successful, False otherwise.
  • E
E
E E E
E
E
E E
E E def E foo(var1, var2, *args, long_var_name='hi', **kwargs): E E E E
E E
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):
E           377    r"""Summarize the function in one line.
E           378
E           379    Several sentences providing an extended description. Refer to
E           380    variables using back-ticks, e.g. `var`.
E           381
E           382    Parameters
E           383    ----------
E           384    var1 : array_like
E           385        Array_like means all those objects -- lists, nested lists, etc. --
E           386        that can be converted to an array.  We can also refer to
E           387        variables like `var1`.
E           388    var2 : int
E           389        The type above can either refer to an actual Python type
E           390        (e.g. ``int``), or describe the type of the variable in more
E           391        detail, e.g. ``(N,) ndarray`` or ``array_like``.
E           392    *args : iterable
E           393        Other arguments.
E           394    long_var_name : {'hi', 'ho'}, optional
E           395        Choices in brackets, default first when optional.
E           396    **kwargs : dict
E           397        Keyword arguments.
E           398
E           399    Returns
E           400    -------
E           401    type
E           402        Explanation of anonymous return value of type ``type``.
E           403    describe : type
E           404        Explanation of return value named `describe`.
E           405    out : type
E           406        Explanation of `out`.
E           407    type_without_description
E           408
E           409    Other Parameters
E           410    ----------------
E           411    only_seldom_used_keywords : type
E           412        Explanation.
E           413    common_parameters_listed_above : type
E           414        Explanation.
E           415
E           416    Raises
E           417    ------
E           418    BadException
E           419        Because you shouldn't have done that.
E           420
E           421    See Also
E           422    --------
E           423    numpy.array : Relationship (optional).
E           424    numpy.ndarray : Relationship (optional), which could be fairly long, in
E           425                    which case the line wraps here.
E           426    numpy.dot, numpy.linalg.norm, numpy.eye
E           427
E           428    Notes
E           429    -----
E           430    Notes about the implementation algorithm (if needed).
E           431
E           432    This can have multiple paragraphs.
E           433
E           434    You may include some math:
E           435
E           436    .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
E           437
E           438    And even use a Greek symbol like :math:`\omega` inline.
E           439
E           440    References
E           441    ----------
E           442    Cite the relevant literature, e.g. [1]_.  You may also cite these
E           443    references in the notes section above.
E           444
E           445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,
E           446       expert systems and adaptive co-kriging for environmental habitat
E           447       modelling of the Highland Haggis using object-oriented, fuzzy-logic
E           448       and neural-network techniques," Computers & Geosciences, vol. 22,
E           449       pp. 585-588, 1996.
E           450
E           451    Examples
E           452    --------
E           453    These are written in doctest format, and should illustrate how to
E           454    use the function.
E           455
E           456    >>> a = [1, 2, 3]
E           457    >>> print([x + 3 for x in a])
E           458    [4, 5, 6]
E           459    >>> print("a\nb")
E           460    a
E           461    b
E           462    """
E           463    # After closing class docstring, there should be one blank line to
E           464    # separate following codes (according to PEP257).
E           465    # But for function, method and module, there should be no blank lines
E           466    # after closing the docstring.
E           467    pass
E           
E E E

Summarize the function in one line.

E E

Several sentences providing an extended description. Refer to E variables using back-ticks, e.g. var.

E E
Parameters
E E
    E
  • var1 (array_like): E Array_like means all those objects -- lists, nested lists, etc. -- E that can be converted to an array. We can also refer to E variables like var1.
  • E
  • var2 (int): E The type above can either refer to an actual Python type E (e.g. int), or describe the type of the variable in more E detail, e.g. (N,) ndarray or array_like.
  • E -
  • *args (iterable): E ? - E +
  • *args (iterable): E ? + E Other arguments.
  • E
  • long_var_name ({'hi', 'ho'}, optional): E Choices in brackets, default first when optional.
  • E -
  • **kwargs (dict): E ? -- E +
  • **kwargs (dict): E ? ++ E Keyword arguments.
  • E
E E
Returns
E E
    E
  • type: Explanation of anonymous return value of type type.
  • E
  • describe (type): E Explanation of return value named describe.
  • E
  • out (type): E Explanation of out.
  • E
  • type_without_description
  • E
E E
Other Parameters
E E
    E
  • only_seldom_used_keywords (type): E Explanation.
  • E
  • common_parameters_listed_above (type): E Explanation.
  • E
E E
Raises
E E
    E
  • BadException: Because you shouldn't have done that.
  • E
E E
See Also
E E

numpy.array: Relationship (optional).
E numpy.ndarray: Relationship (optional), which could be fairly long, in E which case the line wraps here.
E numpy.dot,, numpy.linalg.norm,, numpy.eye

E E
Notes
E E

Notes about the implementation algorithm (if needed).

E E

This can have multiple paragraphs.

E E

You may include some math:

E E

$$X(e^{j\omega } ) = x(n)e^{ - j\omega n}$$

E E

And even use a Greek symbol like \( \omega \) inline.

E E
References
E E

Cite the relevant literature, e.g. 1. You may also cite these E references in the notes section above.

E E
Examples
E E

These are written in doctest format, and should illustrate how to E use the function.

E E
E
>>> a = [1, 2, 3]
E           >>> print([x + 3 for x in a])
E           [4, 5, 6]
E           >>> print("a\nb")
E           a
E           b
E           
E
E E
E
E
    E
  1. E

    O. McNoleg, "The integration of GIS, remote sensing, E expert systems and adaptive co-kriging for environmental habitat E modelling of the Highland Haggis using object-oriented, fuzzy-logic E and neural-network techniques," Computers & Geosciences, vol. 22, E pp. 585-588, 1996. 

    E
  2. E
E
E
E E E
E
E E
E E def E invalid_format(test): E E E E
E E
470def invalid_format(test):
E           471    """
E           472    In this example, there is no description for the test argument
E           473
E           474    Parameters
E           475    ----------
E           476    param1
E           477
E           478    """
E           
E E E

In this example, there is no description for the test argument

E E
Parameters
E E
    E
  • param1
  • E
E
E E E
E
E E
E E def E invalid_format2() -> None: E E E E
E E
480def invalid_format2() -> None:
E           481    """
E           482    Another example without description, but this time indented.
E           483
E           484    Returns
E           485    -------
E           486        Text describing the return value.
E           487    """
E           
E E E

Another example without description, but this time indented.

E E
Returns
E E
    E
  • Text describing the return value.
  • E
E
E E E
E
E E
E E def E invalid_format3() -> None: E E E E
E E
489def invalid_format3() -> None:
E           490    """
E           491    Another example with a multiline text.
E           492
E           493    Returns
E           494    -------
E           495        Multiline text
E           496        describing the return value.
E           497    """
E           
E E E

Another example with a multiline text.

E E
Returns
E E
    E
  • Multiline text
  • E
  • describing the return value.
  • E
E
E E E
E
E E /build/pdoc/src/pdoc-16.0.0/test/test_snapshot.py:184: AssertionError =============================== warnings summary =============================== test/test_doc_types.py::test_eval_fail2 /build/pdoc/src/pdoc-16.0.0/pdoc/doc_types.py:136: UserWarning: Error parsing type annotation xyz for a. Import of xyz failed: name 'xyz' is not defined warnings.warn( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ FAILED test/test_snapshot.py::test_snapshots[html-flavors_google] - AssertionError: Rendered output does not match for snapshot flavors_google. Run `python3 ./test/test_snapshot.py` to update snapshots. assert '\n\n\n \n \n \n flavors_google API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_google

\n\n

Example Google style docstrings.

\n\n

This module demonstrates documentation as specified by the Google Python\nStyle Guide. Docstrings may extend over multiple lines. Sections are created\nwith a section header and a colon followed by a block of indented text.

\n\n
Example:
\n\n
\n

Examples can be given using either the Example or Examples\n sections. Sections support any reStructuredText formatting, including\n literal blocks::

\n\n
$ python example_google.py\n
\n
\n\n

Section breaks are created by resuming unindented text. Section breaks\nare also implicitly created anytime a new section starts.

\n\n
Attributes:
\n\n
    \n
  • module_level_variable1 (int): Module level variables may be documented in\neither the Attributes section of the module docstring, or in an\ninline docstring immediately following the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n\n
Todo:
\n\n
\n
    \n
  • For module TODOs
  • \n
  • You have to also use sphinx.ext.todo extension
  • \n
\n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html\n  4#   License: BSD-3\n  5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html\n  6#   License: CC BY 3.0\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example Google style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `Google Python\n 13Style Guide`_. Docstrings may extend over multiple lines. Sections are created\n 14with a section header and a colon followed by a block of indented text.\n 15\n 16Example:\n 17    Examples can be given using either the ``Example`` or ``Examples``\n 18    sections. Sections support any reStructuredText formatting, including\n 19    literal blocks::\n 20\n 21        $ python example_google.py\n 22\n 23Section breaks are created by resuming unindented text. Section breaks\n 24are also implicitly created anytime a new section starts.\n 25\n 26Attributes:\n 27    module_level_variable1 (int): Module level variables may be documented in\n 28        either the ``Attributes`` section of the module docstring, or in an\n 29        inline docstring immediately following the variable.\n 30\n 31        Either form is acceptable, but the two should not be mixed. Choose\n 32        one convention to document module level variables and be consistent\n 33        with it.\n 34\n 35Todo:\n 36    * For module TODOs\n 37    * You have to also use ``sphinx.ext.todo`` extension\n 38\n 39.. _Google Python Style Guide:\n 40   http://google.github.io/styleguide/pyguide.html\n 41\n 42"""\n 43__docformat__ = "google"\n 44\n 45from typing import Any, Mapping, Sequence, Tuple\n 46\n 47\n 48module_level_variable1 = 12345\n 49\n 50module_level_variable2 = 98765\n 51"""int: Module level variable documented inline.\n 52\n 53The docstring may span multiple lines. The type may optionally be specified\n 54on the first line, separated by a colon.\n 55"""\n 56\n 57\n 58def function_with_types_in_docstring(param1, param2):\n 59    """Example function with types documented in the docstring.\n 60\n 61    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 62    return types are annotated according to `PEP 484`_, they do not need to be\n 63    included in the docstring:\n 64\n 65    Args:\n 66        param1 (int): The first parameter.\n 67        param2 (str): The second parameter.\n 68\n 69    Returns:\n 70        bool: The return value. True for success, False otherwise.\n 71\n 72    .. _PEP 484:\n 73        https://www.python.org/dev/peps/pep-0484/\n 74\n 75    """\n 76\n 77\n 78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 79    """Example function with PEP 484 type annotations.\n 80\n 81    Args:\n 82        param1: The first parameter.\n 83        param2: The second parameter.\n 84\n 85    Returns:\n 86        The return value. True for success, False otherwise.\n 87\n 88    """\n 89    raise NotImplementedError\n 90\n 91\n 92def module_level_function(param1, param2=None, *args, **kwargs):\n 93    """This is an example of a module level function.\n 94\n 95    Function parameters should be documented in the ``Args`` section. The name\n 96    of each parameter is required. The type and description of each parameter\n 97    is optional, but should be included if not obvious.\n 98\n 99    If *args or **kwargs are accepted,\n100    they should be listed as ``*args`` and ``**kwargs``.\n101\n102    The format for a parameter is::\n103\n104        name (type): description\n105            The description may span multiple lines. Following\n106            lines should be indented. The "(type)" is optional.\n107\n108            Multiple paragraphs are supported in parameter\n109            descriptions.\n110\n111    Args:\n112        param1 (int): The first parameter.\n113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n114            Second line of description should be indented.\n115        *args: Variable length argument list.\n116        **kwargs: Arbitrary keyword arguments.\n117\n118    Returns:\n119        bool: True if successful, False otherwise.\n120\n121        The return type is optional and may be specified at the beginning of\n122        the ``Returns`` section followed by a colon.\n123\n124        The ``Returns`` section may span multiple lines and paragraphs.\n125        Following lines should be indented to match the first line.\n126\n127        The ``Returns`` section supports any reStructuredText formatting,\n128        including literal blocks::\n129\n130            {\n131                'param1': param1,\n132                'param2': param2\n133            }\n134\n135    Raises:\n136        AttributeError: The ``Raises`` section is a list of all exceptions\n137            that are relevant to the interface.\n138        ValueError: If `param2` is equal to `param1`.\n139\n140    """\n141    if param1 == param2:\n142        raise ValueError('param1 may not be equal to param2')\n143    return True\n144\n145\n146def example_generator(n):\n147    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n148\n149    Args:\n150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n151\n152    Yields:\n153        int: The next number in the range of 0 to `n` - 1.\n154\n155    Examples:\n156        Examples should be written in doctest format, and should illustrate how\n157        to use the function.\n158\n159        >>> print([i for i in example_generator(4)])\n160        [0, 1, 2, 3]\n161\n162    """\n163    for i in range(n):\n164        yield i\n165\n166\n167class ExampleError(Exception):\n168    """Exceptions are documented in the same way as classes.\n169\n170    The __init__ method may be documented in either the class level\n171    docstring, or as a docstring on the __init__ method itself.\n172\n173    Either form is acceptable, but the two should not be mixed. Choose one\n174    convention to document the __init__ method and be consistent with it.\n175\n176    Note:\n177        Do not include the `self` parameter in the ``Args`` section.\n178\n179    Args:\n180        msg (str): Human readable string describing the exception.\n181        code (:obj:`int`, optional): Error code.\n182\n183    Attributes:\n184        msg (str): Human readable string describing the exception.\n185        code (int): Exception error code.\n186\n187    """\n188\n189    def __init__(self, msg, code):\n190        self.msg = msg\n191        self.code = code\n192\n193    def add_note(self, note: str):\n194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n195\n196    def with_traceback(self, object, /):\n197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n198\n199class ExampleClass(object):\n200    """The summary line for a class docstring should fit on one line.\n201\n202    If the class has public attributes, they may be documented here\n203    in an ``Attributes`` section and follow the same formatting as a\n204    function's ``Args`` section. Alternatively, attributes may be documented\n205    inline with the attribute's declaration (see __init__ method below).\n206\n207    Properties created with the ``@property`` decorator should be documented\n208    in the property's getter method.\n209\n210    Attributes:\n211        attr1 (str): Description of `attr1`.\n212        attr2 (:obj:`int`, optional): Description of `attr2`.\n213\n214    """\n215\n216    def __init__(self, param1, param2, param3):\n217        """Example of docstring on the __init__ method.\n218\n219        The __init__ method may be documented in either the class level\n220        docstring, or as a docstring on the __init__ method itself.\n221\n222        Either form is acceptable, but the two should not be mixed. Choose one\n223        convention to document the __init__ method and be consistent with it.\n224\n225        Note:\n226            Do not include the `self` parameter in the ``Args`` section.\n227\n228        Args:\n229            param1 (str): Description of `param1`.\n230            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n231                lines are supported.\n232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n233\n234        """\n235        self.attr1 = param1\n236        self.attr2 = param2\n237        self.attr3 = param3  #: Doc comment *inline* with attribute\n238\n239        #: list of str: Doc comment *before* attribute, with type specified\n240        self.attr4 = ['attr4']\n241\n242        self.attr5 = None\n243        """str: Docstring *after* attribute, with type specified."""\n244\n245    @property\n246    def readonly_property(self):\n247        """str: Properties should be documented in their getter method."""\n248        return 'readonly_property'\n249\n250    @property\n251    def readwrite_property(self):\n252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n253        should only be documented in their getter method.\n254\n255        If the setter method contains notable behavior, it should be\n256        mentioned here.\n257        """\n258        return ['readwrite_property']\n259\n260    @readwrite_property.setter\n261    def readwrite_property(self, value):\n262        value\n263\n264    def example_method(self, param1, param2):\n265        """Class methods are similar to regular functions.\n266\n267        Note:\n268            Do not include the `self` parameter in the ``Args`` section.\n269\n270        Args:\n271            param1: The first parameter.\n272            param2: The second parameter.\n273\n274        Returns:\n275            True if successful, False otherwise.\n276\n277        """\n278        return True\n279\n280    def __special__(self):\n281        """By default special members with docstrings are not included.\n282\n283        Special members are any methods or attributes that start with and\n284        end with a double underscore. Any special member with a docstring\n285        will be included in the output, if\n286        ``napoleon_include_special_with_doc`` is set to True.\n287\n288        This behavior can be enabled by changing the following setting in\n289        Sphinx's conf.py::\n290\n291            napoleon_include_special_with_doc = True\n292\n293        """\n294        pass\n295\n296    def __special_without_docstring__(self):\n297        pass\n298\n299    def _private(self):\n300        """By default private members are not included.\n301\n302        Private members are any methods or attributes that start with an\n303        underscore and are *not* special. By default they are not included\n304        in the output.\n305\n306        This behavior can be changed such that private members *are* included\n307        by changing the following setting in Sphinx's conf.py::\n308\n309            napoleon_include_private_with_doc = True\n310\n311        """\n312        pass\n313\n314    def _private_without_docstring(self):\n315        pass\n316\n317\n318def fetch_smalltable_rows(table_handle: Any,\n319                          keys: Sequence[str],\n320                          require_all_keys: bool = False,\n321) -> Mapping[bytes, Tuple[str]]:\n322    """Fetches rows from a Smalltable.\n323\n324    Retrieves rows pertaining to the given keys from the Table instance\n325    represented by table_handle.  String keys will be UTF-8 encoded.\n326\n327    Args:\n328        table_handle: An open smalltable.Table instance.\n329        keys: A sequence of strings representing the key of each table\n330          row to fetch.  String keys will be UTF-8 encoded.\n331        require_all_keys: Optional; If require_all_keys is True only\n332          rows with values set for all keys will be returned.\n333\n334    Returns:\n335        A dict mapping keys to the corresponding table row data\n336        fetched. Each row is represented as a tuple of strings. For\n337        example:\n338\n339        {b'Serak': ('Rigel VII', 'Preparer'),\n340         b'Zim': ('Irk', 'Invader'),\n341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n342\n343        Returned keys are always bytes.  If a key from the keys argument is\n344        missing from the dictionary, then that row was not found in the\n345        table (and require_all_keys must have been False).\n346\n347    Raises:\n348        IOError: An error occurred accessing the smalltable.\n349    """\n350    raise NotImplementedError\n351\n352\n353def fetch_smalltable_rows2(table_handle: Any,\n354                          keys: Sequence[str],\n355                          require_all_keys: bool = False,\n356) -> Mapping[bytes, Tuple[str]]:\n357    """Fetches rows from a Smalltable.\n358\n359    Retrieves rows pertaining to the given keys from the Table instance\n360    represented by table_handle.  String keys will be UTF-8 encoded.\n361\n362    Args:\n363      table_handle:\n364        An open smalltable.Table instance.\n365      keys:\n366        A sequence of strings representing the key of each table row to\n367        fetch.  String keys will be UTF-8 encoded.\n368      require_all_keys:\n369        Optional; If require_all_keys is True only rows with values set\n370        for all keys will be returned.\n371\n372    Returns:\n373      A dict mapping keys to the corresponding table row data\n374      fetched. Each row is represented as a tuple of strings. For\n375      example:\n376\n377      {b'Serak': ('Rigel VII', 'Preparer'),\n378       b'Zim': ('Irk', 'Invader'),\n379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n380\n381      Returned keys are always bytes.  If a key from the keys argument is\n382      missing from the dictionary, then that row was not found in the\n383      table (and require_all_keys must have been False).\n384\n385    Raises:\n386      IOError: An error occurred accessing the smalltable.\n387    """\n388    raise NotImplementedError\n389\n390\n391class SampleClass:\n392    """Summary of class here.\n393\n394    Longer class information....\n395    Longer class information....\n396\n397    Attributes:\n398        likes_spam: A boolean indicating if we like SPAM or not.\n399        eggs: An integer count of the eggs we have laid.\n400    """\n401\n402    def __init__(self, likes_spam=False):\n403        """Inits SampleClass with blah."""\n404        self.likes_spam = likes_spam\n405        self.eggs = 0\n406\n407    def public_method(self):\n408        """Performs operation blah."""\n409\n410\n411def invalid_format(test):\n412    """\n413    In this example, there is no colon after the argument and an empty section.\n414\n415    Args:\n416      test\n417        there is a colon missing in the previous line\n418    Returns:\n419\n420    """\n421\n422\n423def example_code():\n424    """\n425    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n426\n427    Example:\n428\n429        ```python\n430        tmp = a2()\n431\n432        tmp2 = a()\n433        ```\n434    """\n435\n436\n437def newline_after_args(test: str):\n438    """\n439    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n440\n441    Args:\n442\n443      test\n444        there is unexpected whitespace before test.\n445    """\n446\n447\n448def alternative_section_names(test: str):\n449    """\n450    In this example, we check whether alternative section names aliased to\n451    'Args' are handled properly.\n452\n453    Parameters:\n454        test: the test string\n455    """\n456\n457def keyword_arguments(**kwargs):\n458    """\n459    This an example for a function with keyword arguments documented in the docstring.\n460\n461    Args:\n462        **kwargs: A dictionary containing user info.\n463\n464    Keyword Arguments:\n465        str_arg (str): First string argument.\n466        int_arg (int): Second integer argument.\n467    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
59def function_with_types_in_docstring(param1, param2):\n60    """Example function with types documented in the docstring.\n61\n62    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n63    return types are annotated according to `PEP 484`_, they do not need to be\n64    included in the docstring:\n65\n66    Args:\n67        param1 (int): The first parameter.\n68        param2 (str): The second parameter.\n69\n70    Returns:\n71        bool: The return value. True for success, False otherwise.\n72\n73    .. _PEP 484:\n74        https://www.python.org/dev/peps/pep-0484/\n75\n76    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str): The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

bool: The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n80    """Example function with PEP 484 type annotations.\n81\n82    Args:\n83        param1: The first parameter.\n84        param2: The second parameter.\n85\n86    Returns:\n87        The return value. True for success, False otherwise.\n88\n89    """\n90    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
 93def module_level_function(param1, param2=None, *args, **kwargs):\n 94    """This is an example of a module level function.\n 95\n 96    Function parameters should be documented in the ``Args`` section. The name\n 97    of each parameter is required. The type and description of each parameter\n 98    is optional, but should be included if not obvious.\n 99\n100    If *args or **kwargs are accepted,\n101    they should be listed as ``*args`` and ``**kwargs``.\n102\n103    The format for a parameter is::\n104\n105        name (type): description\n106            The description may span multiple lines. Following\n107            lines should be indented. The "(type)" is optional.\n108\n109            Multiple paragraphs are supported in parameter\n110            descriptions.\n111\n112    Args:\n113        param1 (int): The first parameter.\n114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n115            Second line of description should be indented.\n116        *args: Variable length argument list.\n117        **kwargs: Arbitrary keyword arguments.\n118\n119    Returns:\n120        bool: True if successful, False otherwise.\n121\n122        The return type is optional and may be specified at the beginning of\n123        the ``Returns`` section followed by a colon.\n124\n125        The ``Returns`` section may span multiple lines and paragraphs.\n126        Following lines should be indented to match the first line.\n127\n128        The ``Returns`` section supports any reStructuredText formatting,\n129        including literal blocks::\n130\n131            {\n132                'param1': param1,\n133                'param2': param2\n134            }\n135\n136    Raises:\n137        AttributeError: The ``Raises`` section is a list of all exceptions\n138            that are relevant to the interface.\n139        ValueError: If `param2` is equal to `param1`.\n140\n141    """\n142    if param1 == param2:\n143        raise ValueError('param1 may not be equal to param2')\n144    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Args section. The name\nof each parameter is required. The type and description of each parameter\nis optional, but should be included if not obvious.

\n\n

If *args or **kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name (type): description\n    The description may span multiple lines. Following\n    lines should be indented. The "(type)" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str, optional): The second parameter. Defaults to None.\nSecond line of description should be indented.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns:
\n\n
\n

bool: True if successful, False otherwise.

\n \n

The return type is optional and may be specified at the beginning of\n the Returns section followed by a colon.

\n \n

The Returns section may span multiple lines and paragraphs.\n Following lines should be indented to match the first line.

\n \n

The Returns section supports any reStructuredText formatting,\n including literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n
\n\n
Raises:
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
147def example_generator(n):\n148    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n149\n150    Args:\n151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n152\n153    Yields:\n154        int: The next number in the range of 0 to `n` - 1.\n155\n156    Examples:\n157        Examples should be written in doctest format, and should illustrate how\n158        to use the function.\n159\n160        >>> print([i for i in example_generator(4)])\n161        [0, 1, 2, 3]\n162\n163    """\n164    for i in range(n):\n165        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Arguments:
\n\n
    \n
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields:
\n\n
\n

int: The next number in the range of 0 to n - 1.

\n
\n\n
Examples:
\n\n
\n

Examples should be written in doctest format, and should illustrate how\n to use the function.

\n \n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
168class ExampleError(Exception):\n169    """Exceptions are documented in the same way as classes.\n170\n171    The __init__ method may be documented in either the class level\n172    docstring, or as a docstring on the __init__ method itself.\n173\n174    Either form is acceptable, but the two should not be mixed. Choose one\n175    convention to document the __init__ method and be consistent with it.\n176\n177    Note:\n178        Do not include the `self` parameter in the ``Args`` section.\n179\n180    Args:\n181        msg (str): Human readable string describing the exception.\n182        code (:obj:`int`, optional): Error code.\n183\n184    Attributes:\n185        msg (str): Human readable string describing the exception.\n186        code (int): Exception error code.\n187\n188    """\n189\n190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n193\n194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n196\n197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int, optional): Error code.
  • \n
\n\n
Attributes:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int): Exception error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
200class ExampleClass(object):\n201    """The summary line for a class docstring should fit on one line.\n202\n203    If the class has public attributes, they may be documented here\n204    in an ``Attributes`` section and follow the same formatting as a\n205    function's ``Args`` section. Alternatively, attributes may be documented\n206    inline with the attribute's declaration (see __init__ method below).\n207\n208    Properties created with the ``@property`` decorator should be documented\n209    in the property's getter method.\n210\n211    Attributes:\n212        attr1 (str): Description of `attr1`.\n213        attr2 (:obj:`int`, optional): Description of `attr2`.\n214\n215    """\n216\n217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n245\n246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n250\n251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n260\n261    @readwrite_property.setter\n262    def readwrite_property(self, value):\n263        value\n264\n265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n280\n281    def __special__(self):\n282        """By default special members with docstrings are not included.\n283\n284        Special members are any methods or attributes that start with and\n285        end with a double underscore. Any special member with a docstring\n286        will be included in the output, if\n287        ``napoleon_include_special_with_doc`` is set to True.\n288\n289        This behavior can be enabled by changing the following setting in\n290        Sphinx's conf.py::\n291\n292            napoleon_include_special_with_doc = True\n293\n294        """\n295        pass\n296\n297    def __special_without_docstring__(self):\n298        pass\n299\n300    def _private(self):\n301        """By default private members are not included.\n302\n303        Private members are any methods or attributes that start with an\n304        underscore and are *not* special. By default they are not included\n305        in the output.\n306\n307        This behavior can be changed such that private members *are* included\n308        by changing the following setting in Sphinx's conf.py::\n309\n310            napoleon_include_private_with_doc = True\n311\n312        """\n313        pass\n314\n315    def _private_without_docstring(self):\n316        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes:
\n\n
    \n
  • attr1 (str): Description of attr1.
  • \n
  • attr2 (int, optional): Description of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1 (str): Description of param1.
  • \n
  • param2 (int, optional): Description of param2. Multiple\nlines are supported.
  • \n
  • param3 (list of str): Description of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

True if successful, False otherwise.

\n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n fetch_smalltable_rows(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
319def fetch_smalltable_rows(table_handle: Any,\n320                          keys: Sequence[str],\n321                          require_all_keys: bool = False,\n322) -> Mapping[bytes, Tuple[str]]:\n323    """Fetches rows from a Smalltable.\n324\n325    Retrieves rows pertaining to the given keys from the Table instance\n326    represented by table_handle.  String keys will be UTF-8 encoded.\n327\n328    Args:\n329        table_handle: An open smalltable.Table instance.\n330        keys: A sequence of strings representing the key of each table\n331          row to fetch.  String keys will be UTF-8 encoded.\n332        require_all_keys: Optional; If require_all_keys is True only\n333          rows with values set for all keys will be returned.\n334\n335    Returns:\n336        A dict mapping keys to the corresponding table row data\n337        fetched. Each row is represented as a tuple of strings. For\n338        example:\n339\n340        {b'Serak': ('Rigel VII', 'Preparer'),\n341         b'Zim': ('Irk', 'Invader'),\n342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n343\n344        Returned keys are always bytes.  If a key from the keys argument is\n345        missing from the dictionary, then that row was not found in the\n346        table (and require_all_keys must have been False).\n347\n348    Raises:\n349        IOError: An error occurred accessing the smalltable.\n350    """\n351    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table\nrow to fetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only\nrows with values set for all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n fetch_smalltable_rows2(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
354def fetch_smalltable_rows2(table_handle: Any,\n355                          keys: Sequence[str],\n356                          require_all_keys: bool = False,\n357) -> Mapping[bytes, Tuple[str]]:\n358    """Fetches rows from a Smalltable.\n359\n360    Retrieves rows pertaining to the given keys from the Table instance\n361    represented by table_handle.  String keys will be UTF-8 encoded.\n362\n363    Args:\n364      table_handle:\n365        An open smalltable.Table instance.\n366      keys:\n367        A sequence of strings representing the key of each table row to\n368        fetch.  String keys will be UTF-8 encoded.\n369      require_all_keys:\n370        Optional; If require_all_keys is True only rows with values set\n371        for all keys will be returned.\n372\n373    Returns:\n374      A dict mapping keys to the corresponding table row data\n375      fetched. Each row is represented as a tuple of strings. For\n376      example:\n377\n378      {b'Serak': ('Rigel VII', 'Preparer'),\n379       b'Zim': ('Irk', 'Invader'),\n380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n381\n382      Returned keys are always bytes.  If a key from the keys argument is\n383      missing from the dictionary, then that row was not found in the\n384      table (and require_all_keys must have been False).\n385\n386    Raises:\n387      IOError: An error occurred accessing the smalltable.\n388    """\n389    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table row to\nfetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only rows with values set\nfor all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n class\n SampleClass:\n\n \n\n
\n \n
392class SampleClass:\n393    """Summary of class here.\n394\n395    Longer class information....\n396    Longer class information....\n397\n398    Attributes:\n399        likes_spam: A boolean indicating if we like SPAM or not.\n400        eggs: An integer count of the eggs we have laid.\n401    """\n402\n403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n407\n408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Summary of class here.

\n\n

Longer class information....\nLonger class information....

\n\n
Attributes:
\n\n
    \n
  • likes_spam: A boolean indicating if we like SPAM or not.
  • \n
  • eggs: An integer count of the eggs we have laid.
  • \n
\n
\n\n\n
\n \n
\n \n SampleClass(likes_spam=False)\n\n \n\n
\n \n
403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n
\n\n\n

Inits SampleClass with blah.

\n
\n\n\n
\n
\n
\n likes_spam\n\n \n
\n \n \n \n\n
\n
\n
\n eggs\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n public_method(self):\n\n \n\n
\n \n
408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Performs operation blah.

\n
\n\n\n
\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
412def invalid_format(test):\n413    """\n414    In this example, there is no colon after the argument and an empty section.\n415\n416    Args:\n417      test\n418        there is a colon missing in the previous line\n419    Returns:\n420\n421    """\n
\n\n\n

In this example, there is no colon after the argument and an empty section.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is a colon missing in the previous line
  • \n
\n\n

Returns:

\n
\n\n\n
\n
\n \n
\n \n def\n example_code():\n\n \n\n
\n \n
424def example_code():\n425    """\n426    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n427\n428    Example:\n429\n430        ```python\n431        tmp = a2()\n432\n433        tmp2 = a()\n434        ```\n435    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/issues/264.

\n\n
Example:
\n\n
\n
\n
tmp = a2()\n\ntmp2 = a()\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n newline_after_args(test: str):\n\n \n\n
\n \n
438def newline_after_args(test: str):\n439    """\n440    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n441\n442    Args:\n443\n444      test\n445        there is unexpected whitespace before test.\n446    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/pull/458.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is unexpected whitespace before test.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n alternative_section_names(test: str):\n\n \n\n
\n \n
449def alternative_section_names(test: str):\n450    """\n451    In this example, we check whether alternative section names aliased to\n452    'Args' are handled properly.\n453\n454    Parameters:\n455        test: the test string\n456    """\n
\n\n\n

In this example, we check whether alternative section names aliased to\n\'Args\' are handled properly.

\n\n
Arguments:
\n\n
    \n
  • test: the test string
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n keyword_arguments(**kwargs):\n\n \n\n
\n \n
458def keyword_arguments(**kwargs):\n459    """\n460    This an example for a function with keyword arguments documented in the docstring.\n461\n462    Args:\n463        **kwargs: A dictionary containing user info.\n464\n465    Keyword Arguments:\n466        str_arg (str): First string argument.\n467        int_arg (int): Second integer argument.\n468    """\n
\n\n\n

This an example for a function with keyword arguments documented in the docstring.

\n\n
Arguments:
\n\n
    \n
  • **kwargs: A dictionary containing user info.
  • \n
\n\n
Keyword Args:
\n\n
    \n
  • str_arg (str): First string argument.
  • \n
  • int_arg (int): Second integer argument.
  • \n
\n
\n\n\n
\n
\n\n' == '\n\n\n \n \n \n flavors_google API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_google

\n\n

Example Google style docstrings.

\n\n

This module demonstrates documentation as specified by the Google Python\nStyle Guide. Docstrings may extend over multiple lines. Sections are created\nwith a section header and a colon followed by a block of indented text.

\n\n
Example:
\n\n
\n

Examples can be given using either the Example or Examples\n sections. Sections support any reStructuredText formatting, including\n literal blocks::

\n\n
$ python example_google.py\n
\n
\n\n

Section breaks are created by resuming unindented text. Section breaks\nare also implicitly created anytime a new section starts.

\n\n
Attributes:
\n\n
    \n
  • module_level_variable1 (int): Module level variables may be documented in\neither the Attributes section of the module docstring, or in an\ninline docstring immediately following the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n\n
Todo:
\n\n
\n
    \n
  • For module TODOs
  • \n
  • You have to also use sphinx.ext.todo extension
  • \n
\n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html\n  4#   License: BSD-3\n  5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html\n  6#   License: CC BY 3.0\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example Google style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `Google Python\n 13Style Guide`_. Docstrings may extend over multiple lines. Sections are created\n 14with a section header and a colon followed by a block of indented text.\n 15\n 16Example:\n 17    Examples can be given using either the ``Example`` or ``Examples``\n 18    sections. Sections support any reStructuredText formatting, including\n 19    literal blocks::\n 20\n 21        $ python example_google.py\n 22\n 23Section breaks are created by resuming unindented text. Section breaks\n 24are also implicitly created anytime a new section starts.\n 25\n 26Attributes:\n 27    module_level_variable1 (int): Module level variables may be documented in\n 28        either the ``Attributes`` section of the module docstring, or in an\n 29        inline docstring immediately following the variable.\n 30\n 31        Either form is acceptable, but the two should not be mixed. Choose\n 32        one convention to document module level variables and be consistent\n 33        with it.\n 34\n 35Todo:\n 36    * For module TODOs\n 37    * You have to also use ``sphinx.ext.todo`` extension\n 38\n 39.. _Google Python Style Guide:\n 40   http://google.github.io/styleguide/pyguide.html\n 41\n 42"""\n 43__docformat__ = "google"\n 44\n 45from typing import Any, Mapping, Sequence, Tuple\n 46\n 47\n 48module_level_variable1 = 12345\n 49\n 50module_level_variable2 = 98765\n 51"""int: Module level variable documented inline.\n 52\n 53The docstring may span multiple lines. The type may optionally be specified\n 54on the first line, separated by a colon.\n 55"""\n 56\n 57\n 58def function_with_types_in_docstring(param1, param2):\n 59    """Example function with types documented in the docstring.\n 60\n 61    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 62    return types are annotated according to `PEP 484`_, they do not need to be\n 63    included in the docstring:\n 64\n 65    Args:\n 66        param1 (int): The first parameter.\n 67        param2 (str): The second parameter.\n 68\n 69    Returns:\n 70        bool: The return value. True for success, False otherwise.\n 71\n 72    .. _PEP 484:\n 73        https://www.python.org/dev/peps/pep-0484/\n 74\n 75    """\n 76\n 77\n 78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 79    """Example function with PEP 484 type annotations.\n 80\n 81    Args:\n 82        param1: The first parameter.\n 83        param2: The second parameter.\n 84\n 85    Returns:\n 86        The return value. True for success, False otherwise.\n 87\n 88    """\n 89    raise NotImplementedError\n 90\n 91\n 92def module_level_function(param1, param2=None, *args, **kwargs):\n 93    """This is an example of a module level function.\n 94\n 95    Function parameters should be documented in the ``Args`` section. The name\n 96    of each parameter is required. The type and description of each parameter\n 97    is optional, but should be included if not obvious.\n 98\n 99    If *args or **kwargs are accepted,\n100    they should be listed as ``*args`` and ``**kwargs``.\n101\n102    The format for a parameter is::\n103\n104        name (type): description\n105            The description may span multiple lines. Following\n106            lines should be indented. The "(type)" is optional.\n107\n108            Multiple paragraphs are supported in parameter\n109            descriptions.\n110\n111    Args:\n112        param1 (int): The first parameter.\n113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n114            Second line of description should be indented.\n115        *args: Variable length argument list.\n116        **kwargs: Arbitrary keyword arguments.\n117\n118    Returns:\n119        bool: True if successful, False otherwise.\n120\n121        The return type is optional and may be specified at the beginning of\n122        the ``Returns`` section followed by a colon.\n123\n124        The ``Returns`` section may span multiple lines and paragraphs.\n125        Following lines should be indented to match the first line.\n126\n127        The ``Returns`` section supports any reStructuredText formatting,\n128        including literal blocks::\n129\n130            {\n131                'param1': param1,\n132                'param2': param2\n133            }\n134\n135    Raises:\n136        AttributeError: The ``Raises`` section is a list of all exceptions\n137            that are relevant to the interface.\n138        ValueError: If `param2` is equal to `param1`.\n139\n140    """\n141    if param1 == param2:\n142        raise ValueError('param1 may not be equal to param2')\n143    return True\n144\n145\n146def example_generator(n):\n147    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n148\n149    Args:\n150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n151\n152    Yields:\n153        int: The next number in the range of 0 to `n` - 1.\n154\n155    Examples:\n156        Examples should be written in doctest format, and should illustrate how\n157        to use the function.\n158\n159        >>> print([i for i in example_generator(4)])\n160        [0, 1, 2, 3]\n161\n162    """\n163    for i in range(n):\n164        yield i\n165\n166\n167class ExampleError(Exception):\n168    """Exceptions are documented in the same way as classes.\n169\n170    The __init__ method may be documented in either the class level\n171    docstring, or as a docstring on the __init__ method itself.\n172\n173    Either form is acceptable, but the two should not be mixed. Choose one\n174    convention to document the __init__ method and be consistent with it.\n175\n176    Note:\n177        Do not include the `self` parameter in the ``Args`` section.\n178\n179    Args:\n180        msg (str): Human readable string describing the exception.\n181        code (:obj:`int`, optional): Error code.\n182\n183    Attributes:\n184        msg (str): Human readable string describing the exception.\n185        code (int): Exception error code.\n186\n187    """\n188\n189    def __init__(self, msg, code):\n190        self.msg = msg\n191        self.code = code\n192\n193    def add_note(self, note: str):\n194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n195\n196    def with_traceback(self, object, /):\n197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n198\n199class ExampleClass(object):\n200    """The summary line for a class docstring should fit on one line.\n201\n202    If the class has public attributes, they may be documented here\n203    in an ``Attributes`` section and follow the same formatting as a\n204    function's ``Args`` section. Alternatively, attributes may be documented\n205    inline with the attribute's declaration (see __init__ method below).\n206\n207    Properties created with the ``@property`` decorator should be documented\n208    in the property's getter method.\n209\n210    Attributes:\n211        attr1 (str): Description of `attr1`.\n212        attr2 (:obj:`int`, optional): Description of `attr2`.\n213\n214    """\n215\n216    def __init__(self, param1, param2, param3):\n217        """Example of docstring on the __init__ method.\n218\n219        The __init__ method may be documented in either the class level\n220        docstring, or as a docstring on the __init__ method itself.\n221\n222        Either form is acceptable, but the two should not be mixed. Choose one\n223        convention to document the __init__ method and be consistent with it.\n224\n225        Note:\n226            Do not include the `self` parameter in the ``Args`` section.\n227\n228        Args:\n229            param1 (str): Description of `param1`.\n230            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n231                lines are supported.\n232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n233\n234        """\n235        self.attr1 = param1\n236        self.attr2 = param2\n237        self.attr3 = param3  #: Doc comment *inline* with attribute\n238\n239        #: list of str: Doc comment *before* attribute, with type specified\n240        self.attr4 = ['attr4']\n241\n242        self.attr5 = None\n243        """str: Docstring *after* attribute, with type specified."""\n244\n245    @property\n246    def readonly_property(self):\n247        """str: Properties should be documented in their getter method."""\n248        return 'readonly_property'\n249\n250    @property\n251    def readwrite_property(self):\n252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n253        should only be documented in their getter method.\n254\n255        If the setter method contains notable behavior, it should be\n256        mentioned here.\n257        """\n258        return ['readwrite_property']\n259\n260    @readwrite_property.setter\n261    def readwrite_property(self, value):\n262        value\n263\n264    def example_method(self, param1, param2):\n265        """Class methods are similar to regular functions.\n266\n267        Note:\n268            Do not include the `self` parameter in the ``Args`` section.\n269\n270        Args:\n271            param1: The first parameter.\n272            param2: The second parameter.\n273\n274        Returns:\n275            True if successful, False otherwise.\n276\n277        """\n278        return True\n279\n280    def __special__(self):\n281        """By default special members with docstrings are not included.\n282\n283        Special members are any methods or attributes that start with and\n284        end with a double underscore. Any special member with a docstring\n285        will be included in the output, if\n286        ``napoleon_include_special_with_doc`` is set to True.\n287\n288        This behavior can be enabled by changing the following setting in\n289        Sphinx's conf.py::\n290\n291            napoleon_include_special_with_doc = True\n292\n293        """\n294        pass\n295\n296    def __special_without_docstring__(self):\n297        pass\n298\n299    def _private(self):\n300        """By default private members are not included.\n301\n302        Private members are any methods or attributes that start with an\n303        underscore and are *not* special. By default they are not included\n304        in the output.\n305\n306        This behavior can be changed such that private members *are* included\n307        by changing the following setting in Sphinx's conf.py::\n308\n309            napoleon_include_private_with_doc = True\n310\n311        """\n312        pass\n313\n314    def _private_without_docstring(self):\n315        pass\n316\n317\n318def fetch_smalltable_rows(table_handle: Any,\n319                          keys: Sequence[str],\n320                          require_all_keys: bool = False,\n321) -> Mapping[bytes, Tuple[str]]:\n322    """Fetches rows from a Smalltable.\n323\n324    Retrieves rows pertaining to the given keys from the Table instance\n325    represented by table_handle.  String keys will be UTF-8 encoded.\n326\n327    Args:\n328        table_handle: An open smalltable.Table instance.\n329        keys: A sequence of strings representing the key of each table\n330          row to fetch.  String keys will be UTF-8 encoded.\n331        require_all_keys: Optional; If require_all_keys is True only\n332          rows with values set for all keys will be returned.\n333\n334    Returns:\n335        A dict mapping keys to the corresponding table row data\n336        fetched. Each row is represented as a tuple of strings. For\n337        example:\n338\n339        {b'Serak': ('Rigel VII', 'Preparer'),\n340         b'Zim': ('Irk', 'Invader'),\n341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n342\n343        Returned keys are always bytes.  If a key from the keys argument is\n344        missing from the dictionary, then that row was not found in the\n345        table (and require_all_keys must have been False).\n346\n347    Raises:\n348        IOError: An error occurred accessing the smalltable.\n349    """\n350    raise NotImplementedError\n351\n352\n353def fetch_smalltable_rows2(table_handle: Any,\n354                          keys: Sequence[str],\n355                          require_all_keys: bool = False,\n356) -> Mapping[bytes, Tuple[str]]:\n357    """Fetches rows from a Smalltable.\n358\n359    Retrieves rows pertaining to the given keys from the Table instance\n360    represented by table_handle.  String keys will be UTF-8 encoded.\n361\n362    Args:\n363      table_handle:\n364        An open smalltable.Table instance.\n365      keys:\n366        A sequence of strings representing the key of each table row to\n367        fetch.  String keys will be UTF-8 encoded.\n368      require_all_keys:\n369        Optional; If require_all_keys is True only rows with values set\n370        for all keys will be returned.\n371\n372    Returns:\n373      A dict mapping keys to the corresponding table row data\n374      fetched. Each row is represented as a tuple of strings. For\n375      example:\n376\n377      {b'Serak': ('Rigel VII', 'Preparer'),\n378       b'Zim': ('Irk', 'Invader'),\n379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n380\n381      Returned keys are always bytes.  If a key from the keys argument is\n382      missing from the dictionary, then that row was not found in the\n383      table (and require_all_keys must have been False).\n384\n385    Raises:\n386      IOError: An error occurred accessing the smalltable.\n387    """\n388    raise NotImplementedError\n389\n390\n391class SampleClass:\n392    """Summary of class here.\n393\n394    Longer class information....\n395    Longer class information....\n396\n397    Attributes:\n398        likes_spam: A boolean indicating if we like SPAM or not.\n399        eggs: An integer count of the eggs we have laid.\n400    """\n401\n402    def __init__(self, likes_spam=False):\n403        """Inits SampleClass with blah."""\n404        self.likes_spam = likes_spam\n405        self.eggs = 0\n406\n407    def public_method(self):\n408        """Performs operation blah."""\n409\n410\n411def invalid_format(test):\n412    """\n413    In this example, there is no colon after the argument and an empty section.\n414\n415    Args:\n416      test\n417        there is a colon missing in the previous line\n418    Returns:\n419\n420    """\n421\n422\n423def example_code():\n424    """\n425    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n426\n427    Example:\n428\n429        ```python\n430        tmp = a2()\n431\n432        tmp2 = a()\n433        ```\n434    """\n435\n436\n437def newline_after_args(test: str):\n438    """\n439    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n440\n441    Args:\n442\n443      test\n444        there is unexpected whitespace before test.\n445    """\n446\n447\n448def alternative_section_names(test: str):\n449    """\n450    In this example, we check whether alternative section names aliased to\n451    'Args' are handled properly.\n452\n453    Parameters:\n454        test: the test string\n455    """\n456\n457def keyword_arguments(**kwargs):\n458    """\n459    This an example for a function with keyword arguments documented in the docstring.\n460\n461    Args:\n462        **kwargs: A dictionary containing user info.\n463\n464    Keyword Arguments:\n465        str_arg (str): First string argument.\n466        int_arg (int): Second integer argument.\n467    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
59def function_with_types_in_docstring(param1, param2):\n60    """Example function with types documented in the docstring.\n61\n62    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n63    return types are annotated according to `PEP 484`_, they do not need to be\n64    included in the docstring:\n65\n66    Args:\n67        param1 (int): The first parameter.\n68        param2 (str): The second parameter.\n69\n70    Returns:\n71        bool: The return value. True for success, False otherwise.\n72\n73    .. _PEP 484:\n74        https://www.python.org/dev/peps/pep-0484/\n75\n76    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str): The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

bool: The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n80    """Example function with PEP 484 type annotations.\n81\n82    Args:\n83        param1: The first parameter.\n84        param2: The second parameter.\n85\n86    Returns:\n87        The return value. True for success, False otherwise.\n88\n89    """\n90    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

The return value. True for success, False otherwise.

\n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
 93def module_level_function(param1, param2=None, *args, **kwargs):\n 94    """This is an example of a module level function.\n 95\n 96    Function parameters should be documented in the ``Args`` section. The name\n 97    of each parameter is required. The type and description of each parameter\n 98    is optional, but should be included if not obvious.\n 99\n100    If *args or **kwargs are accepted,\n101    they should be listed as ``*args`` and ``**kwargs``.\n102\n103    The format for a parameter is::\n104\n105        name (type): description\n106            The description may span multiple lines. Following\n107            lines should be indented. The "(type)" is optional.\n108\n109            Multiple paragraphs are supported in parameter\n110            descriptions.\n111\n112    Args:\n113        param1 (int): The first parameter.\n114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.\n115            Second line of description should be indented.\n116        *args: Variable length argument list.\n117        **kwargs: Arbitrary keyword arguments.\n118\n119    Returns:\n120        bool: True if successful, False otherwise.\n121\n122        The return type is optional and may be specified at the beginning of\n123        the ``Returns`` section followed by a colon.\n124\n125        The ``Returns`` section may span multiple lines and paragraphs.\n126        Following lines should be indented to match the first line.\n127\n128        The ``Returns`` section supports any reStructuredText formatting,\n129        including literal blocks::\n130\n131            {\n132                'param1': param1,\n133                'param2': param2\n134            }\n135\n136    Raises:\n137        AttributeError: The ``Raises`` section is a list of all exceptions\n138            that are relevant to the interface.\n139        ValueError: If `param2` is equal to `param1`.\n140\n141    """\n142    if param1 == param2:\n143        raise ValueError('param1 may not be equal to param2')\n144    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Args section. The name\nof each parameter is required. The type and description of each parameter\nis optional, but should be included if not obvious.

\n\n

If args or *kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name (type): description\n    The description may span multiple lines. Following\n    lines should be indented. The "(type)" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Arguments:
\n\n
    \n
  • param1 (int): The first parameter.
  • \n
  • param2 (str, optional): The second parameter. Defaults to None.\nSecond line of description should be indented.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns:
\n\n
\n

bool: True if successful, False otherwise.

\n \n

The return type is optional and may be specified at the beginning of\n the Returns section followed by a colon.

\n \n

The Returns section may span multiple lines and paragraphs.\n Following lines should be indented to match the first line.

\n \n

The Returns section supports any reStructuredText formatting,\n including literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n
\n\n
Raises:
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
147def example_generator(n):\n148    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n149\n150    Args:\n151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.\n152\n153    Yields:\n154        int: The next number in the range of 0 to `n` - 1.\n155\n156    Examples:\n157        Examples should be written in doctest format, and should illustrate how\n158        to use the function.\n159\n160        >>> print([i for i in example_generator(4)])\n161        [0, 1, 2, 3]\n162\n163    """\n164    for i in range(n):\n165        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Arguments:
\n\n
    \n
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields:
\n\n
\n

int: The next number in the range of 0 to n - 1.

\n
\n\n
Examples:
\n\n
\n

Examples should be written in doctest format, and should illustrate how\n to use the function.

\n \n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
168class ExampleError(Exception):\n169    """Exceptions are documented in the same way as classes.\n170\n171    The __init__ method may be documented in either the class level\n172    docstring, or as a docstring on the __init__ method itself.\n173\n174    Either form is acceptable, but the two should not be mixed. Choose one\n175    convention to document the __init__ method and be consistent with it.\n176\n177    Note:\n178        Do not include the `self` parameter in the ``Args`` section.\n179\n180    Args:\n181        msg (str): Human readable string describing the exception.\n182        code (:obj:`int`, optional): Error code.\n183\n184    Attributes:\n185        msg (str): Human readable string describing the exception.\n186        code (int): Exception error code.\n187\n188    """\n189\n190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n193\n194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n196\n197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int, optional): Error code.
  • \n
\n\n
Attributes:
\n\n
    \n
  • msg (str): Human readable string describing the exception.
  • \n
  • code (int): Exception error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
190    def __init__(self, msg, code):\n191        self.msg = msg\n192        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
194    def add_note(self, note: str):\n195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
197    def with_traceback(self, object, /):\n198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
200class ExampleClass(object):\n201    """The summary line for a class docstring should fit on one line.\n202\n203    If the class has public attributes, they may be documented here\n204    in an ``Attributes`` section and follow the same formatting as a\n205    function's ``Args`` section. Alternatively, attributes may be documented\n206    inline with the attribute's declaration (see __init__ method below).\n207\n208    Properties created with the ``@property`` decorator should be documented\n209    in the property's getter method.\n210\n211    Attributes:\n212        attr1 (str): Description of `attr1`.\n213        attr2 (:obj:`int`, optional): Description of `attr2`.\n214\n215    """\n216\n217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n245\n246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n250\n251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n260\n261    @readwrite_property.setter\n262    def readwrite_property(self, value):\n263        value\n264\n265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n280\n281    def __special__(self):\n282        """By default special members with docstrings are not included.\n283\n284        Special members are any methods or attributes that start with and\n285        end with a double underscore. Any special member with a docstring\n286        will be included in the output, if\n287        ``napoleon_include_special_with_doc`` is set to True.\n288\n289        This behavior can be enabled by changing the following setting in\n290        Sphinx's conf.py::\n291\n292            napoleon_include_special_with_doc = True\n293\n294        """\n295        pass\n296\n297    def __special_without_docstring__(self):\n298        pass\n299\n300    def _private(self):\n301        """By default private members are not included.\n302\n303        Private members are any methods or attributes that start with an\n304        underscore and are *not* special. By default they are not included\n305        in the output.\n306\n307        This behavior can be changed such that private members *are* included\n308        by changing the following setting in Sphinx's conf.py::\n309\n310            napoleon_include_private_with_doc = True\n311\n312        """\n313        pass\n314\n315    def _private_without_docstring(self):\n316        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes:
\n\n
    \n
  • attr1 (str): Description of attr1.
  • \n
  • attr2 (int, optional): Description of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
217    def __init__(self, param1, param2, param3):\n218        """Example of docstring on the __init__ method.\n219\n220        The __init__ method may be documented in either the class level\n221        docstring, or as a docstring on the __init__ method itself.\n222\n223        Either form is acceptable, but the two should not be mixed. Choose one\n224        convention to document the __init__ method and be consistent with it.\n225\n226        Note:\n227            Do not include the `self` parameter in the ``Args`` section.\n228\n229        Args:\n230            param1 (str): Description of `param1`.\n231            param2 (:obj:`int`, optional): Description of `param2`. Multiple\n232                lines are supported.\n233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.\n234\n235        """\n236        self.attr1 = param1\n237        self.attr2 = param2\n238        self.attr3 = param3  #: Doc comment *inline* with attribute\n239\n240        #: list of str: Doc comment *before* attribute, with type specified\n241        self.attr4 = ['attr4']\n242\n243        self.attr5 = None\n244        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1 (str): Description of param1.
  • \n
  • param2 (int, optional): Description of param2. Multiple\nlines are supported.
  • \n
  • param3 (list of str): Description of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
246    @property\n247    def readonly_property(self):\n248        """str: Properties should be documented in their getter method."""\n249        return 'readonly_property'\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
251    @property\n252    def readwrite_property(self):\n253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n254        should only be documented in their getter method.\n255\n256        If the setter method contains notable behavior, it should be\n257        mentioned here.\n258        """\n259        return ['readwrite_property']\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
265    def example_method(self, param1, param2):\n266        """Class methods are similar to regular functions.\n267\n268        Note:\n269            Do not include the `self` parameter in the ``Args`` section.\n270\n271        Args:\n272            param1: The first parameter.\n273            param2: The second parameter.\n274\n275        Returns:\n276            True if successful, False otherwise.\n277\n278        """\n279        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note:
\n\n
\n

Do not include the self parameter in the Args section.

\n
\n\n
Arguments:
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns:
\n\n
\n

True if successful, False otherwise.

\n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n fetch_smalltable_rows(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
319def fetch_smalltable_rows(table_handle: Any,\n320                          keys: Sequence[str],\n321                          require_all_keys: bool = False,\n322) -> Mapping[bytes, Tuple[str]]:\n323    """Fetches rows from a Smalltable.\n324\n325    Retrieves rows pertaining to the given keys from the Table instance\n326    represented by table_handle.  String keys will be UTF-8 encoded.\n327\n328    Args:\n329        table_handle: An open smalltable.Table instance.\n330        keys: A sequence of strings representing the key of each table\n331          row to fetch.  String keys will be UTF-8 encoded.\n332        require_all_keys: Optional; If require_all_keys is True only\n333          rows with values set for all keys will be returned.\n334\n335    Returns:\n336        A dict mapping keys to the corresponding table row data\n337        fetched. Each row is represented as a tuple of strings. For\n338        example:\n339\n340        {b'Serak': ('Rigel VII', 'Preparer'),\n341         b'Zim': ('Irk', 'Invader'),\n342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n343\n344        Returned keys are always bytes.  If a key from the keys argument is\n345        missing from the dictionary, then that row was not found in the\n346        table (and require_all_keys must have been False).\n347\n348    Raises:\n349        IOError: An error occurred accessing the smalltable.\n350    """\n351    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table\nrow to fetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only\nrows with values set for all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n fetch_smalltable_rows2(\ttable_handle: Any,\tkeys: Sequence[str],\trequire_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:\n\n \n\n
\n \n
354def fetch_smalltable_rows2(table_handle: Any,\n355                          keys: Sequence[str],\n356                          require_all_keys: bool = False,\n357) -> Mapping[bytes, Tuple[str]]:\n358    """Fetches rows from a Smalltable.\n359\n360    Retrieves rows pertaining to the given keys from the Table instance\n361    represented by table_handle.  String keys will be UTF-8 encoded.\n362\n363    Args:\n364      table_handle:\n365        An open smalltable.Table instance.\n366      keys:\n367        A sequence of strings representing the key of each table row to\n368        fetch.  String keys will be UTF-8 encoded.\n369      require_all_keys:\n370        Optional; If require_all_keys is True only rows with values set\n371        for all keys will be returned.\n372\n373    Returns:\n374      A dict mapping keys to the corresponding table row data\n375      fetched. Each row is represented as a tuple of strings. For\n376      example:\n377\n378      {b'Serak': ('Rigel VII', 'Preparer'),\n379       b'Zim': ('Irk', 'Invader'),\n380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}\n381\n382      Returned keys are always bytes.  If a key from the keys argument is\n383      missing from the dictionary, then that row was not found in the\n384      table (and require_all_keys must have been False).\n385\n386    Raises:\n387      IOError: An error occurred accessing the smalltable.\n388    """\n389    raise NotImplementedError\n
\n\n\n

Fetches rows from a Smalltable.

\n\n

Retrieves rows pertaining to the given keys from the Table instance\nrepresented by table_handle. String keys will be UTF-8 encoded.

\n\n
Arguments:
\n\n
    \n
  • table_handle: An open smalltable.Table instance.
  • \n
  • keys: A sequence of strings representing the key of each table row to\nfetch. String keys will be UTF-8 encoded.
  • \n
  • require_all_keys: Optional; If require_all_keys is True only rows with values set\nfor all keys will be returned.
  • \n
\n\n
Returns:
\n\n
\n

A dict mapping keys to the corresponding table row data\n fetched. Each row is represented as a tuple of strings. For\n example:

\n \n

{b\'Serak\': (\'Rigel VII\', \'Preparer\'),\n b\'Zim\': (\'Irk\', \'Invader\'),\n b\'Lrrr\': (\'Omicron Persei 8\', \'Emperor\')}

\n \n

Returned keys are always bytes. If a key from the keys argument is\n missing from the dictionary, then that row was not found in the\n table (and require_all_keys must have been False).

\n
\n\n
Raises:
\n\n
    \n
  • IOError: An error occurred accessing the smalltable.
  • \n
\n
\n\n\n
\n
\n \n
\n \n class\n SampleClass:\n\n \n\n
\n \n
392class SampleClass:\n393    """Summary of class here.\n394\n395    Longer class information....\n396    Longer class information....\n397\n398    Attributes:\n399        likes_spam: A boolean indicating if we like SPAM or not.\n400        eggs: An integer count of the eggs we have laid.\n401    """\n402\n403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n407\n408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Summary of class here.

\n\n

Longer class information....\nLonger class information....

\n\n
Attributes:
\n\n
    \n
  • likes_spam: A boolean indicating if we like SPAM or not.
  • \n
  • eggs: An integer count of the eggs we have laid.
  • \n
\n
\n\n\n
\n \n
\n \n SampleClass(likes_spam=False)\n\n \n\n
\n \n
403    def __init__(self, likes_spam=False):\n404        """Inits SampleClass with blah."""\n405        self.likes_spam = likes_spam\n406        self.eggs = 0\n
\n\n\n

Inits SampleClass with blah.

\n
\n\n\n
\n
\n
\n likes_spam\n\n \n
\n \n \n \n\n
\n
\n
\n eggs\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n public_method(self):\n\n \n\n
\n \n
408    def public_method(self):\n409        """Performs operation blah."""\n
\n\n\n

Performs operation blah.

\n
\n\n\n
\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
412def invalid_format(test):\n413    """\n414    In this example, there is no colon after the argument and an empty section.\n415\n416    Args:\n417      test\n418        there is a colon missing in the previous line\n419    Returns:\n420\n421    """\n
\n\n\n

In this example, there is no colon after the argument and an empty section.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is a colon missing in the previous line
  • \n
\n\n

Returns:

\n
\n\n\n
\n
\n \n
\n \n def\n example_code():\n\n \n\n
\n \n
424def example_code():\n425    """\n426    Test case for https://github.com/mitmproxy/pdoc/issues/264.\n427\n428    Example:\n429\n430        ```python\n431        tmp = a2()\n432\n433        tmp2 = a()\n434        ```\n435    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/issues/264.

\n\n
Example:
\n\n
\n
\n
tmp = a2()\n\ntmp2 = a()\n
\n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n newline_after_args(test: str):\n\n \n\n
\n \n
438def newline_after_args(test: str):\n439    """\n440    Test case for https://github.com/mitmproxy/pdoc/pull/458.\n441\n442    Args:\n443\n444      test\n445        there is unexpected whitespace before test.\n446    """\n
\n\n\n

Test case for https://github.com/mitmproxy/pdoc/pull/458.

\n\n
Arguments:
\n\n
    \n
  • test\nthere is unexpected whitespace before test.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n alternative_section_names(test: str):\n\n \n\n
\n \n
449def alternative_section_names(test: str):\n450    """\n451    In this example, we check whether alternative section names aliased to\n452    'Args' are handled properly.\n453\n454    Parameters:\n455        test: the test string\n456    """\n
\n\n\n

In this example, we check whether alternative section names aliased to\n\'Args\' are handled properly.

\n\n
Arguments:
\n\n
    \n
  • test: the test string
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n keyword_arguments(**kwargs):\n\n \n\n
\n \n
458def keyword_arguments(**kwargs):\n459    """\n460    This an example for a function with keyword arguments documented in the docstring.\n461\n462    Args:\n463        **kwargs: A dictionary containing user info.\n464\n465    Keyword Arguments:\n466        str_arg (str): First string argument.\n467        int_arg (int): Second integer argument.\n468    """\n
\n\n\n

This an example for a function with keyword arguments documented in the docstring.

\n\n
Arguments:
\n\n
    \n
  • **kwargs: A dictionary containing user info.
  • \n
\n\n
Keyword Args:
\n\n
    \n
  • str_arg (str): First string argument.
  • \n
  • int_arg (int): Second integer argument.
  • \n
\n
\n\n\n
\n
\n\n' flavors_google API documentation

flavors_google

Example Google style docstrings.

This module demonstrates documentation as specified by the Google Python Style Guide. Docstrings may extend over multiple lines. Sections are created with a section header and a colon followed by a block of indented text.

Example:

Examples can be given using either the Example or Examples sections. Sections support any reStructuredText formatting, including literal blocks::

$ python example_google.py
    

Section breaks are created by resuming unindented text. Section breaks are also implicitly created anytime a new section starts.

Attributes:
  • module_level_variable1 (int): Module level variables may be documented in either the Attributes section of the module docstring, or in an inline docstring immediately following the variable.

    Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it.

Todo:
  • For module TODOs
  • You have to also use sphinx.ext.todo extension
  1# Examples taken from:
      2#
      3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
      4#   License: BSD-3
      5# - The Google Style Guide at https://google.github.io/styleguide/pyguide.html
      6#   License: CC BY 3.0
      7#
      8# flake8: noqa
      9# fmt: off
     10"""Example Google style docstrings.
     11
     12This module demonstrates documentation as specified by the `Google Python
     13Style Guide`_. Docstrings may extend over multiple lines. Sections are created
     14with a section header and a colon followed by a block of indented text.
     15
     16Example:
     17    Examples can be given using either the ``Example`` or ``Examples``
     18    sections. Sections support any reStructuredText formatting, including
     19    literal blocks::
     20
     21        $ python example_google.py
     22
     23Section breaks are created by resuming unindented text. Section breaks
     24are also implicitly created anytime a new section starts.
     25
     26Attributes:
     27    module_level_variable1 (int): Module level variables may be documented in
     28        either the ``Attributes`` section of the module docstring, or in an
     29        inline docstring immediately following the variable.
     30
     31        Either form is acceptable, but the two should not be mixed. Choose
     32        one convention to document module level variables and be consistent
     33        with it.
     34
     35Todo:
     36    * For module TODOs
     37    * You have to also use ``sphinx.ext.todo`` extension
     38
     39.. _Google Python Style Guide:
     40   http://google.github.io/styleguide/pyguide.html
     41
     42"""
     43__docformat__ = "google"
     44
     45from typing import Any, Mapping, Sequence, Tuple
     46
     47
     48module_level_variable1 = 12345
     49
     50module_level_variable2 = 98765
     51"""int: Module level variable documented inline.
     52
     53The docstring may span multiple lines. The type may optionally be specified
     54on the first line, separated by a colon.
     55"""
     56
     57
     58def function_with_types_in_docstring(param1, param2):
     59    """Example function with types documented in the docstring.
     60
     61    `PEP 484`_ type annotations are supported. If attribute, parameter, and
     62    return types are annotated according to `PEP 484`_, they do not need to be
     63    included in the docstring:
     64
     65    Args:
     66        param1 (int): The first parameter.
     67        param2 (str): The second parameter.
     68
     69    Returns:
     70        bool: The return value. True for success, False otherwise.
     71
     72    .. _PEP 484:
     73        https://www.python.org/dev/peps/pep-0484/
     74
     75    """
     76
     77
     78def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
     79    """Example function with PEP 484 type annotations.
     80
     81    Args:
     82        param1: The first parameter.
     83        param2: The second parameter.
     84
     85    Returns:
     86        The return value. True for success, False otherwise.
     87
     88    """
     89    raise NotImplementedError
     90
     91
     92def module_level_function(param1, param2=None, *args, **kwargs):
     93    """This is an example of a module level function.
     94
     95    Function parameters should be documented in the ``Args`` section. The name
     96    of each parameter is required. The type and description of each parameter
     97    is optional, but should be included if not obvious.
     98
     99    If *args or **kwargs are accepted,
    100    they should be listed as ``*args`` and ``**kwargs``.
    101
    102    The format for a parameter is::
    103
    104        name (type): description
    105            The description may span multiple lines. Following
    106            lines should be indented. The "(type)" is optional.
    107
    108            Multiple paragraphs are supported in parameter
    109            descriptions.
    110
    111    Args:
    112        param1 (int): The first parameter.
    113        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
    114            Second line of description should be indented.
    115        *args: Variable length argument list.
    116        **kwargs: Arbitrary keyword arguments.
    117
    118    Returns:
    119        bool: True if successful, False otherwise.
    120
    121        The return type is optional and may be specified at the beginning of
    122        the ``Returns`` section followed by a colon.
    123
    124        The ``Returns`` section may span multiple lines and paragraphs.
    125        Following lines should be indented to match the first line.
    126
    127        The ``Returns`` section supports any reStructuredText formatting,
    128        including literal blocks::
    129
    130            {
    131                'param1': param1,
    132                'param2': param2
    133            }
    134
    135    Raises:
    136        AttributeError: The ``Raises`` section is a list of all exceptions
    137            that are relevant to the interface.
    138        ValueError: If `param2` is equal to `param1`.
    139
    140    """
    141    if param1 == param2:
    142        raise ValueError('param1 may not be equal to param2')
    143    return True
    144
    145
    146def example_generator(n):
    147    """Generators have a ``Yields`` section instead of a ``Returns`` section.
    148
    149    Args:
    150        n (int): The upper limit of the range to generate, from 0 to `n` - 1.
    151
    152    Yields:
    153        int: The next number in the range of 0 to `n` - 1.
    154
    155    Examples:
    156        Examples should be written in doctest format, and should illustrate how
    157        to use the function.
    158
    159        >>> print([i for i in example_generator(4)])
    160        [0, 1, 2, 3]
    161
    162    """
    163    for i in range(n):
    164        yield i
    165
    166
    167class ExampleError(Exception):
    168    """Exceptions are documented in the same way as classes.
    169
    170    The __init__ method may be documented in either the class level
    171    docstring, or as a docstring on the __init__ method itself.
    172
    173    Either form is acceptable, but the two should not be mixed. Choose one
    174    convention to document the __init__ method and be consistent with it.
    175
    176    Note:
    177        Do not include the `self` parameter in the ``Args`` section.
    178
    179    Args:
    180        msg (str): Human readable string describing the exception.
    181        code (:obj:`int`, optional): Error code.
    182
    183    Attributes:
    184        msg (str): Human readable string describing the exception.
    185        code (int): Exception error code.
    186
    187    """
    188
    189    def __init__(self, msg, code):
    190        self.msg = msg
    191        self.code = code
    192
    193    def add_note(self, note: str):
    194        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    195
    196    def with_traceback(self, object, /):
    197        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    198
    199class ExampleClass(object):
    200    """The summary line for a class docstring should fit on one line.
    201
    202    If the class has public attributes, they may be documented here
    203    in an ``Attributes`` section and follow the same formatting as a
    204    function's ``Args`` section. Alternatively, attributes may be documented
    205    inline with the attribute's declaration (see __init__ method below).
    206
    207    Properties created with the ``@property`` decorator should be documented
    208    in the property's getter method.
    209
    210    Attributes:
    211        attr1 (str): Description of `attr1`.
    212        attr2 (:obj:`int`, optional): Description of `attr2`.
    213
    214    """
    215
    216    def __init__(self, param1, param2, param3):
    217        """Example of docstring on the __init__ method.
    218
    219        The __init__ method may be documented in either the class level
    220        docstring, or as a docstring on the __init__ method itself.
    221
    222        Either form is acceptable, but the two should not be mixed. Choose one
    223        convention to document the __init__ method and be consistent with it.
    224
    225        Note:
    226            Do not include the `self` parameter in the ``Args`` section.
    227
    228        Args:
    229            param1 (str): Description of `param1`.
    230            param2 (:obj:`int`, optional): Description of `param2`. Multiple
    231                lines are supported.
    232            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
    233
    234        """
    235        self.attr1 = param1
    236        self.attr2 = param2
    237        self.attr3 = param3  #: Doc comment *inline* with attribute
    238
    239        #: list of str: Doc comment *before* attribute, with type specified
    240        self.attr4 = ['attr4']
    241
    242        self.attr5 = None
    243        """str: Docstring *after* attribute, with type specified."""
    244
    245    @property
    246    def readonly_property(self):
    247        """str: Properties should be documented in their getter method."""
    248        return 'readonly_property'
    249
    250    @property
    251    def readwrite_property(self):
    252        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    253        should only be documented in their getter method.
    254
    255        If the setter method contains notable behavior, it should be
    256        mentioned here.
    257        """
    258        return ['readwrite_property']
    259
    260    @readwrite_property.setter
    261    def readwrite_property(self, value):
    262        value
    263
    264    def example_method(self, param1, param2):
    265        """Class methods are similar to regular functions.
    266
    267        Note:
    268            Do not include the `self` parameter in the ``Args`` section.
    269
    270        Args:
    271            param1: The first parameter.
    272            param2: The second parameter.
    273
    274        Returns:
    275            True if successful, False otherwise.
    276
    277        """
    278        return True
    279
    280    def __special__(self):
    281        """By default special members with docstrings are not included.
    282
    283        Special members are any methods or attributes that start with and
    284        end with a double underscore. Any special member with a docstring
    285        will be included in the output, if
    286        ``napoleon_include_special_with_doc`` is set to True.
    287
    288        This behavior can be enabled by changing the following setting in
    289        Sphinx's conf.py::
    290
    291            napoleon_include_special_with_doc = True
    292
    293        """
    294        pass
    295
    296    def __special_without_docstring__(self):
    297        pass
    298
    299    def _private(self):
    300        """By default private members are not included.
    301
    302        Private members are any methods or attributes that start with an
    303        underscore and are *not* special. By default they are not included
    304        in the output.
    305
    306        This behavior can be changed such that private members *are* included
    307        by changing the following setting in Sphinx's conf.py::
    308
    309            napoleon_include_private_with_doc = True
    310
    311        """
    312        pass
    313
    314    def _private_without_docstring(self):
    315        pass
    316
    317
    318def fetch_smalltable_rows(table_handle: Any,
    319                          keys: Sequence[str],
    320                          require_all_keys: bool = False,
    321) -> Mapping[bytes, Tuple[str]]:
    322    """Fetches rows from a Smalltable.
    323
    324    Retrieves rows pertaining to the given keys from the Table instance
    325    represented by table_handle.  String keys will be UTF-8 encoded.
    326
    327    Args:
    328        table_handle: An open smalltable.Table instance.
    329        keys: A sequence of strings representing the key of each table
    330          row to fetch.  String keys will be UTF-8 encoded.
    331        require_all_keys: Optional; If require_all_keys is True only
    332          rows with values set for all keys will be returned.
    333
    334    Returns:
    335        A dict mapping keys to the corresponding table row data
    336        fetched. Each row is represented as a tuple of strings. For
    337        example:
    338
    339        {b'Serak': ('Rigel VII', 'Preparer'),
    340         b'Zim': ('Irk', 'Invader'),
    341         b'Lrrr': ('Omicron Persei 8', 'Emperor')}
    342
    343        Returned keys are always bytes.  If a key from the keys argument is
    344        missing from the dictionary, then that row was not found in the
    345        table (and require_all_keys must have been False).
    346
    347    Raises:
    348        IOError: An error occurred accessing the smalltable.
    349    """
    350    raise NotImplementedError
    351
    352
    353def fetch_smalltable_rows2(table_handle: Any,
    354                          keys: Sequence[str],
    355                          require_all_keys: bool = False,
    356) -> Mapping[bytes, Tuple[str]]:
    357    """Fetches rows from a Smalltable.
    358
    359    Retrieves rows pertaining to the given keys from the Table instance
    360    represented by table_handle.  String keys will be UTF-8 encoded.
    361
    362    Args:
    363      table_handle:
    364        An open smalltable.Table instance.
    365      keys:
    366        A sequence of strings representing the key of each table row to
    367        fetch.  String keys will be UTF-8 encoded.
    368      require_all_keys:
    369        Optional; If require_all_keys is True only rows with values set
    370        for all keys will be returned.
    371
    372    Returns:
    373      A dict mapping keys to the corresponding table row data
    374      fetched. Each row is represented as a tuple of strings. For
    375      example:
    376
    377      {b'Serak': ('Rigel VII', 'Preparer'),
    378       b'Zim': ('Irk', 'Invader'),
    379       b'Lrrr': ('Omicron Persei 8', 'Emperor')}
    380
    381      Returned keys are always bytes.  If a key from the keys argument is
    382      missing from the dictionary, then that row was not found in the
    383      table (and require_all_keys must have been False).
    384
    385    Raises:
    386      IOError: An error occurred accessing the smalltable.
    387    """
    388    raise NotImplementedError
    389
    390
    391class SampleClass:
    392    """Summary of class here.
    393
    394    Longer class information....
    395    Longer class information....
    396
    397    Attributes:
    398        likes_spam: A boolean indicating if we like SPAM or not.
    399        eggs: An integer count of the eggs we have laid.
    400    """
    401
    402    def __init__(self, likes_spam=False):
    403        """Inits SampleClass with blah."""
    404        self.likes_spam = likes_spam
    405        self.eggs = 0
    406
    407    def public_method(self):
    408        """Performs operation blah."""
    409
    410
    411def invalid_format(test):
    412    """
    413    In this example, there is no colon after the argument and an empty section.
    414
    415    Args:
    416      test
    417        there is a colon missing in the previous line
    418    Returns:
    419
    420    """
    421
    422
    423def example_code():
    424    """
    425    Test case for https://github.com/mitmproxy/pdoc/issues/264.
    426
    427    Example:
    428
    429        ```python
    430        tmp = a2()
    431
    432        tmp2 = a()
    433        ```
    434    """
    435
    436
    437def newline_after_args(test: str):
    438    """
    439    Test case for https://github.com/mitmproxy/pdoc/pull/458.
    440
    441    Args:
    442
    443      test
    444        there is unexpected whitespace before test.
    445    """
    446
    447
    448def alternative_section_names(test: str):
    449    """
    450    In this example, we check whether alternative section names aliased to
    451    'Args' are handled properly.
    452
    453    Parameters:
    454        test: the test string
    455    """
    456
    457def keyword_arguments(**kwargs):
    458    """
    459    This an example for a function with keyword arguments documented in the docstring.
    460
    461    Args:
    462        **kwargs: A dictionary containing user info.
    463
    464    Keyword Arguments:
    465        str_arg (str): First string argument.
    466        int_arg (int): Second integer argument.
    467    """
    
module_level_variable1 = 12345
module_level_variable2 = 98765

int: Module level variable documented inline.

The docstring may span multiple lines. The type may optionally be specified on the first line, separated by a colon.

def function_with_types_in_docstring(param1, param2):
59def function_with_types_in_docstring(param1, param2):
    60    """Example function with types documented in the docstring.
    61
    62    `PEP 484`_ type annotations are supported. If attribute, parameter, and
    63    return types are annotated according to `PEP 484`_, they do not need to be
    64    included in the docstring:
    65
    66    Args:
    67        param1 (int): The first parameter.
    68        param2 (str): The second parameter.
    69
    70    Returns:
    71        bool: The return value. True for success, False otherwise.
    72
    73    .. _PEP 484:
    74        https://www.python.org/dev/peps/pep-0484/
    75
    76    """
    

Example function with types documented in the docstring.

PEP 484 type annotations are supported. If attribute, parameter, and return types are annotated according to PEP 484, they do not need to be included in the docstring:

Arguments:
  • param1 (int): The first parameter.
  • param2 (str): The second parameter.
Returns:

bool: The return value. True for success, False otherwise.

def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
79def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
    80    """Example function with PEP 484 type annotations.
    81
    82    Args:
    83        param1: The first parameter.
    84        param2: The second parameter.
    85
    86    Returns:
    87        The return value. True for success, False otherwise.
    88
    89    """
    90    raise NotImplementedError
    

Example function with PEP 484 type annotations.

Arguments:
  • param1: The first parameter.
  • param2: The second parameter.
Returns:

The return value. True for success, False otherwise.

def module_level_function(param1, param2=None, *args, **kwargs):
 93def module_level_function(param1, param2=None, *args, **kwargs):
     94    """This is an example of a module level function.
     95
     96    Function parameters should be documented in the ``Args`` section. The name
     97    of each parameter is required. The type and description of each parameter
     98    is optional, but should be included if not obvious.
     99
    100    If *args or **kwargs are accepted,
    101    they should be listed as ``*args`` and ``**kwargs``.
    102
    103    The format for a parameter is::
    104
    105        name (type): description
    106            The description may span multiple lines. Following
    107            lines should be indented. The "(type)" is optional.
    108
    109            Multiple paragraphs are supported in parameter
    110            descriptions.
    111
    112    Args:
    113        param1 (int): The first parameter.
    114        param2 (:obj:`str`, optional): The second parameter. Defaults to None.
    115            Second line of description should be indented.
    116        *args: Variable length argument list.
    117        **kwargs: Arbitrary keyword arguments.
    118
    119    Returns:
    120        bool: True if successful, False otherwise.
    121
    122        The return type is optional and may be specified at the beginning of
    123        the ``Returns`` section followed by a colon.
    124
    125        The ``Returns`` section may span multiple lines and paragraphs.
    126        Following lines should be indented to match the first line.
    127
    128        The ``Returns`` section supports any reStructuredText formatting,
    129        including literal blocks::
    130
    131            {
    132                'param1': param1,
    133                'param2': param2
    134            }
    135
    136    Raises:
    137        AttributeError: The ``Raises`` section is a list of all exceptions
    138            that are relevant to the interface.
    139        ValueError: If `param2` is equal to `param1`.
    140
    141    """
    142    if param1 == param2:
    143        raise ValueError('param1 may not be equal to param2')
    144    return True
    

This is an example of a module level function.

Function parameters should be documented in the Args section. The name of each parameter is required. The type and description of each parameter is optional, but should be included if not obvious.

-

If args or *kwargs are accepted, ? ^^^^ ^^^^^ +

If *args or **kwargs are accepted, ? ^ ^ they should be listed as *args and **kwargs.

The format for a parameter is::

name (type): description
        The description may span multiple lines. Following
        lines should be indented. The "(type)" is optional.
    
        Multiple paragraphs are supported in parameter
        descriptions.
    
Arguments:
  • param1 (int): The first parameter.
  • param2 (str, optional): The second parameter. Defaults to None. Second line of description should be indented.
  • -
  • *args: Variable length argument list.
  • ? - +
  • *args: Variable length argument list.
  • ? + -
  • **kwargs: Arbitrary keyword arguments.
  • ? -- +
  • **kwargs: Arbitrary keyword arguments.
  • ? ++
Returns:

bool: True if successful, False otherwise.

The return type is optional and may be specified at the beginning of the Returns section followed by a colon.

The Returns section may span multiple lines and paragraphs. Following lines should be indented to match the first line.

The Returns section supports any reStructuredText formatting, including literal blocks::

{
        'param1': param1,
        'param2': param2
    }
    
Raises:
  • AttributeError: The Raises section is a list of all exceptions that are relevant to the interface.
  • ValueError: If param2 is equal to param1.
def example_generator(n):
147def example_generator(n):
    148    """Generators have a ``Yields`` section instead of a ``Returns`` section.
    149
    150    Args:
    151        n (int): The upper limit of the range to generate, from 0 to `n` - 1.
    152
    153    Yields:
    154        int: The next number in the range of 0 to `n` - 1.
    155
    156    Examples:
    157        Examples should be written in doctest format, and should illustrate how
    158        to use the function.
    159
    160        >>> print([i for i in example_generator(4)])
    161        [0, 1, 2, 3]
    162
    163    """
    164    for i in range(n):
    165        yield i
    

Generators have a Yields section instead of a Returns section.

Arguments:
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
Yields:

int: The next number in the range of 0 to n - 1.

Examples:

Examples should be written in doctest format, and should illustrate how to use the function.

>>> print([i for i in example_generator(4)])
    [0, 1, 2, 3]
    
class ExampleError(builtins.Exception):
168class ExampleError(Exception):
    169    """Exceptions are documented in the same way as classes.
    170
    171    The __init__ method may be documented in either the class level
    172    docstring, or as a docstring on the __init__ method itself.
    173
    174    Either form is acceptable, but the two should not be mixed. Choose one
    175    convention to document the __init__ method and be consistent with it.
    176
    177    Note:
    178        Do not include the `self` parameter in the ``Args`` section.
    179
    180    Args:
    181        msg (str): Human readable string describing the exception.
    182        code (:obj:`int`, optional): Error code.
    183
    184    Attributes:
    185        msg (str): Human readable string describing the exception.
    186        code (int): Exception error code.
    187
    188    """
    189
    190    def __init__(self, msg, code):
    191        self.msg = msg
    192        self.code = code
    193
    194    def add_note(self, note: str):
    195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    196
    197    def with_traceback(self, object, /):
    198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    

Exceptions are documented in the same way as classes.

The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself.

Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it.

Note:

Do not include the self parameter in the Args section.

Arguments:
  • msg (str): Human readable string describing the exception.
  • code (int, optional): Error code.
Attributes:
  • msg (str): Human readable string describing the exception.
  • code (int): Exception error code.
ExampleError(msg, code)
190    def __init__(self, msg, code):
    191        self.msg = msg
    192        self.code = code
    
msg
code
def add_note(self, note: str):
194    def add_note(self, note: str):
    195        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

def with_traceback(self, object, /):
197    def with_traceback(self, object, /):
    198        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

class ExampleClass:
200class ExampleClass(object):
    201    """The summary line for a class docstring should fit on one line.
    202
    203    If the class has public attributes, they may be documented here
    204    in an ``Attributes`` section and follow the same formatting as a
    205    function's ``Args`` section. Alternatively, attributes may be documented
    206    inline with the attribute's declaration (see __init__ method below).
    207
    208    Properties created with the ``@property`` decorator should be documented
    209    in the property's getter method.
    210
    211    Attributes:
    212        attr1 (str): Description of `attr1`.
    213        attr2 (:obj:`int`, optional): Description of `attr2`.
    214
    215    """
    216
    217    def __init__(self, param1, param2, param3):
    218        """Example of docstring on the __init__ method.
    219
    220        The __init__ method may be documented in either the class level
    221        docstring, or as a docstring on the __init__ method itself.
    222
    223        Either form is acceptable, but the two should not be mixed. Choose one
    224        convention to document the __init__ method and be consistent with it.
    225
    226        Note:
    227            Do not include the `self` parameter in the ``Args`` section.
    228
    229        Args:
    230            param1 (str): Description of `param1`.
    231            param2 (:obj:`int`, optional): Description of `param2`. Multiple
    232                lines are supported.
    233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
    234
    235        """
    236        self.attr1 = param1
    237        self.attr2 = param2
    238        self.attr3 = param3  #: Doc comment *inline* with attribute
    239
    240        #: list of str: Doc comment *before* attribute, with type specified
    241        self.attr4 = ['attr4']
    242
    243        self.attr5 = None
    244        """str: Docstring *after* attribute, with type specified."""
    245
    246    @property
    247    def readonly_property(self):
    248        """str: Properties should be documented in their getter method."""
    249        return 'readonly_property'
    250
    251    @property
    252    def readwrite_property(self):
    253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    254        should only be documented in their getter method.
    255
    256        If the setter method contains notable behavior, it should be
    257        mentioned here.
    258        """
    259        return ['readwrite_property']
    260
    261    @readwrite_property.setter
    262    def readwrite_property(self, value):
    263        value
    264
    265    def example_method(self, param1, param2):
    266        """Class methods are similar to regular functions.
    267
    268        Note:
    269            Do not include the `self` parameter in the ``Args`` section.
    270
    271        Args:
    272            param1: The first parameter.
    273            param2: The second parameter.
    274
    275        Returns:
    276            True if successful, False otherwise.
    277
    278        """
    279        return True
    280
    281    def __special__(self):
    282        """By default special members with docstrings are not included.
    283
    284        Special members are any methods or attributes that start with and
    285        end with a double underscore. Any special member with a docstring
    286        will be included in the output, if
    287        ``napoleon_include_special_with_doc`` is set to True.
    288
    289        This behavior can be enabled by changing the following setting in
    290        Sphinx's conf.py::
    291
    292            napoleon_include_special_with_doc = True
    293
    294        """
    295        pass
    296
    297    def __special_without_docstring__(self):
    298        pass
    299
    300    def _private(self):
    301        """By default private members are not included.
    302
    303        Private members are any methods or attributes that start with an
    304        underscore and are *not* special. By default they are not included
    305        in the output.
    306
    307        This behavior can be changed such that private members *are* included
    308        by changing the following setting in Sphinx's conf.py::
    309
    310            napoleon_include_private_with_doc = True
    311
    312        """
    313        pass
    314
    315    def _private_without_docstring(self):
    316        pass
    

The summary line for a class docstring should fit on one line.

If the class has public attributes, they may be documented here in an Attributes section and follow the same formatting as a function's Args section. Alternatively, attributes may be documented inline with the attribute's declaration (see __init__ method below).

Properties created with the @property decorator should be documented in the property's getter method.

Attributes:
  • attr1 (str): Description of attr1.
  • attr2 (int, optional): Description of attr2.
ExampleClass(param1, param2, param3)
217    def __init__(self, param1, param2, param3):
    218        """Example of docstring on the __init__ method.
    219
    220        The __init__ method may be documented in either the class level
    221        docstring, or as a docstring on the __init__ method itself.
    222
    223        Either form is acceptable, but the two should not be mixed. Choose one
    224        convention to document the __init__ method and be consistent with it.
    225
    226        Note:
    227            Do not include the `self` parameter in the ``Args`` section.
    228
    229        Args:
    230            param1 (str): Description of `param1`.
    231            param2 (:obj:`int`, optional): Description of `param2`. Multiple
    232                lines are supported.
    233            param3 (:obj:`list` of :obj:`str`): Description of `param3`.
    234
    235        """
    236        self.attr1 = param1
    237        self.attr2 = param2
    238        self.attr3 = param3  #: Doc comment *inline* with attribute
    239
    240        #: list of str: Doc comment *before* attribute, with type specified
    241        self.attr4 = ['attr4']
    242
    243        self.attr5 = None
    244        """str: Docstring *after* attribute, with type specified."""
    

Example of docstring on the __init__ method.

The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself.

Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it.

Note:

Do not include the self parameter in the Args section.

Arguments:
  • param1 (str): Description of param1.
  • param2 (int, optional): Description of param2. Multiple lines are supported.
  • param3 (list of str): Description of param3.
attr1
attr2
attr3
attr4
attr5

str: Docstring after attribute, with type specified.

readonly_property
246    @property
    247    def readonly_property(self):
    248        """str: Properties should be documented in their getter method."""
    249        return 'readonly_property'
    

str: Properties should be documented in their getter method.

readwrite_property
251    @property
    252    def readwrite_property(self):
    253        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    254        should only be documented in their getter method.
    255
    256        If the setter method contains notable behavior, it should be
    257        mentioned here.
    258        """
    259        return ['readwrite_property']
    

list of str: Properties with both a getter and setter should only be documented in their getter method.

If the setter method contains notable behavior, it should be mentioned here.

def example_method(self, param1, param2):
265    def example_method(self, param1, param2):
    266        """Class methods are similar to regular functions.
    267
    268        Note:
    269            Do not include the `self` parameter in the ``Args`` section.
    270
    271        Args:
    272            param1: The first parameter.
    273            param2: The second parameter.
    274
    275        Returns:
    276            True if successful, False otherwise.
    277
    278        """
    279        return True
    

Class methods are similar to regular functions.

Note:

Do not include the self parameter in the Args section.

Arguments:
  • param1: The first parameter.
  • param2: The second parameter.
Returns:

True if successful, False otherwise.

def fetch_smalltable_rows( table_handle: Any, keys: Sequence[str], require_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:
319def fetch_smalltable_rows(table_handle: Any,
    320                          keys: Sequence[str],
    321                          require_all_keys: bool = False,
    322) -> Mapping[bytes, Tuple[str]]:
    323    """Fetches rows from a Smalltable.
    324
    325    Retrieves rows pertaining to the given keys from the Table instance
    326    represented by table_handle.  String keys will be UTF-8 encoded.
    327
    328    Args:
    329        table_handle: An open smalltable.Table instance.
    330        keys: A sequence of strings representing the key of each table
    331          row to fetch.  String keys will be UTF-8 encoded.
    332        require_all_keys: Optional; If require_all_keys is True only
    333          rows with values set for all keys will be returned.
    334
    335    Returns:
    336        A dict mapping keys to the corresponding table row data
    337        fetched. Each row is represented as a tuple of strings. For
    338        example:
    339
    340        {b'Serak': ('Rigel VII', 'Preparer'),
    341         b'Zim': ('Irk', 'Invader'),
    342         b'Lrrr': ('Omicron Persei 8', 'Emperor')}
    343
    344        Returned keys are always bytes.  If a key from the keys argument is
    345        missing from the dictionary, then that row was not found in the
    346        table (and require_all_keys must have been False).
    347
    348    Raises:
    349        IOError: An error occurred accessing the smalltable.
    350    """
    351    raise NotImplementedError
    

Fetches rows from a Smalltable.

Retrieves rows pertaining to the given keys from the Table instance represented by table_handle. String keys will be UTF-8 encoded.

Arguments:
  • table_handle: An open smalltable.Table instance.
  • keys: A sequence of strings representing the key of each table row to fetch. String keys will be UTF-8 encoded.
  • require_all_keys: Optional; If require_all_keys is True only rows with values set for all keys will be returned.
Returns:

A dict mapping keys to the corresponding table row data fetched. Each row is represented as a tuple of strings. For example:

{b'Serak': ('Rigel VII', 'Preparer'), b'Zim': ('Irk', 'Invader'), b'Lrrr': ('Omicron Persei 8', 'Emperor')}

Returned keys are always bytes. If a key from the keys argument is missing from the dictionary, then that row was not found in the table (and require_all_keys must have been False).

Raises:
  • IOError: An error occurred accessing the smalltable.
def fetch_smalltable_rows2( table_handle: Any, keys: Sequence[str], require_all_keys: bool = False) -> Mapping[bytes, Tuple[str]]:
354def fetch_smalltable_rows2(table_handle: Any,
    355                          keys: Sequence[str],
    356                          require_all_keys: bool = False,
    357) -> Mapping[bytes, Tuple[str]]:
    358    """Fetches rows from a Smalltable.
    359
    360    Retrieves rows pertaining to the given keys from the Table instance
    361    represented by table_handle.  String keys will be UTF-8 encoded.
    362
    363    Args:
    364      table_handle:
    365        An open smalltable.Table instance.
    366      keys:
    367        A sequence of strings representing the key of each table row to
    368        fetch.  String keys will be UTF-8 encoded.
    369      require_all_keys:
    370        Optional; If require_all_keys is True only rows with values set
    371        for all keys will be returned.
    372
    373    Returns:
    374      A dict mapping keys to the corresponding table row data
    375      fetched. Each row is represented as a tuple of strings. For
    376      example:
    377
    378      {b'Serak': ('Rigel VII', 'Preparer'),
    379       b'Zim': ('Irk', 'Invader'),
    380       b'Lrrr': ('Omicron Persei 8', 'Emperor')}
    381
    382      Returned keys are always bytes.  If a key from the keys argument is
    383      missing from the dictionary, then that row was not found in the
    384      table (and require_all_keys must have been False).
    385
    386    Raises:
    387      IOError: An error occurred accessing the smalltable.
    388    """
    389    raise NotImplementedError
    

Fetches rows from a Smalltable.

Retrieves rows pertaining to the given keys from the Table instance represented by table_handle. String keys will be UTF-8 encoded.

Arguments:
  • table_handle: An open smalltable.Table instance.
  • keys: A sequence of strings representing the key of each table row to fetch. String keys will be UTF-8 encoded.
  • require_all_keys: Optional; If require_all_keys is True only rows with values set for all keys will be returned.
Returns:

A dict mapping keys to the corresponding table row data fetched. Each row is represented as a tuple of strings. For example:

{b'Serak': ('Rigel VII', 'Preparer'), b'Zim': ('Irk', 'Invader'), b'Lrrr': ('Omicron Persei 8', 'Emperor')}

Returned keys are always bytes. If a key from the keys argument is missing from the dictionary, then that row was not found in the table (and require_all_keys must have been False).

Raises:
  • IOError: An error occurred accessing the smalltable.
class SampleClass:
392class SampleClass:
    393    """Summary of class here.
    394
    395    Longer class information....
    396    Longer class information....
    397
    398    Attributes:
    399        likes_spam: A boolean indicating if we like SPAM or not.
    400        eggs: An integer count of the eggs we have laid.
    401    """
    402
    403    def __init__(self, likes_spam=False):
    404        """Inits SampleClass with blah."""
    405        self.likes_spam = likes_spam
    406        self.eggs = 0
    407
    408    def public_method(self):
    409        """Performs operation blah."""
    

Summary of class here.

Longer class information.... Longer class information....

Attributes:
  • likes_spam: A boolean indicating if we like SPAM or not.
  • eggs: An integer count of the eggs we have laid.
SampleClass(likes_spam=False)
403    def __init__(self, likes_spam=False):
    404        """Inits SampleClass with blah."""
    405        self.likes_spam = likes_spam
    406        self.eggs = 0
    

Inits SampleClass with blah.

likes_spam
eggs
def public_method(self):
408    def public_method(self):
    409        """Performs operation blah."""
    

Performs operation blah.

def invalid_format(test):
412def invalid_format(test):
    413    """
    414    In this example, there is no colon after the argument and an empty section.
    415
    416    Args:
    417      test
    418        there is a colon missing in the previous line
    419    Returns:
    420
    421    """
    

In this example, there is no colon after the argument and an empty section.

Arguments:
  • test there is a colon missing in the previous line

Returns:

def example_code():
424def example_code():
    425    """
    426    Test case for https://github.com/mitmproxy/pdoc/issues/264.
    427
    428    Example:
    429
    430        ```python
    431        tmp = a2()
    432
    433        tmp2 = a()
    434        ```
    435    """
    

Test case for https://github.com/mitmproxy/pdoc/issues/264.

Example:
tmp = a2()
    
    tmp2 = a()
    
def newline_after_args(test: str):
438def newline_after_args(test: str):
    439    """
    440    Test case for https://github.com/mitmproxy/pdoc/pull/458.
    441
    442    Args:
    443
    444      test
    445        there is unexpected whitespace before test.
    446    """
    

Test case for https://github.com/mitmproxy/pdoc/pull/458.

Arguments:
  • test there is unexpected whitespace before test.
def alternative_section_names(test: str):
449def alternative_section_names(test: str):
    450    """
    451    In this example, we check whether alternative section names aliased to
    452    'Args' are handled properly.
    453
    454    Parameters:
    455        test: the test string
    456    """
    

In this example, we check whether alternative section names aliased to 'Args' are handled properly.

Arguments:
  • test: the test string
def keyword_arguments(**kwargs):
458def keyword_arguments(**kwargs):
    459    """
    460    This an example for a function with keyword arguments documented in the docstring.
    461
    462    Args:
    463        **kwargs: A dictionary containing user info.
    464
    465    Keyword Arguments:
    466        str_arg (str): First string argument.
    467        int_arg (int): Second integer argument.
    468    """
    

This an example for a function with keyword arguments documented in the docstring.

Arguments:
    -
  • **kwargs: A dictionary containing user info.
  • ? -- +
  • **kwargs: A dictionary containing user info.
  • ? ++
Keyword Args:
  • str_arg (str): First string argument.
  • int_arg (int): Second integer argument.
FAILED test/test_snapshot.py::test_snapshots[html-flavors_numpy] - AssertionError: Rendered output does not match for snapshot flavors_numpy. Run `python3 ./test/test_snapshot.py` to update snapshots. assert '\n\n\n \n \n \n flavors_numpy API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_numpy

\n\n

Example NumPy-style docstrings.

\n\n

This module demonstrates documentation as specified by the NumPy\nDocumentation HOWTO. Docstrings may extend over multiple lines. Sections\nare created with a section header followed by an underline of equal length.

\n\n
Example
\n\n

Examples can be given using either the Example or Examples\nsections. Sections support any reStructuredText formatting, including\nliteral blocks::

\n\n
$ python example_numpy.py\n
\n\n

Section breaks are created with two blank lines. Section breaks are also\nimplicitly created anytime a new section starts. Section bodies may be\nindented:

\n\n
Notes
\n\n

This is an example of an indented section. It\'s like any other section,\nbut the body is indented to help it stand out from surrounding text.\nIf a section is indented, then a section break is created by\nresuming unindented text.

\n\n
Attributes
\n\n
    \n
  • module_level_variable1 (int):\nModule level variables may be documented in either the Attributes\nsection of the module docstring, or in an inline docstring immediately\nfollowing the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html\n  4#   License: BSD-3\n  5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py\n  6#   License: BSD-2\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example NumPy-style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `NumPy\n 13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections\n 14are created with a section header followed by an underline of equal length.\n 15\n 16Example\n 17-------\n 18Examples can be given using either the ``Example`` or ``Examples``\n 19sections. Sections support any reStructuredText formatting, including\n 20literal blocks::\n 21\n 22    $ python example_numpy.py\n 23\n 24\n 25Section breaks are created with two blank lines. Section breaks are also\n 26implicitly created anytime a new section starts. Section bodies *may* be\n 27indented:\n 28\n 29Notes\n 30-----\n 31    This is an example of an indented section. It's like any other section,\n 32    but the body is indented to help it stand out from surrounding text.\n 33\n 34If a section is indented, then a section break is created by\n 35resuming unindented text.\n 36\n 37Attributes\n 38----------\n 39module_level_variable1 : int\n 40    Module level variables may be documented in either the ``Attributes``\n 41    section of the module docstring, or in an inline docstring immediately\n 42    following the variable.\n 43\n 44    Either form is acceptable, but the two should not be mixed. Choose\n 45    one convention to document module level variables and be consistent\n 46    with it.\n 47\n 48\n 49.. _NumPy Documentation HOWTO:\n 50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n 51\n 52"""\n 53__docformat__ = "numpy"\n 54\n 55\n 56module_level_variable1 = 12345\n 57\n 58module_level_variable2 = 98765\n 59"""int: Module level variable documented inline.\n 60\n 61The docstring may span multiple lines. The type may optionally be specified\n 62on the first line, separated by a colon.\n 63"""\n 64\n 65\n 66def function_with_types_in_docstring(param1, param2):\n 67    """Example function with types documented in the docstring.\n 68\n 69    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 70    return types are annotated according to `PEP 484`_, they do not need to be\n 71    included in the docstring:\n 72\n 73    Parameters\n 74    ----------\n 75    param1 : int\n 76        The first parameter.\n 77    param2 : str\n 78        The second parameter.\n 79\n 80    Returns\n 81    -------\n 82    bool\n 83        True if successful, False otherwise.\n 84\n 85    .. _PEP 484:\n 86        https://www.python.org/dev/peps/pep-0484/\n 87\n 88    """\n 89\n 90\n 91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 92    """Example function with PEP 484 type annotations.\n 93\n 94    The return type must be duplicated in the docstring to comply\n 95    with the NumPy docstring style.\n 96\n 97    Parameters\n 98    ----------\n 99    param1\n100        The first parameter.\n101    param2\n102        The second parameter.\n103\n104    Returns\n105    -------\n106    bool\n107        True if successful, False otherwise.\n108\n109    """\n110    raise NotImplementedError\n111\n112\n113def module_level_function(param1, param2=None, *args, **kwargs):\n114    """This is an example of a module level function.\n115\n116    Function parameters should be documented in the ``Parameters`` section.\n117    The name of each parameter is required. The type and description of each\n118    parameter is optional, but should be included if not obvious.\n119\n120    If *args or **kwargs are accepted,\n121    they should be listed as ``*args`` and ``**kwargs``.\n122\n123    The format for a parameter is::\n124\n125        name : type\n126            description\n127\n128            The description may span multiple lines. Following lines\n129            should be indented to match the first line of the description.\n130            The ": type" is optional.\n131\n132            Multiple paragraphs are supported in parameter\n133            descriptions.\n134\n135    Parameters\n136    ----------\n137    param1 : int\n138        The first parameter.\n139    param2 : :obj:`str`, optional\n140        The second parameter.\n141    *args\n142        Variable length argument list.\n143    **kwargs\n144        Arbitrary keyword arguments.\n145\n146    Returns\n147    -------\n148    bool\n149        True if successful, False otherwise.\n150\n151        The return type is not optional. The ``Returns`` section may span\n152        multiple lines and paragraphs. Following lines should be indented to\n153        match the first line of the description.\n154\n155        The ``Returns`` section supports any reStructuredText formatting,\n156        including literal blocks::\n157\n158            {\n159                'param1': param1,\n160                'param2': param2\n161            }\n162\n163    Raises\n164    ------\n165    AttributeError\n166        The ``Raises`` section is a list of all exceptions\n167        that are relevant to the interface.\n168    ValueError\n169        If `param2` is equal to `param1`.\n170\n171    """\n172    if param1 == param2:\n173        raise ValueError('param1 may not be equal to param2')\n174    return True\n175\n176\n177def example_generator(n):\n178    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n179\n180    Parameters\n181    ----------\n182    n : int\n183        The upper limit of the range to generate, from 0 to `n` - 1.\n184\n185    Yields\n186    ------\n187    int\n188        The next number in the range of 0 to `n` - 1.\n189\n190    Examples\n191    --------\n192    Examples should be written in doctest format, and should illustrate how\n193    to use the function.\n194\n195    >>> print([i for i in example_generator(4)])\n196    [0, 1, 2, 3]\n197\n198    """\n199    for i in range(n):\n200        yield i\n201\n202\n203class ExampleError(Exception):\n204    """Exceptions are documented in the same way as classes.\n205\n206    The __init__ method may be documented in either the class level\n207    docstring, or as a docstring on the __init__ method itself.\n208\n209    Either form is acceptable, but the two should not be mixed. Choose one\n210    convention to document the __init__ method and be consistent with it.\n211\n212    Note\n213    ----\n214    Do not include the `self` parameter in the ``Parameters`` section.\n215\n216    Parameters\n217    ----------\n218    msg : str\n219        Human readable string describing the exception.\n220    code : :obj:`int`, optional\n221        Numeric error code.\n222\n223    Attributes\n224    ----------\n225    msg : str\n226        Human readable string describing the exception.\n227    code : int\n228        Numeric error code.\n229\n230    """\n231\n232    def __init__(self, msg, code):\n233        self.msg = msg\n234        self.code = code\n235\n236    def add_note(self, note: str):\n237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n238\n239    def with_traceback(self, object, /):\n240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n241\n242class ExampleClass(object):\n243    """The summary line for a class docstring should fit on one line.\n244\n245    If the class has public attributes, they may be documented here\n246    in an ``Attributes`` section and follow the same formatting as a\n247    function's ``Args`` section. Alternatively, attributes may be documented\n248    inline with the attribute's declaration (see __init__ method below).\n249\n250    Properties created with the ``@property`` decorator should be documented\n251    in the property's getter method.\n252\n253    Attributes\n254    ----------\n255    attr1 : str\n256        Description of `attr1`.\n257    attr2 : :obj:`int`, optional\n258        Description of `attr2`.\n259\n260    """\n261\n262    def __init__(self, param1, param2, param3):\n263        """Example of docstring on the __init__ method.\n264\n265        The __init__ method may be documented in either the class level\n266        docstring, or as a docstring on the __init__ method itself.\n267\n268        Either form is acceptable, but the two should not be mixed. Choose one\n269        convention to document the __init__ method and be consistent with it.\n270\n271        Note\n272        ----\n273        Do not include the `self` parameter in the ``Parameters`` section.\n274\n275        Parameters\n276        ----------\n277        param1 : str\n278            Description of `param1`.\n279        param2 : :obj:`list` of :obj:`str`\n280            Description of `param2`. Multiple\n281            lines are supported.\n282        param3 : :obj:`int`, optional\n283            Description of `param3`.\n284\n285        """\n286        self.attr1 = param1\n287        self.attr2 = param2\n288        self.attr3 = param3  #: Doc comment *inline* with attribute\n289\n290        #: list of str: Doc comment *before* attribute, with type specified\n291        self.attr4 = ["attr4"]\n292\n293        self.attr5 = None\n294        """str: Docstring *after* attribute, with type specified."""\n295\n296    @property\n297    def readonly_property(self):\n298        """str: Properties should be documented in their getter method."""\n299        return "readonly_property"\n300\n301    @property\n302    def readwrite_property(self):\n303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n304        should only be documented in their getter method.\n305\n306        If the setter method contains notable behavior, it should be\n307        mentioned here.\n308        """\n309        return ["readwrite_property"]\n310\n311    @readwrite_property.setter\n312    def readwrite_property(self, value):\n313        value\n314\n315    def example_method(self, param1, param2):\n316        """Class methods are similar to regular functions.\n317\n318        Note\n319        ----\n320        Do not include the `self` parameter in the ``Parameters`` section.\n321\n322        Parameters\n323        ----------\n324        param1\n325            The first parameter.\n326        param2\n327            The second parameter.\n328\n329        Returns\n330        -------\n331        bool\n332            True if successful, False otherwise.\n333\n334        """\n335        return True\n336\n337    def __special__(self):\n338        """By default special members with docstrings are not included.\n339\n340        Special members are any methods or attributes that start with and\n341        end with a double underscore. Any special member with a docstring\n342        will be included in the output, if\n343        ``napoleon_include_special_with_doc`` is set to True.\n344\n345        This behavior can be enabled by changing the following setting in\n346        Sphinx's conf.py::\n347\n348            napoleon_include_special_with_doc = True\n349\n350        """\n351        pass\n352\n353    def __special_without_docstring__(self):\n354        pass\n355\n356    def _private(self):\n357        """By default private members are not included.\n358\n359        Private members are any methods or attributes that start with an\n360        underscore and are *not* special. By default they are not included\n361        in the output.\n362\n363        This behavior can be changed such that private members *are* included\n364        by changing the following setting in Sphinx's conf.py::\n365\n366            napoleon_include_private_with_doc = True\n367\n368        """\n369        pass\n370\n371    def _private_without_docstring(self):\n372        pass\n373\n374\n375def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n376    r"""Summarize the function in one line.\n377\n378    Several sentences providing an extended description. Refer to\n379    variables using back-ticks, e.g. `var`.\n380\n381    Parameters\n382    ----------\n383    var1 : array_like\n384        Array_like means all those objects -- lists, nested lists, etc. --\n385        that can be converted to an array.  We can also refer to\n386        variables like `var1`.\n387    var2 : int\n388        The type above can either refer to an actual Python type\n389        (e.g. ``int``), or describe the type of the variable in more\n390        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n391    *args : iterable\n392        Other arguments.\n393    long_var_name : {'hi', 'ho'}, optional\n394        Choices in brackets, default first when optional.\n395    **kwargs : dict\n396        Keyword arguments.\n397\n398    Returns\n399    -------\n400    type\n401        Explanation of anonymous return value of type ``type``.\n402    describe : type\n403        Explanation of return value named `describe`.\n404    out : type\n405        Explanation of `out`.\n406    type_without_description\n407\n408    Other Parameters\n409    ----------------\n410    only_seldom_used_keywords : type\n411        Explanation.\n412    common_parameters_listed_above : type\n413        Explanation.\n414\n415    Raises\n416    ------\n417    BadException\n418        Because you shouldn't have done that.\n419\n420    See Also\n421    --------\n422    numpy.array : Relationship (optional).\n423    numpy.ndarray : Relationship (optional), which could be fairly long, in\n424                    which case the line wraps here.\n425    numpy.dot, numpy.linalg.norm, numpy.eye\n426\n427    Notes\n428    -----\n429    Notes about the implementation algorithm (if needed).\n430\n431    This can have multiple paragraphs.\n432\n433    You may include some math:\n434\n435    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n436\n437    And even use a Greek symbol like :math:`\\omega` inline.\n438\n439    References\n440    ----------\n441    Cite the relevant literature, e.g. [1]_.  You may also cite these\n442    references in the notes section above.\n443\n444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n445       expert systems and adaptive co-kriging for environmental habitat\n446       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n447       and neural-network techniques," Computers & Geosciences, vol. 22,\n448       pp. 585-588, 1996.\n449\n450    Examples\n451    --------\n452    These are written in doctest format, and should illustrate how to\n453    use the function.\n454\n455    >>> a = [1, 2, 3]\n456    >>> print([x + 3 for x in a])\n457    [4, 5, 6]\n458    >>> print("a\\nb")\n459    a\n460    b\n461    """\n462    # After closing class docstring, there should be one blank line to\n463    # separate following codes (according to PEP257).\n464    # But for function, method and module, there should be no blank lines\n465    # after closing the docstring.\n466    pass\n467\n468\n469def invalid_format(test):\n470    """\n471    In this example, there is no description for the test argument\n472\n473    Parameters\n474    ----------\n475    param1\n476\n477    """\n478\n479def invalid_format2() -> None:\n480    """\n481    Another example without description, but this time indented.\n482\n483    Returns\n484    -------\n485        Text describing the return value.\n486    """\n487\n488def invalid_format3() -> None:\n489    """\n490    Another example with a multiline text.\n491\n492    Returns\n493    -------\n494        Multiline text\n495        describing the return value.\n496    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
67def function_with_types_in_docstring(param1, param2):\n68    """Example function with types documented in the docstring.\n69\n70    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n71    return types are annotated according to `PEP 484`_, they do not need to be\n72    included in the docstring:\n73\n74    Parameters\n75    ----------\n76    param1 : int\n77        The first parameter.\n78    param2 : str\n79        The second parameter.\n80\n81    Returns\n82    -------\n83    bool\n84        True if successful, False otherwise.\n85\n86    .. _PEP 484:\n87        https://www.python.org/dev/peps/pep-0484/\n88\n89    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str):\nThe second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 93    """Example function with PEP 484 type annotations.\n 94\n 95    The return type must be duplicated in the docstring to comply\n 96    with the NumPy docstring style.\n 97\n 98    Parameters\n 99    ----------\n100    param1\n101        The first parameter.\n102    param2\n103        The second parameter.\n104\n105    Returns\n106    -------\n107    bool\n108        True if successful, False otherwise.\n109\n110    """\n111    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n

The return type must be duplicated in the docstring to comply\nwith the NumPy docstring style.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
114def module_level_function(param1, param2=None, *args, **kwargs):\n115    """This is an example of a module level function.\n116\n117    Function parameters should be documented in the ``Parameters`` section.\n118    The name of each parameter is required. The type and description of each\n119    parameter is optional, but should be included if not obvious.\n120\n121    If *args or **kwargs are accepted,\n122    they should be listed as ``*args`` and ``**kwargs``.\n123\n124    The format for a parameter is::\n125\n126        name : type\n127            description\n128\n129            The description may span multiple lines. Following lines\n130            should be indented to match the first line of the description.\n131            The ": type" is optional.\n132\n133            Multiple paragraphs are supported in parameter\n134            descriptions.\n135\n136    Parameters\n137    ----------\n138    param1 : int\n139        The first parameter.\n140    param2 : :obj:`str`, optional\n141        The second parameter.\n142    *args\n143        Variable length argument list.\n144    **kwargs\n145        Arbitrary keyword arguments.\n146\n147    Returns\n148    -------\n149    bool\n150        True if successful, False otherwise.\n151\n152        The return type is not optional. The ``Returns`` section may span\n153        multiple lines and paragraphs. Following lines should be indented to\n154        match the first line of the description.\n155\n156        The ``Returns`` section supports any reStructuredText formatting,\n157        including literal blocks::\n158\n159            {\n160                'param1': param1,\n161                'param2': param2\n162            }\n163\n164    Raises\n165    ------\n166    AttributeError\n167        The ``Raises`` section is a list of all exceptions\n168        that are relevant to the interface.\n169    ValueError\n170        If `param2` is equal to `param1`.\n171\n172    """\n173    if param1 == param2:\n174        raise ValueError('param1 may not be equal to param2')\n175    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Parameters section.\nThe name of each parameter is required. The type and description of each\nparameter is optional, but should be included if not obvious.

\n\n

If *args or **kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name : type\n    description\n\n    The description may span multiple lines. Following lines\n    should be indented to match the first line of the description.\n    The ": type" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str, optional):\nThe second parameter.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n\n

The return type is not optional. The Returns section may span\nmultiple lines and paragraphs. Following lines should be indented to\nmatch the first line of the description.

\n\n

The Returns section supports any reStructuredText formatting,\nincluding literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n\n
Raises
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
178def example_generator(n):\n179    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n180\n181    Parameters\n182    ----------\n183    n : int\n184        The upper limit of the range to generate, from 0 to `n` - 1.\n185\n186    Yields\n187    ------\n188    int\n189        The next number in the range of 0 to `n` - 1.\n190\n191    Examples\n192    --------\n193    Examples should be written in doctest format, and should illustrate how\n194    to use the function.\n195\n196    >>> print([i for i in example_generator(4)])\n197    [0, 1, 2, 3]\n198\n199    """\n200    for i in range(n):\n201        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Parameters
\n\n
    \n
  • n (int):\nThe upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields
\n\n
    \n
  • int: The next number in the range of 0 to n - 1.
  • \n
\n\n
Examples
\n\n

Examples should be written in doctest format, and should illustrate how\nto use the function.

\n\n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
204class ExampleError(Exception):\n205    """Exceptions are documented in the same way as classes.\n206\n207    The __init__ method may be documented in either the class level\n208    docstring, or as a docstring on the __init__ method itself.\n209\n210    Either form is acceptable, but the two should not be mixed. Choose one\n211    convention to document the __init__ method and be consistent with it.\n212\n213    Note\n214    ----\n215    Do not include the `self` parameter in the ``Parameters`` section.\n216\n217    Parameters\n218    ----------\n219    msg : str\n220        Human readable string describing the exception.\n221    code : :obj:`int`, optional\n222        Numeric error code.\n223\n224    Attributes\n225    ----------\n226    msg : str\n227        Human readable string describing the exception.\n228    code : int\n229        Numeric error code.\n230\n231    """\n232\n233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n236\n237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n239\n240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int, optional):\nNumeric error code.
  • \n
\n\n
Attributes
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int):\nNumeric error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
243class ExampleClass(object):\n244    """The summary line for a class docstring should fit on one line.\n245\n246    If the class has public attributes, they may be documented here\n247    in an ``Attributes`` section and follow the same formatting as a\n248    function's ``Args`` section. Alternatively, attributes may be documented\n249    inline with the attribute's declaration (see __init__ method below).\n250\n251    Properties created with the ``@property`` decorator should be documented\n252    in the property's getter method.\n253\n254    Attributes\n255    ----------\n256    attr1 : str\n257        Description of `attr1`.\n258    attr2 : :obj:`int`, optional\n259        Description of `attr2`.\n260\n261    """\n262\n263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n296\n297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n301\n302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n311\n312    @readwrite_property.setter\n313    def readwrite_property(self, value):\n314        value\n315\n316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n337\n338    def __special__(self):\n339        """By default special members with docstrings are not included.\n340\n341        Special members are any methods or attributes that start with and\n342        end with a double underscore. Any special member with a docstring\n343        will be included in the output, if\n344        ``napoleon_include_special_with_doc`` is set to True.\n345\n346        This behavior can be enabled by changing the following setting in\n347        Sphinx's conf.py::\n348\n349            napoleon_include_special_with_doc = True\n350\n351        """\n352        pass\n353\n354    def __special_without_docstring__(self):\n355        pass\n356\n357    def _private(self):\n358        """By default private members are not included.\n359\n360        Private members are any methods or attributes that start with an\n361        underscore and are *not* special. By default they are not included\n362        in the output.\n363\n364        This behavior can be changed such that private members *are* included\n365        by changing the following setting in Sphinx's conf.py::\n366\n367            napoleon_include_private_with_doc = True\n368\n369        """\n370        pass\n371\n372    def _private_without_docstring(self):\n373        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes
\n\n
    \n
  • attr1 (str):\nDescription of attr1.
  • \n
  • attr2 (int, optional):\nDescription of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1 (str):\nDescription of param1.
  • \n
  • param2 (list of str):\nDescription of param2. Multiple\nlines are supported.
  • \n
  • param3 (int, optional):\nDescription of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n foo(var1, var2, *args, long_var_name='hi', **kwargs):\n\n \n\n
\n \n
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n377    r"""Summarize the function in one line.\n378\n379    Several sentences providing an extended description. Refer to\n380    variables using back-ticks, e.g. `var`.\n381\n382    Parameters\n383    ----------\n384    var1 : array_like\n385        Array_like means all those objects -- lists, nested lists, etc. --\n386        that can be converted to an array.  We can also refer to\n387        variables like `var1`.\n388    var2 : int\n389        The type above can either refer to an actual Python type\n390        (e.g. ``int``), or describe the type of the variable in more\n391        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n392    *args : iterable\n393        Other arguments.\n394    long_var_name : {'hi', 'ho'}, optional\n395        Choices in brackets, default first when optional.\n396    **kwargs : dict\n397        Keyword arguments.\n398\n399    Returns\n400    -------\n401    type\n402        Explanation of anonymous return value of type ``type``.\n403    describe : type\n404        Explanation of return value named `describe`.\n405    out : type\n406        Explanation of `out`.\n407    type_without_description\n408\n409    Other Parameters\n410    ----------------\n411    only_seldom_used_keywords : type\n412        Explanation.\n413    common_parameters_listed_above : type\n414        Explanation.\n415\n416    Raises\n417    ------\n418    BadException\n419        Because you shouldn't have done that.\n420\n421    See Also\n422    --------\n423    numpy.array : Relationship (optional).\n424    numpy.ndarray : Relationship (optional), which could be fairly long, in\n425                    which case the line wraps here.\n426    numpy.dot, numpy.linalg.norm, numpy.eye\n427\n428    Notes\n429    -----\n430    Notes about the implementation algorithm (if needed).\n431\n432    This can have multiple paragraphs.\n433\n434    You may include some math:\n435\n436    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n437\n438    And even use a Greek symbol like :math:`\\omega` inline.\n439\n440    References\n441    ----------\n442    Cite the relevant literature, e.g. [1]_.  You may also cite these\n443    references in the notes section above.\n444\n445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n446       expert systems and adaptive co-kriging for environmental habitat\n447       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n448       and neural-network techniques," Computers & Geosciences, vol. 22,\n449       pp. 585-588, 1996.\n450\n451    Examples\n452    --------\n453    These are written in doctest format, and should illustrate how to\n454    use the function.\n455\n456    >>> a = [1, 2, 3]\n457    >>> print([x + 3 for x in a])\n458    [4, 5, 6]\n459    >>> print("a\\nb")\n460    a\n461    b\n462    """\n463    # After closing class docstring, there should be one blank line to\n464    # separate following codes (according to PEP257).\n465    # But for function, method and module, there should be no blank lines\n466    # after closing the docstring.\n467    pass\n
\n\n\n

Summarize the function in one line.

\n\n

Several sentences providing an extended description. Refer to\nvariables using back-ticks, e.g. var.

\n\n
Parameters
\n\n
    \n
  • var1 (array_like):\nArray_like means all those objects -- lists, nested lists, etc. --\nthat can be converted to an array. We can also refer to\nvariables like var1.
  • \n
  • var2 (int):\nThe type above can either refer to an actual Python type\n(e.g. int), or describe the type of the variable in more\ndetail, e.g. (N,) ndarray or array_like.
  • \n
  • *args (iterable):\nOther arguments.
  • \n
  • long_var_name ({\'hi\', \'ho\'}, optional):\nChoices in brackets, default first when optional.
  • \n
  • **kwargs (dict):\nKeyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • type: Explanation of anonymous return value of type type.
  • \n
  • describe (type):\nExplanation of return value named describe.
  • \n
  • out (type):\nExplanation of out.
  • \n
  • type_without_description
  • \n
\n\n
Other Parameters
\n\n
    \n
  • only_seldom_used_keywords (type):\nExplanation.
  • \n
  • common_parameters_listed_above (type):\nExplanation.
  • \n
\n\n
Raises
\n\n
    \n
  • BadException: Because you shouldn\'t have done that.
  • \n
\n\n
See Also
\n\n

numpy.array: Relationship (optional).
\nnumpy.ndarray: Relationship (optional), which could be fairly long, in\nwhich case the line wraps here.
\nnumpy.dot,, numpy.linalg.norm,, numpy.eye

\n\n
Notes
\n\n

Notes about the implementation algorithm (if needed).

\n\n

This can have multiple paragraphs.

\n\n

You may include some math:

\n\n

$$X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}$$

\n\n

And even use a Greek symbol like \\( \\omega \\) inline.

\n\n
References
\n\n

Cite the relevant literature, e.g. 1. You may also cite these\nreferences in the notes section above.

\n\n
Examples
\n\n

These are written in doctest format, and should illustrate how to\nuse the function.

\n\n
\n
>>> a = [1, 2, 3]\n>>> print([x + 3 for x in a])\n[4, 5, 6]\n>>> print("a\\nb")\na\nb\n
\n
\n\n
\n
\n
    \n
  1. \n

    O. McNoleg, "The integration of GIS, remote sensing,\nexpert systems and adaptive co-kriging for environmental habitat\nmodelling of the Highland Haggis using object-oriented, fuzzy-logic\nand neural-network techniques," Computers & Geosciences, vol. 22,\npp. 585-588, 1996. 

    \n
  2. \n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
470def invalid_format(test):\n471    """\n472    In this example, there is no description for the test argument\n473\n474    Parameters\n475    ----------\n476    param1\n477\n478    """\n
\n\n\n

In this example, there is no description for the test argument

\n\n
Parameters
\n\n
    \n
  • param1
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format2() -> None:\n\n \n\n
\n \n
480def invalid_format2() -> None:\n481    """\n482    Another example without description, but this time indented.\n483\n484    Returns\n485    -------\n486        Text describing the return value.\n487    """\n
\n\n\n

Another example without description, but this time indented.

\n\n
Returns
\n\n
    \n
  • Text describing the return value.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format3() -> None:\n\n \n\n
\n \n
489def invalid_format3() -> None:\n490    """\n491    Another example with a multiline text.\n492\n493    Returns\n494    -------\n495        Multiline text\n496        describing the return value.\n497    """\n
\n\n\n

Another example with a multiline text.

\n\n
Returns
\n\n
    \n
  • Multiline text
  • \n
  • describing the return value.
  • \n
\n
\n\n\n
\n
\n\n' == '\n\n\n \n \n \n flavors_numpy API documentation\n\n \n \n \n \n \n \n\n \n
\n
\n

\nflavors_numpy

\n\n

Example NumPy-style docstrings.

\n\n

This module demonstrates documentation as specified by the NumPy\nDocumentation HOWTO. Docstrings may extend over multiple lines. Sections\nare created with a section header followed by an underline of equal length.

\n\n
Example
\n\n

Examples can be given using either the Example or Examples\nsections. Sections support any reStructuredText formatting, including\nliteral blocks::

\n\n
$ python example_numpy.py\n
\n\n

Section breaks are created with two blank lines. Section breaks are also\nimplicitly created anytime a new section starts. Section bodies may be\nindented:

\n\n
Notes
\n\n

This is an example of an indented section. It\'s like any other section,\nbut the body is indented to help it stand out from surrounding text.\nIf a section is indented, then a section break is created by\nresuming unindented text.

\n\n
Attributes
\n\n
    \n
  • module_level_variable1 (int):\nModule level variables may be documented in either the Attributes\nsection of the module docstring, or in an inline docstring immediately\nfollowing the variable.

    \n\n

    Either form is acceptable, but the two should not be mixed. Choose\none convention to document module level variables and be consistent\nwith it.

  • \n
\n
\n\n \n\n \n\n
  1# Examples taken from:\n  2#\n  3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html\n  4#   License: BSD-3\n  5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py\n  6#   License: BSD-2\n  7#\n  8# flake8: noqa\n  9# fmt: off\n 10"""Example NumPy-style docstrings.\n 11\n 12This module demonstrates documentation as specified by the `NumPy\n 13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections\n 14are created with a section header followed by an underline of equal length.\n 15\n 16Example\n 17-------\n 18Examples can be given using either the ``Example`` or ``Examples``\n 19sections. Sections support any reStructuredText formatting, including\n 20literal blocks::\n 21\n 22    $ python example_numpy.py\n 23\n 24\n 25Section breaks are created with two blank lines. Section breaks are also\n 26implicitly created anytime a new section starts. Section bodies *may* be\n 27indented:\n 28\n 29Notes\n 30-----\n 31    This is an example of an indented section. It's like any other section,\n 32    but the body is indented to help it stand out from surrounding text.\n 33\n 34If a section is indented, then a section break is created by\n 35resuming unindented text.\n 36\n 37Attributes\n 38----------\n 39module_level_variable1 : int\n 40    Module level variables may be documented in either the ``Attributes``\n 41    section of the module docstring, or in an inline docstring immediately\n 42    following the variable.\n 43\n 44    Either form is acceptable, but the two should not be mixed. Choose\n 45    one convention to document module level variables and be consistent\n 46    with it.\n 47\n 48\n 49.. _NumPy Documentation HOWTO:\n 50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt\n 51\n 52"""\n 53__docformat__ = "numpy"\n 54\n 55\n 56module_level_variable1 = 12345\n 57\n 58module_level_variable2 = 98765\n 59"""int: Module level variable documented inline.\n 60\n 61The docstring may span multiple lines. The type may optionally be specified\n 62on the first line, separated by a colon.\n 63"""\n 64\n 65\n 66def function_with_types_in_docstring(param1, param2):\n 67    """Example function with types documented in the docstring.\n 68\n 69    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n 70    return types are annotated according to `PEP 484`_, they do not need to be\n 71    included in the docstring:\n 72\n 73    Parameters\n 74    ----------\n 75    param1 : int\n 76        The first parameter.\n 77    param2 : str\n 78        The second parameter.\n 79\n 80    Returns\n 81    -------\n 82    bool\n 83        True if successful, False otherwise.\n 84\n 85    .. _PEP 484:\n 86        https://www.python.org/dev/peps/pep-0484/\n 87\n 88    """\n 89\n 90\n 91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 92    """Example function with PEP 484 type annotations.\n 93\n 94    The return type must be duplicated in the docstring to comply\n 95    with the NumPy docstring style.\n 96\n 97    Parameters\n 98    ----------\n 99    param1\n100        The first parameter.\n101    param2\n102        The second parameter.\n103\n104    Returns\n105    -------\n106    bool\n107        True if successful, False otherwise.\n108\n109    """\n110    raise NotImplementedError\n111\n112\n113def module_level_function(param1, param2=None, *args, **kwargs):\n114    """This is an example of a module level function.\n115\n116    Function parameters should be documented in the ``Parameters`` section.\n117    The name of each parameter is required. The type and description of each\n118    parameter is optional, but should be included if not obvious.\n119\n120    If *args or **kwargs are accepted,\n121    they should be listed as ``*args`` and ``**kwargs``.\n122\n123    The format for a parameter is::\n124\n125        name : type\n126            description\n127\n128            The description may span multiple lines. Following lines\n129            should be indented to match the first line of the description.\n130            The ": type" is optional.\n131\n132            Multiple paragraphs are supported in parameter\n133            descriptions.\n134\n135    Parameters\n136    ----------\n137    param1 : int\n138        The first parameter.\n139    param2 : :obj:`str`, optional\n140        The second parameter.\n141    *args\n142        Variable length argument list.\n143    **kwargs\n144        Arbitrary keyword arguments.\n145\n146    Returns\n147    -------\n148    bool\n149        True if successful, False otherwise.\n150\n151        The return type is not optional. The ``Returns`` section may span\n152        multiple lines and paragraphs. Following lines should be indented to\n153        match the first line of the description.\n154\n155        The ``Returns`` section supports any reStructuredText formatting,\n156        including literal blocks::\n157\n158            {\n159                'param1': param1,\n160                'param2': param2\n161            }\n162\n163    Raises\n164    ------\n165    AttributeError\n166        The ``Raises`` section is a list of all exceptions\n167        that are relevant to the interface.\n168    ValueError\n169        If `param2` is equal to `param1`.\n170\n171    """\n172    if param1 == param2:\n173        raise ValueError('param1 may not be equal to param2')\n174    return True\n175\n176\n177def example_generator(n):\n178    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n179\n180    Parameters\n181    ----------\n182    n : int\n183        The upper limit of the range to generate, from 0 to `n` - 1.\n184\n185    Yields\n186    ------\n187    int\n188        The next number in the range of 0 to `n` - 1.\n189\n190    Examples\n191    --------\n192    Examples should be written in doctest format, and should illustrate how\n193    to use the function.\n194\n195    >>> print([i for i in example_generator(4)])\n196    [0, 1, 2, 3]\n197\n198    """\n199    for i in range(n):\n200        yield i\n201\n202\n203class ExampleError(Exception):\n204    """Exceptions are documented in the same way as classes.\n205\n206    The __init__ method may be documented in either the class level\n207    docstring, or as a docstring on the __init__ method itself.\n208\n209    Either form is acceptable, but the two should not be mixed. Choose one\n210    convention to document the __init__ method and be consistent with it.\n211\n212    Note\n213    ----\n214    Do not include the `self` parameter in the ``Parameters`` section.\n215\n216    Parameters\n217    ----------\n218    msg : str\n219        Human readable string describing the exception.\n220    code : :obj:`int`, optional\n221        Numeric error code.\n222\n223    Attributes\n224    ----------\n225    msg : str\n226        Human readable string describing the exception.\n227    code : int\n228        Numeric error code.\n229\n230    """\n231\n232    def __init__(self, msg, code):\n233        self.msg = msg\n234        self.code = code\n235\n236    def add_note(self, note: str):\n237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n238\n239    def with_traceback(self, object, /):\n240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n241\n242class ExampleClass(object):\n243    """The summary line for a class docstring should fit on one line.\n244\n245    If the class has public attributes, they may be documented here\n246    in an ``Attributes`` section and follow the same formatting as a\n247    function's ``Args`` section. Alternatively, attributes may be documented\n248    inline with the attribute's declaration (see __init__ method below).\n249\n250    Properties created with the ``@property`` decorator should be documented\n251    in the property's getter method.\n252\n253    Attributes\n254    ----------\n255    attr1 : str\n256        Description of `attr1`.\n257    attr2 : :obj:`int`, optional\n258        Description of `attr2`.\n259\n260    """\n261\n262    def __init__(self, param1, param2, param3):\n263        """Example of docstring on the __init__ method.\n264\n265        The __init__ method may be documented in either the class level\n266        docstring, or as a docstring on the __init__ method itself.\n267\n268        Either form is acceptable, but the two should not be mixed. Choose one\n269        convention to document the __init__ method and be consistent with it.\n270\n271        Note\n272        ----\n273        Do not include the `self` parameter in the ``Parameters`` section.\n274\n275        Parameters\n276        ----------\n277        param1 : str\n278            Description of `param1`.\n279        param2 : :obj:`list` of :obj:`str`\n280            Description of `param2`. Multiple\n281            lines are supported.\n282        param3 : :obj:`int`, optional\n283            Description of `param3`.\n284\n285        """\n286        self.attr1 = param1\n287        self.attr2 = param2\n288        self.attr3 = param3  #: Doc comment *inline* with attribute\n289\n290        #: list of str: Doc comment *before* attribute, with type specified\n291        self.attr4 = ["attr4"]\n292\n293        self.attr5 = None\n294        """str: Docstring *after* attribute, with type specified."""\n295\n296    @property\n297    def readonly_property(self):\n298        """str: Properties should be documented in their getter method."""\n299        return "readonly_property"\n300\n301    @property\n302    def readwrite_property(self):\n303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n304        should only be documented in their getter method.\n305\n306        If the setter method contains notable behavior, it should be\n307        mentioned here.\n308        """\n309        return ["readwrite_property"]\n310\n311    @readwrite_property.setter\n312    def readwrite_property(self, value):\n313        value\n314\n315    def example_method(self, param1, param2):\n316        """Class methods are similar to regular functions.\n317\n318        Note\n319        ----\n320        Do not include the `self` parameter in the ``Parameters`` section.\n321\n322        Parameters\n323        ----------\n324        param1\n325            The first parameter.\n326        param2\n327            The second parameter.\n328\n329        Returns\n330        -------\n331        bool\n332            True if successful, False otherwise.\n333\n334        """\n335        return True\n336\n337    def __special__(self):\n338        """By default special members with docstrings are not included.\n339\n340        Special members are any methods or attributes that start with and\n341        end with a double underscore. Any special member with a docstring\n342        will be included in the output, if\n343        ``napoleon_include_special_with_doc`` is set to True.\n344\n345        This behavior can be enabled by changing the following setting in\n346        Sphinx's conf.py::\n347\n348            napoleon_include_special_with_doc = True\n349\n350        """\n351        pass\n352\n353    def __special_without_docstring__(self):\n354        pass\n355\n356    def _private(self):\n357        """By default private members are not included.\n358\n359        Private members are any methods or attributes that start with an\n360        underscore and are *not* special. By default they are not included\n361        in the output.\n362\n363        This behavior can be changed such that private members *are* included\n364        by changing the following setting in Sphinx's conf.py::\n365\n366            napoleon_include_private_with_doc = True\n367\n368        """\n369        pass\n370\n371    def _private_without_docstring(self):\n372        pass\n373\n374\n375def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n376    r"""Summarize the function in one line.\n377\n378    Several sentences providing an extended description. Refer to\n379    variables using back-ticks, e.g. `var`.\n380\n381    Parameters\n382    ----------\n383    var1 : array_like\n384        Array_like means all those objects -- lists, nested lists, etc. --\n385        that can be converted to an array.  We can also refer to\n386        variables like `var1`.\n387    var2 : int\n388        The type above can either refer to an actual Python type\n389        (e.g. ``int``), or describe the type of the variable in more\n390        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n391    *args : iterable\n392        Other arguments.\n393    long_var_name : {'hi', 'ho'}, optional\n394        Choices in brackets, default first when optional.\n395    **kwargs : dict\n396        Keyword arguments.\n397\n398    Returns\n399    -------\n400    type\n401        Explanation of anonymous return value of type ``type``.\n402    describe : type\n403        Explanation of return value named `describe`.\n404    out : type\n405        Explanation of `out`.\n406    type_without_description\n407\n408    Other Parameters\n409    ----------------\n410    only_seldom_used_keywords : type\n411        Explanation.\n412    common_parameters_listed_above : type\n413        Explanation.\n414\n415    Raises\n416    ------\n417    BadException\n418        Because you shouldn't have done that.\n419\n420    See Also\n421    --------\n422    numpy.array : Relationship (optional).\n423    numpy.ndarray : Relationship (optional), which could be fairly long, in\n424                    which case the line wraps here.\n425    numpy.dot, numpy.linalg.norm, numpy.eye\n426\n427    Notes\n428    -----\n429    Notes about the implementation algorithm (if needed).\n430\n431    This can have multiple paragraphs.\n432\n433    You may include some math:\n434\n435    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n436\n437    And even use a Greek symbol like :math:`\\omega` inline.\n438\n439    References\n440    ----------\n441    Cite the relevant literature, e.g. [1]_.  You may also cite these\n442    references in the notes section above.\n443\n444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n445       expert systems and adaptive co-kriging for environmental habitat\n446       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n447       and neural-network techniques," Computers & Geosciences, vol. 22,\n448       pp. 585-588, 1996.\n449\n450    Examples\n451    --------\n452    These are written in doctest format, and should illustrate how to\n453    use the function.\n454\n455    >>> a = [1, 2, 3]\n456    >>> print([x + 3 for x in a])\n457    [4, 5, 6]\n458    >>> print("a\\nb")\n459    a\n460    b\n461    """\n462    # After closing class docstring, there should be one blank line to\n463    # separate following codes (according to PEP257).\n464    # But for function, method and module, there should be no blank lines\n465    # after closing the docstring.\n466    pass\n467\n468\n469def invalid_format(test):\n470    """\n471    In this example, there is no description for the test argument\n472\n473    Parameters\n474    ----------\n475    param1\n476\n477    """\n478\n479def invalid_format2() -> None:\n480    """\n481    Another example without description, but this time indented.\n482\n483    Returns\n484    -------\n485        Text describing the return value.\n486    """\n487\n488def invalid_format3() -> None:\n489    """\n490    Another example with a multiline text.\n491\n492    Returns\n493    -------\n494        Multiline text\n495        describing the return value.\n496    """\n
\n\n\n
\n
\n
\n module_level_variable1 =\n12345\n\n \n
\n \n \n \n\n
\n
\n
\n module_level_variable2 =\n98765\n\n \n
\n \n \n

int: Module level variable documented inline.

\n\n

The docstring may span multiple lines. The type may optionally be specified\non the first line, separated by a colon.

\n
\n\n\n
\n
\n \n
\n \n def\n function_with_types_in_docstring(param1, param2):\n\n \n\n
\n \n
67def function_with_types_in_docstring(param1, param2):\n68    """Example function with types documented in the docstring.\n69\n70    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n71    return types are annotated according to `PEP 484`_, they do not need to be\n72    included in the docstring:\n73\n74    Parameters\n75    ----------\n76    param1 : int\n77        The first parameter.\n78    param2 : str\n79        The second parameter.\n80\n81    Returns\n82    -------\n83    bool\n84        True if successful, False otherwise.\n85\n86    .. _PEP 484:\n87        https://www.python.org/dev/peps/pep-0484/\n88\n89    """\n
\n\n\n

Example function with types documented in the docstring.

\n\n

PEP 484 type annotations are supported. If attribute, parameter, and\nreturn types are annotated according to PEP 484, they do not need to be\nincluded in the docstring:

\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str):\nThe second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n\n \n\n
\n \n
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:\n 93    """Example function with PEP 484 type annotations.\n 94\n 95    The return type must be duplicated in the docstring to comply\n 96    with the NumPy docstring style.\n 97\n 98    Parameters\n 99    ----------\n100    param1\n101        The first parameter.\n102    param2\n103        The second parameter.\n104\n105    Returns\n106    -------\n107    bool\n108        True if successful, False otherwise.\n109\n110    """\n111    raise NotImplementedError\n
\n\n\n

Example function with PEP 484 type annotations.

\n\n

The return type must be duplicated in the docstring to comply\nwith the NumPy docstring style.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n module_level_function(param1, param2=None, *args, **kwargs):\n\n \n\n
\n \n
114def module_level_function(param1, param2=None, *args, **kwargs):\n115    """This is an example of a module level function.\n116\n117    Function parameters should be documented in the ``Parameters`` section.\n118    The name of each parameter is required. The type and description of each\n119    parameter is optional, but should be included if not obvious.\n120\n121    If *args or **kwargs are accepted,\n122    they should be listed as ``*args`` and ``**kwargs``.\n123\n124    The format for a parameter is::\n125\n126        name : type\n127            description\n128\n129            The description may span multiple lines. Following lines\n130            should be indented to match the first line of the description.\n131            The ": type" is optional.\n132\n133            Multiple paragraphs are supported in parameter\n134            descriptions.\n135\n136    Parameters\n137    ----------\n138    param1 : int\n139        The first parameter.\n140    param2 : :obj:`str`, optional\n141        The second parameter.\n142    *args\n143        Variable length argument list.\n144    **kwargs\n145        Arbitrary keyword arguments.\n146\n147    Returns\n148    -------\n149    bool\n150        True if successful, False otherwise.\n151\n152        The return type is not optional. The ``Returns`` section may span\n153        multiple lines and paragraphs. Following lines should be indented to\n154        match the first line of the description.\n155\n156        The ``Returns`` section supports any reStructuredText formatting,\n157        including literal blocks::\n158\n159            {\n160                'param1': param1,\n161                'param2': param2\n162            }\n163\n164    Raises\n165    ------\n166    AttributeError\n167        The ``Raises`` section is a list of all exceptions\n168        that are relevant to the interface.\n169    ValueError\n170        If `param2` is equal to `param1`.\n171\n172    """\n173    if param1 == param2:\n174        raise ValueError('param1 may not be equal to param2')\n175    return True\n
\n\n\n

This is an example of a module level function.

\n\n

Function parameters should be documented in the Parameters section.\nThe name of each parameter is required. The type and description of each\nparameter is optional, but should be included if not obvious.

\n\n

If args or *kwargs are accepted,\nthey should be listed as *args and **kwargs.

\n\n

The format for a parameter is::

\n\n
name : type\n    description\n\n    The description may span multiple lines. Following lines\n    should be indented to match the first line of the description.\n    The ": type" is optional.\n\n    Multiple paragraphs are supported in parameter\n    descriptions.\n
\n\n
Parameters
\n\n
    \n
  • param1 (int):\nThe first parameter.
  • \n
  • param2 (str, optional):\nThe second parameter.
  • \n
  • *args: Variable length argument list.
  • \n
  • **kwargs: Arbitrary keyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n\n

The return type is not optional. The Returns section may span\nmultiple lines and paragraphs. Following lines should be indented to\nmatch the first line of the description.

\n\n

The Returns section supports any reStructuredText formatting,\nincluding literal blocks::

\n\n
{\n    \'param1\': param1,\n    \'param2\': param2\n}\n
\n\n
Raises
\n\n
    \n
  • AttributeError: The Raises section is a list of all exceptions\nthat are relevant to the interface.
  • \n
  • ValueError: If param2 is equal to param1.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n example_generator(n):\n\n \n\n
\n \n
178def example_generator(n):\n179    """Generators have a ``Yields`` section instead of a ``Returns`` section.\n180\n181    Parameters\n182    ----------\n183    n : int\n184        The upper limit of the range to generate, from 0 to `n` - 1.\n185\n186    Yields\n187    ------\n188    int\n189        The next number in the range of 0 to `n` - 1.\n190\n191    Examples\n192    --------\n193    Examples should be written in doctest format, and should illustrate how\n194    to use the function.\n195\n196    >>> print([i for i in example_generator(4)])\n197    [0, 1, 2, 3]\n198\n199    """\n200    for i in range(n):\n201        yield i\n
\n\n\n

Generators have a Yields section instead of a Returns section.

\n\n
Parameters
\n\n
    \n
  • n (int):\nThe upper limit of the range to generate, from 0 to n - 1.
  • \n
\n\n
Yields
\n\n
    \n
  • int: The next number in the range of 0 to n - 1.
  • \n
\n\n
Examples
\n\n

Examples should be written in doctest format, and should illustrate how\nto use the function.

\n\n
\n
>>> print([i for i in example_generator(4)])\n[0, 1, 2, 3]\n
\n
\n
\n\n\n
\n
\n \n
\n \n class\n ExampleError(builtins.Exception):\n\n \n\n
\n \n
204class ExampleError(Exception):\n205    """Exceptions are documented in the same way as classes.\n206\n207    The __init__ method may be documented in either the class level\n208    docstring, or as a docstring on the __init__ method itself.\n209\n210    Either form is acceptable, but the two should not be mixed. Choose one\n211    convention to document the __init__ method and be consistent with it.\n212\n213    Note\n214    ----\n215    Do not include the `self` parameter in the ``Parameters`` section.\n216\n217    Parameters\n218    ----------\n219    msg : str\n220        Human readable string describing the exception.\n221    code : :obj:`int`, optional\n222        Numeric error code.\n223\n224    Attributes\n225    ----------\n226    msg : str\n227        Human readable string describing the exception.\n228    code : int\n229        Numeric error code.\n230\n231    """\n232\n233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n236\n237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n239\n240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

Exceptions are documented in the same way as classes.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int, optional):\nNumeric error code.
  • \n
\n\n
Attributes
\n\n
    \n
  • msg (str):\nHuman readable string describing the exception.
  • \n
  • code (int):\nNumeric error code.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleError(msg, code)\n\n \n\n
\n \n
233    def __init__(self, msg, code):\n234        self.msg = msg\n235        self.code = code\n
\n\n\n \n\n
\n
\n
\n msg\n\n \n
\n \n \n \n\n
\n
\n
\n code\n\n \n
\n \n \n \n\n
\n
\n \n
\n \n def\n add_note(self, note: str):\n\n \n\n
\n \n
237    def add_note(self, note: str):\n238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""\n
\n\n\n

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n \n
\n \n def\n with_traceback(self, object, /):\n\n \n\n
\n \n
240    def with_traceback(self, object, /):\n241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""\n
\n\n\n

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

\n
\n\n\n
\n
\n
\n \n
\n \n class\n ExampleClass:\n\n \n\n
\n \n
243class ExampleClass(object):\n244    """The summary line for a class docstring should fit on one line.\n245\n246    If the class has public attributes, they may be documented here\n247    in an ``Attributes`` section and follow the same formatting as a\n248    function's ``Args`` section. Alternatively, attributes may be documented\n249    inline with the attribute's declaration (see __init__ method below).\n250\n251    Properties created with the ``@property`` decorator should be documented\n252    in the property's getter method.\n253\n254    Attributes\n255    ----------\n256    attr1 : str\n257        Description of `attr1`.\n258    attr2 : :obj:`int`, optional\n259        Description of `attr2`.\n260\n261    """\n262\n263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n296\n297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n301\n302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n311\n312    @readwrite_property.setter\n313    def readwrite_property(self, value):\n314        value\n315\n316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n337\n338    def __special__(self):\n339        """By default special members with docstrings are not included.\n340\n341        Special members are any methods or attributes that start with and\n342        end with a double underscore. Any special member with a docstring\n343        will be included in the output, if\n344        ``napoleon_include_special_with_doc`` is set to True.\n345\n346        This behavior can be enabled by changing the following setting in\n347        Sphinx's conf.py::\n348\n349            napoleon_include_special_with_doc = True\n350\n351        """\n352        pass\n353\n354    def __special_without_docstring__(self):\n355        pass\n356\n357    def _private(self):\n358        """By default private members are not included.\n359\n360        Private members are any methods or attributes that start with an\n361        underscore and are *not* special. By default they are not included\n362        in the output.\n363\n364        This behavior can be changed such that private members *are* included\n365        by changing the following setting in Sphinx's conf.py::\n366\n367            napoleon_include_private_with_doc = True\n368\n369        """\n370        pass\n371\n372    def _private_without_docstring(self):\n373        pass\n
\n\n\n

The summary line for a class docstring should fit on one line.

\n\n

If the class has public attributes, they may be documented here\nin an Attributes section and follow the same formatting as a\nfunction\'s Args section. Alternatively, attributes may be documented\ninline with the attribute\'s declaration (see __init__ method below).

\n\n

Properties created with the @property decorator should be documented\nin the property\'s getter method.

\n\n
Attributes
\n\n
    \n
  • attr1 (str):\nDescription of attr1.
  • \n
  • attr2 (int, optional):\nDescription of attr2.
  • \n
\n
\n\n\n
\n \n
\n \n ExampleClass(param1, param2, param3)\n\n \n\n
\n \n
263    def __init__(self, param1, param2, param3):\n264        """Example of docstring on the __init__ method.\n265\n266        The __init__ method may be documented in either the class level\n267        docstring, or as a docstring on the __init__ method itself.\n268\n269        Either form is acceptable, but the two should not be mixed. Choose one\n270        convention to document the __init__ method and be consistent with it.\n271\n272        Note\n273        ----\n274        Do not include the `self` parameter in the ``Parameters`` section.\n275\n276        Parameters\n277        ----------\n278        param1 : str\n279            Description of `param1`.\n280        param2 : :obj:`list` of :obj:`str`\n281            Description of `param2`. Multiple\n282            lines are supported.\n283        param3 : :obj:`int`, optional\n284            Description of `param3`.\n285\n286        """\n287        self.attr1 = param1\n288        self.attr2 = param2\n289        self.attr3 = param3  #: Doc comment *inline* with attribute\n290\n291        #: list of str: Doc comment *before* attribute, with type specified\n292        self.attr4 = ["attr4"]\n293\n294        self.attr5 = None\n295        """str: Docstring *after* attribute, with type specified."""\n
\n\n\n

Example of docstring on the __init__ method.

\n\n

The __init__ method may be documented in either the class level\ndocstring, or as a docstring on the __init__ method itself.

\n\n

Either form is acceptable, but the two should not be mixed. Choose one\nconvention to document the __init__ method and be consistent with it.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1 (str):\nDescription of param1.
  • \n
  • param2 (list of str):\nDescription of param2. Multiple\nlines are supported.
  • \n
  • param3 (int, optional):\nDescription of param3.
  • \n
\n
\n\n\n
\n
\n
\n attr1\n\n \n
\n \n \n \n\n
\n
\n
\n attr2\n\n \n
\n \n \n \n\n
\n
\n
\n attr3\n\n \n
\n \n \n \n\n
\n
\n
\n attr4\n\n \n
\n \n \n \n\n
\n
\n
\n attr5\n\n \n
\n \n \n

str: Docstring after attribute, with type specified.

\n
\n\n\n
\n
\n \n
\n readonly_property\n\n \n\n
\n \n
297    @property\n298    def readonly_property(self):\n299        """str: Properties should be documented in their getter method."""\n300        return "readonly_property"\n
\n\n\n

str: Properties should be documented in their getter method.

\n
\n\n\n
\n
\n \n
\n readwrite_property\n\n \n\n
\n \n
302    @property\n303    def readwrite_property(self):\n304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter\n305        should only be documented in their getter method.\n306\n307        If the setter method contains notable behavior, it should be\n308        mentioned here.\n309        """\n310        return ["readwrite_property"]\n
\n\n\n

list of str: Properties with both a getter and setter\nshould only be documented in their getter method.

\n\n

If the setter method contains notable behavior, it should be\nmentioned here.

\n
\n\n\n
\n
\n \n
\n \n def\n example_method(self, param1, param2):\n\n \n\n
\n \n
316    def example_method(self, param1, param2):\n317        """Class methods are similar to regular functions.\n318\n319        Note\n320        ----\n321        Do not include the `self` parameter in the ``Parameters`` section.\n322\n323        Parameters\n324        ----------\n325        param1\n326            The first parameter.\n327        param2\n328            The second parameter.\n329\n330        Returns\n331        -------\n332        bool\n333            True if successful, False otherwise.\n334\n335        """\n336        return True\n
\n\n\n

Class methods are similar to regular functions.

\n\n
Note
\n\n

Do not include the self parameter in the Parameters section.

\n\n
Parameters
\n\n
    \n
  • param1: The first parameter.
  • \n
  • param2: The second parameter.
  • \n
\n\n
Returns
\n\n
    \n
  • bool: True if successful, False otherwise.
  • \n
\n
\n\n\n
\n
\n
\n \n
\n \n def\n foo(var1, var2, *args, long_var_name='hi', **kwargs):\n\n \n\n
\n \n
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):\n377    r"""Summarize the function in one line.\n378\n379    Several sentences providing an extended description. Refer to\n380    variables using back-ticks, e.g. `var`.\n381\n382    Parameters\n383    ----------\n384    var1 : array_like\n385        Array_like means all those objects -- lists, nested lists, etc. --\n386        that can be converted to an array.  We can also refer to\n387        variables like `var1`.\n388    var2 : int\n389        The type above can either refer to an actual Python type\n390        (e.g. ``int``), or describe the type of the variable in more\n391        detail, e.g. ``(N,) ndarray`` or ``array_like``.\n392    *args : iterable\n393        Other arguments.\n394    long_var_name : {'hi', 'ho'}, optional\n395        Choices in brackets, default first when optional.\n396    **kwargs : dict\n397        Keyword arguments.\n398\n399    Returns\n400    -------\n401    type\n402        Explanation of anonymous return value of type ``type``.\n403    describe : type\n404        Explanation of return value named `describe`.\n405    out : type\n406        Explanation of `out`.\n407    type_without_description\n408\n409    Other Parameters\n410    ----------------\n411    only_seldom_used_keywords : type\n412        Explanation.\n413    common_parameters_listed_above : type\n414        Explanation.\n415\n416    Raises\n417    ------\n418    BadException\n419        Because you shouldn't have done that.\n420\n421    See Also\n422    --------\n423    numpy.array : Relationship (optional).\n424    numpy.ndarray : Relationship (optional), which could be fairly long, in\n425                    which case the line wraps here.\n426    numpy.dot, numpy.linalg.norm, numpy.eye\n427\n428    Notes\n429    -----\n430    Notes about the implementation algorithm (if needed).\n431\n432    This can have multiple paragraphs.\n433\n434    You may include some math:\n435\n436    .. math:: X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}\n437\n438    And even use a Greek symbol like :math:`\\omega` inline.\n439\n440    References\n441    ----------\n442    Cite the relevant literature, e.g. [1]_.  You may also cite these\n443    references in the notes section above.\n444\n445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,\n446       expert systems and adaptive co-kriging for environmental habitat\n447       modelling of the Highland Haggis using object-oriented, fuzzy-logic\n448       and neural-network techniques," Computers & Geosciences, vol. 22,\n449       pp. 585-588, 1996.\n450\n451    Examples\n452    --------\n453    These are written in doctest format, and should illustrate how to\n454    use the function.\n455\n456    >>> a = [1, 2, 3]\n457    >>> print([x + 3 for x in a])\n458    [4, 5, 6]\n459    >>> print("a\\nb")\n460    a\n461    b\n462    """\n463    # After closing class docstring, there should be one blank line to\n464    # separate following codes (according to PEP257).\n465    # But for function, method and module, there should be no blank lines\n466    # after closing the docstring.\n467    pass\n
\n\n\n

Summarize the function in one line.

\n\n

Several sentences providing an extended description. Refer to\nvariables using back-ticks, e.g. var.

\n\n
Parameters
\n\n
    \n
  • var1 (array_like):\nArray_like means all those objects -- lists, nested lists, etc. --\nthat can be converted to an array. We can also refer to\nvariables like var1.
  • \n
  • var2 (int):\nThe type above can either refer to an actual Python type\n(e.g. int), or describe the type of the variable in more\ndetail, e.g. (N,) ndarray or array_like.
  • \n
  • *args (iterable):\nOther arguments.
  • \n
  • long_var_name ({\'hi\', \'ho\'}, optional):\nChoices in brackets, default first when optional.
  • \n
  • **kwargs (dict):\nKeyword arguments.
  • \n
\n\n
Returns
\n\n
    \n
  • type: Explanation of anonymous return value of type type.
  • \n
  • describe (type):\nExplanation of return value named describe.
  • \n
  • out (type):\nExplanation of out.
  • \n
  • type_without_description
  • \n
\n\n
Other Parameters
\n\n
    \n
  • only_seldom_used_keywords (type):\nExplanation.
  • \n
  • common_parameters_listed_above (type):\nExplanation.
  • \n
\n\n
Raises
\n\n
    \n
  • BadException: Because you shouldn\'t have done that.
  • \n
\n\n
See Also
\n\n

numpy.array: Relationship (optional).
\nnumpy.ndarray: Relationship (optional), which could be fairly long, in\nwhich case the line wraps here.
\nnumpy.dot,, numpy.linalg.norm,, numpy.eye

\n\n
Notes
\n\n

Notes about the implementation algorithm (if needed).

\n\n

This can have multiple paragraphs.

\n\n

You may include some math:

\n\n

$$X(e^{j\\omega } ) = x(n)e^{ - j\\omega n}$$

\n\n

And even use a Greek symbol like \\( \\omega \\) inline.

\n\n
References
\n\n

Cite the relevant literature, e.g. 1. You may also cite these\nreferences in the notes section above.

\n\n
Examples
\n\n

These are written in doctest format, and should illustrate how to\nuse the function.

\n\n
\n
>>> a = [1, 2, 3]\n>>> print([x + 3 for x in a])\n[4, 5, 6]\n>>> print("a\\nb")\na\nb\n
\n
\n\n
\n
\n
    \n
  1. \n

    O. McNoleg, "The integration of GIS, remote sensing,\nexpert systems and adaptive co-kriging for environmental habitat\nmodelling of the Highland Haggis using object-oriented, fuzzy-logic\nand neural-network techniques," Computers & Geosciences, vol. 22,\npp. 585-588, 1996. 

    \n
  2. \n
\n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format(test):\n\n \n\n
\n \n
470def invalid_format(test):\n471    """\n472    In this example, there is no description for the test argument\n473\n474    Parameters\n475    ----------\n476    param1\n477\n478    """\n
\n\n\n

In this example, there is no description for the test argument

\n\n
Parameters
\n\n
    \n
  • param1
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format2() -> None:\n\n \n\n
\n \n
480def invalid_format2() -> None:\n481    """\n482    Another example without description, but this time indented.\n483\n484    Returns\n485    -------\n486        Text describing the return value.\n487    """\n
\n\n\n

Another example without description, but this time indented.

\n\n
Returns
\n\n
    \n
  • Text describing the return value.
  • \n
\n
\n\n\n
\n
\n \n
\n \n def\n invalid_format3() -> None:\n\n \n\n
\n \n
489def invalid_format3() -> None:\n490    """\n491    Another example with a multiline text.\n492\n493    Returns\n494    -------\n495        Multiline text\n496        describing the return value.\n497    """\n
\n\n\n

Another example with a multiline text.

\n\n
Returns
\n\n
    \n
  • Multiline text
  • \n
  • describing the return value.
  • \n
\n
\n\n\n
\n
\n\n' flavors_numpy API documentation

flavors_numpy

Example NumPy-style docstrings.

This module demonstrates documentation as specified by the NumPy Documentation HOWTO. Docstrings may extend over multiple lines. Sections are created with a section header followed by an underline of equal length.

Example

Examples can be given using either the Example or Examples sections. Sections support any reStructuredText formatting, including literal blocks::

$ python example_numpy.py
    

Section breaks are created with two blank lines. Section breaks are also implicitly created anytime a new section starts. Section bodies may be indented:

Notes

This is an example of an indented section. It's like any other section, but the body is indented to help it stand out from surrounding text. If a section is indented, then a section break is created by resuming unindented text.

Attributes
  • module_level_variable1 (int): Module level variables may be documented in either the Attributes section of the module docstring, or in an inline docstring immediately following the variable.

    Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it.

  1# Examples taken from:
      2#
      3# - The Napoleon documentation at https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
      4#   License: BSD-3
      5# - https://github.com/numpy/numpydoc/blob/main/doc/example.py
      6#   License: BSD-2
      7#
      8# flake8: noqa
      9# fmt: off
     10"""Example NumPy-style docstrings.
     11
     12This module demonstrates documentation as specified by the `NumPy
     13Documentation HOWTO`_. Docstrings may extend over multiple lines. Sections
     14are created with a section header followed by an underline of equal length.
     15
     16Example
     17-------
     18Examples can be given using either the ``Example`` or ``Examples``
     19sections. Sections support any reStructuredText formatting, including
     20literal blocks::
     21
     22    $ python example_numpy.py
     23
     24
     25Section breaks are created with two blank lines. Section breaks are also
     26implicitly created anytime a new section starts. Section bodies *may* be
     27indented:
     28
     29Notes
     30-----
     31    This is an example of an indented section. It's like any other section,
     32    but the body is indented to help it stand out from surrounding text.
     33
     34If a section is indented, then a section break is created by
     35resuming unindented text.
     36
     37Attributes
     38----------
     39module_level_variable1 : int
     40    Module level variables may be documented in either the ``Attributes``
     41    section of the module docstring, or in an inline docstring immediately
     42    following the variable.
     43
     44    Either form is acceptable, but the two should not be mixed. Choose
     45    one convention to document module level variables and be consistent
     46    with it.
     47
     48
     49.. _NumPy Documentation HOWTO:
     50   https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
     51
     52"""
     53__docformat__ = "numpy"
     54
     55
     56module_level_variable1 = 12345
     57
     58module_level_variable2 = 98765
     59"""int: Module level variable documented inline.
     60
     61The docstring may span multiple lines. The type may optionally be specified
     62on the first line, separated by a colon.
     63"""
     64
     65
     66def function_with_types_in_docstring(param1, param2):
     67    """Example function with types documented in the docstring.
     68
     69    `PEP 484`_ type annotations are supported. If attribute, parameter, and
     70    return types are annotated according to `PEP 484`_, they do not need to be
     71    included in the docstring:
     72
     73    Parameters
     74    ----------
     75    param1 : int
     76        The first parameter.
     77    param2 : str
     78        The second parameter.
     79
     80    Returns
     81    -------
     82    bool
     83        True if successful, False otherwise.
     84
     85    .. _PEP 484:
     86        https://www.python.org/dev/peps/pep-0484/
     87
     88    """
     89
     90
     91def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
     92    """Example function with PEP 484 type annotations.
     93
     94    The return type must be duplicated in the docstring to comply
     95    with the NumPy docstring style.
     96
     97    Parameters
     98    ----------
     99    param1
    100        The first parameter.
    101    param2
    102        The second parameter.
    103
    104    Returns
    105    -------
    106    bool
    107        True if successful, False otherwise.
    108
    109    """
    110    raise NotImplementedError
    111
    112
    113def module_level_function(param1, param2=None, *args, **kwargs):
    114    """This is an example of a module level function.
    115
    116    Function parameters should be documented in the ``Parameters`` section.
    117    The name of each parameter is required. The type and description of each
    118    parameter is optional, but should be included if not obvious.
    119
    120    If *args or **kwargs are accepted,
    121    they should be listed as ``*args`` and ``**kwargs``.
    122
    123    The format for a parameter is::
    124
    125        name : type
    126            description
    127
    128            The description may span multiple lines. Following lines
    129            should be indented to match the first line of the description.
    130            The ": type" is optional.
    131
    132            Multiple paragraphs are supported in parameter
    133            descriptions.
    134
    135    Parameters
    136    ----------
    137    param1 : int
    138        The first parameter.
    139    param2 : :obj:`str`, optional
    140        The second parameter.
    141    *args
    142        Variable length argument list.
    143    **kwargs
    144        Arbitrary keyword arguments.
    145
    146    Returns
    147    -------
    148    bool
    149        True if successful, False otherwise.
    150
    151        The return type is not optional. The ``Returns`` section may span
    152        multiple lines and paragraphs. Following lines should be indented to
    153        match the first line of the description.
    154
    155        The ``Returns`` section supports any reStructuredText formatting,
    156        including literal blocks::
    157
    158            {
    159                'param1': param1,
    160                'param2': param2
    161            }
    162
    163    Raises
    164    ------
    165    AttributeError
    166        The ``Raises`` section is a list of all exceptions
    167        that are relevant to the interface.
    168    ValueError
    169        If `param2` is equal to `param1`.
    170
    171    """
    172    if param1 == param2:
    173        raise ValueError('param1 may not be equal to param2')
    174    return True
    175
    176
    177def example_generator(n):
    178    """Generators have a ``Yields`` section instead of a ``Returns`` section.
    179
    180    Parameters
    181    ----------
    182    n : int
    183        The upper limit of the range to generate, from 0 to `n` - 1.
    184
    185    Yields
    186    ------
    187    int
    188        The next number in the range of 0 to `n` - 1.
    189
    190    Examples
    191    --------
    192    Examples should be written in doctest format, and should illustrate how
    193    to use the function.
    194
    195    >>> print([i for i in example_generator(4)])
    196    [0, 1, 2, 3]
    197
    198    """
    199    for i in range(n):
    200        yield i
    201
    202
    203class ExampleError(Exception):
    204    """Exceptions are documented in the same way as classes.
    205
    206    The __init__ method may be documented in either the class level
    207    docstring, or as a docstring on the __init__ method itself.
    208
    209    Either form is acceptable, but the two should not be mixed. Choose one
    210    convention to document the __init__ method and be consistent with it.
    211
    212    Note
    213    ----
    214    Do not include the `self` parameter in the ``Parameters`` section.
    215
    216    Parameters
    217    ----------
    218    msg : str
    219        Human readable string describing the exception.
    220    code : :obj:`int`, optional
    221        Numeric error code.
    222
    223    Attributes
    224    ----------
    225    msg : str
    226        Human readable string describing the exception.
    227    code : int
    228        Numeric error code.
    229
    230    """
    231
    232    def __init__(self, msg, code):
    233        self.msg = msg
    234        self.code = code
    235
    236    def add_note(self, note: str):
    237        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    238
    239    def with_traceback(self, object, /):
    240        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    241
    242class ExampleClass(object):
    243    """The summary line for a class docstring should fit on one line.
    244
    245    If the class has public attributes, they may be documented here
    246    in an ``Attributes`` section and follow the same formatting as a
    247    function's ``Args`` section. Alternatively, attributes may be documented
    248    inline with the attribute's declaration (see __init__ method below).
    249
    250    Properties created with the ``@property`` decorator should be documented
    251    in the property's getter method.
    252
    253    Attributes
    254    ----------
    255    attr1 : str
    256        Description of `attr1`.
    257    attr2 : :obj:`int`, optional
    258        Description of `attr2`.
    259
    260    """
    261
    262    def __init__(self, param1, param2, param3):
    263        """Example of docstring on the __init__ method.
    264
    265        The __init__ method may be documented in either the class level
    266        docstring, or as a docstring on the __init__ method itself.
    267
    268        Either form is acceptable, but the two should not be mixed. Choose one
    269        convention to document the __init__ method and be consistent with it.
    270
    271        Note
    272        ----
    273        Do not include the `self` parameter in the ``Parameters`` section.
    274
    275        Parameters
    276        ----------
    277        param1 : str
    278            Description of `param1`.
    279        param2 : :obj:`list` of :obj:`str`
    280            Description of `param2`. Multiple
    281            lines are supported.
    282        param3 : :obj:`int`, optional
    283            Description of `param3`.
    284
    285        """
    286        self.attr1 = param1
    287        self.attr2 = param2
    288        self.attr3 = param3  #: Doc comment *inline* with attribute
    289
    290        #: list of str: Doc comment *before* attribute, with type specified
    291        self.attr4 = ["attr4"]
    292
    293        self.attr5 = None
    294        """str: Docstring *after* attribute, with type specified."""
    295
    296    @property
    297    def readonly_property(self):
    298        """str: Properties should be documented in their getter method."""
    299        return "readonly_property"
    300
    301    @property
    302    def readwrite_property(self):
    303        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    304        should only be documented in their getter method.
    305
    306        If the setter method contains notable behavior, it should be
    307        mentioned here.
    308        """
    309        return ["readwrite_property"]
    310
    311    @readwrite_property.setter
    312    def readwrite_property(self, value):
    313        value
    314
    315    def example_method(self, param1, param2):
    316        """Class methods are similar to regular functions.
    317
    318        Note
    319        ----
    320        Do not include the `self` parameter in the ``Parameters`` section.
    321
    322        Parameters
    323        ----------
    324        param1
    325            The first parameter.
    326        param2
    327            The second parameter.
    328
    329        Returns
    330        -------
    331        bool
    332            True if successful, False otherwise.
    333
    334        """
    335        return True
    336
    337    def __special__(self):
    338        """By default special members with docstrings are not included.
    339
    340        Special members are any methods or attributes that start with and
    341        end with a double underscore. Any special member with a docstring
    342        will be included in the output, if
    343        ``napoleon_include_special_with_doc`` is set to True.
    344
    345        This behavior can be enabled by changing the following setting in
    346        Sphinx's conf.py::
    347
    348            napoleon_include_special_with_doc = True
    349
    350        """
    351        pass
    352
    353    def __special_without_docstring__(self):
    354        pass
    355
    356    def _private(self):
    357        """By default private members are not included.
    358
    359        Private members are any methods or attributes that start with an
    360        underscore and are *not* special. By default they are not included
    361        in the output.
    362
    363        This behavior can be changed such that private members *are* included
    364        by changing the following setting in Sphinx's conf.py::
    365
    366            napoleon_include_private_with_doc = True
    367
    368        """
    369        pass
    370
    371    def _private_without_docstring(self):
    372        pass
    373
    374
    375def foo(var1, var2, *args, long_var_name='hi', **kwargs):
    376    r"""Summarize the function in one line.
    377
    378    Several sentences providing an extended description. Refer to
    379    variables using back-ticks, e.g. `var`.
    380
    381    Parameters
    382    ----------
    383    var1 : array_like
    384        Array_like means all those objects -- lists, nested lists, etc. --
    385        that can be converted to an array.  We can also refer to
    386        variables like `var1`.
    387    var2 : int
    388        The type above can either refer to an actual Python type
    389        (e.g. ``int``), or describe the type of the variable in more
    390        detail, e.g. ``(N,) ndarray`` or ``array_like``.
    391    *args : iterable
    392        Other arguments.
    393    long_var_name : {'hi', 'ho'}, optional
    394        Choices in brackets, default first when optional.
    395    **kwargs : dict
    396        Keyword arguments.
    397
    398    Returns
    399    -------
    400    type
    401        Explanation of anonymous return value of type ``type``.
    402    describe : type
    403        Explanation of return value named `describe`.
    404    out : type
    405        Explanation of `out`.
    406    type_without_description
    407
    408    Other Parameters
    409    ----------------
    410    only_seldom_used_keywords : type
    411        Explanation.
    412    common_parameters_listed_above : type
    413        Explanation.
    414
    415    Raises
    416    ------
    417    BadException
    418        Because you shouldn't have done that.
    419
    420    See Also
    421    --------
    422    numpy.array : Relationship (optional).
    423    numpy.ndarray : Relationship (optional), which could be fairly long, in
    424                    which case the line wraps here.
    425    numpy.dot, numpy.linalg.norm, numpy.eye
    426
    427    Notes
    428    -----
    429    Notes about the implementation algorithm (if needed).
    430
    431    This can have multiple paragraphs.
    432
    433    You may include some math:
    434
    435    .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
    436
    437    And even use a Greek symbol like :math:`\omega` inline.
    438
    439    References
    440    ----------
    441    Cite the relevant literature, e.g. [1]_.  You may also cite these
    442    references in the notes section above.
    443
    444    .. [1] O. McNoleg, "The integration of GIS, remote sensing,
    445       expert systems and adaptive co-kriging for environmental habitat
    446       modelling of the Highland Haggis using object-oriented, fuzzy-logic
    447       and neural-network techniques," Computers & Geosciences, vol. 22,
    448       pp. 585-588, 1996.
    449
    450    Examples
    451    --------
    452    These are written in doctest format, and should illustrate how to
    453    use the function.
    454
    455    >>> a = [1, 2, 3]
    456    >>> print([x + 3 for x in a])
    457    [4, 5, 6]
    458    >>> print("a\nb")
    459    a
    460    b
    461    """
    462    # After closing class docstring, there should be one blank line to
    463    # separate following codes (according to PEP257).
    464    # But for function, method and module, there should be no blank lines
    465    # after closing the docstring.
    466    pass
    467
    468
    469def invalid_format(test):
    470    """
    471    In this example, there is no description for the test argument
    472
    473    Parameters
    474    ----------
    475    param1
    476
    477    """
    478
    479def invalid_format2() -> None:
    480    """
    481    Another example without description, but this time indented.
    482
    483    Returns
    484    -------
    485        Text describing the return value.
    486    """
    487
    488def invalid_format3() -> None:
    489    """
    490    Another example with a multiline text.
    491
    492    Returns
    493    -------
    494        Multiline text
    495        describing the return value.
    496    """
    
module_level_variable1 = 12345
module_level_variable2 = 98765

int: Module level variable documented inline.

The docstring may span multiple lines. The type may optionally be specified on the first line, separated by a colon.

def function_with_types_in_docstring(param1, param2):
67def function_with_types_in_docstring(param1, param2):
    68    """Example function with types documented in the docstring.
    69
    70    `PEP 484`_ type annotations are supported. If attribute, parameter, and
    71    return types are annotated according to `PEP 484`_, they do not need to be
    72    included in the docstring:
    73
    74    Parameters
    75    ----------
    76    param1 : int
    77        The first parameter.
    78    param2 : str
    79        The second parameter.
    80
    81    Returns
    82    -------
    83    bool
    84        True if successful, False otherwise.
    85
    86    .. _PEP 484:
    87        https://www.python.org/dev/peps/pep-0484/
    88
    89    """
    

Example function with types documented in the docstring.

PEP 484 type annotations are supported. If attribute, parameter, and return types are annotated according to PEP 484, they do not need to be included in the docstring:

Parameters
  • param1 (int): The first parameter.
  • param2 (str): The second parameter.
Returns
  • bool: True if successful, False otherwise.
def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
 92def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
     93    """Example function with PEP 484 type annotations.
     94
     95    The return type must be duplicated in the docstring to comply
     96    with the NumPy docstring style.
     97
     98    Parameters
     99    ----------
    100    param1
    101        The first parameter.
    102    param2
    103        The second parameter.
    104
    105    Returns
    106    -------
    107    bool
    108        True if successful, False otherwise.
    109
    110    """
    111    raise NotImplementedError
    

Example function with PEP 484 type annotations.

The return type must be duplicated in the docstring to comply with the NumPy docstring style.

Parameters
  • param1: The first parameter.
  • param2: The second parameter.
Returns
  • bool: True if successful, False otherwise.
def module_level_function(param1, param2=None, *args, **kwargs):
114def module_level_function(param1, param2=None, *args, **kwargs):
    115    """This is an example of a module level function.
    116
    117    Function parameters should be documented in the ``Parameters`` section.
    118    The name of each parameter is required. The type and description of each
    119    parameter is optional, but should be included if not obvious.
    120
    121    If *args or **kwargs are accepted,
    122    they should be listed as ``*args`` and ``**kwargs``.
    123
    124    The format for a parameter is::
    125
    126        name : type
    127            description
    128
    129            The description may span multiple lines. Following lines
    130            should be indented to match the first line of the description.
    131            The ": type" is optional.
    132
    133            Multiple paragraphs are supported in parameter
    134            descriptions.
    135
    136    Parameters
    137    ----------
    138    param1 : int
    139        The first parameter.
    140    param2 : :obj:`str`, optional
    141        The second parameter.
    142    *args
    143        Variable length argument list.
    144    **kwargs
    145        Arbitrary keyword arguments.
    146
    147    Returns
    148    -------
    149    bool
    150        True if successful, False otherwise.
    151
    152        The return type is not optional. The ``Returns`` section may span
    153        multiple lines and paragraphs. Following lines should be indented to
    154        match the first line of the description.
    155
    156        The ``Returns`` section supports any reStructuredText formatting,
    157        including literal blocks::
    158
    159            {
    160                'param1': param1,
    161                'param2': param2
    162            }
    163
    164    Raises
    165    ------
    166    AttributeError
    167        The ``Raises`` section is a list of all exceptions
    168        that are relevant to the interface.
    169    ValueError
    170        If `param2` is equal to `param1`.
    171
    172    """
    173    if param1 == param2:
    174        raise ValueError('param1 may not be equal to param2')
    175    return True
    

This is an example of a module level function.

Function parameters should be documented in the Parameters section. The name of each parameter is required. The type and description of each parameter is optional, but should be included if not obvious.

-

If args or *kwargs are accepted, ? ^^^^ ^^^^^ +

If *args or **kwargs are accepted, ? ^ ^ they should be listed as *args and **kwargs.

The format for a parameter is::

name : type
        description
    
        The description may span multiple lines. Following lines
        should be indented to match the first line of the description.
        The ": type" is optional.
    
        Multiple paragraphs are supported in parameter
        descriptions.
    
Parameters
  • param1 (int): The first parameter.
  • param2 (str, optional): The second parameter.
  • -
  • *args: Variable length argument list.
  • ? - +
  • *args: Variable length argument list.
  • ? + -
  • **kwargs: Arbitrary keyword arguments.
  • ? -- +
  • **kwargs: Arbitrary keyword arguments.
  • ? ++
Returns
  • bool: True if successful, False otherwise.

The return type is not optional. The Returns section may span multiple lines and paragraphs. Following lines should be indented to match the first line of the description.

The Returns section supports any reStructuredText formatting, including literal blocks::

{
        'param1': param1,
        'param2': param2
    }
    
Raises
  • AttributeError: The Raises section is a list of all exceptions that are relevant to the interface.
  • ValueError: If param2 is equal to param1.
def example_generator(n):
178def example_generator(n):
    179    """Generators have a ``Yields`` section instead of a ``Returns`` section.
    180
    181    Parameters
    182    ----------
    183    n : int
    184        The upper limit of the range to generate, from 0 to `n` - 1.
    185
    186    Yields
    187    ------
    188    int
    189        The next number in the range of 0 to `n` - 1.
    190
    191    Examples
    192    --------
    193    Examples should be written in doctest format, and should illustrate how
    194    to use the function.
    195
    196    >>> print([i for i in example_generator(4)])
    197    [0, 1, 2, 3]
    198
    199    """
    200    for i in range(n):
    201        yield i
    

Generators have a Yields section instead of a Returns section.

Parameters
  • n (int): The upper limit of the range to generate, from 0 to n - 1.
Yields
  • int: The next number in the range of 0 to n - 1.
Examples

Examples should be written in doctest format, and should illustrate how to use the function.

>>> print([i for i in example_generator(4)])
    [0, 1, 2, 3]
    
class ExampleError(builtins.Exception):
204class ExampleError(Exception):
    205    """Exceptions are documented in the same way as classes.
    206
    207    The __init__ method may be documented in either the class level
    208    docstring, or as a docstring on the __init__ method itself.
    209
    210    Either form is acceptable, but the two should not be mixed. Choose one
    211    convention to document the __init__ method and be consistent with it.
    212
    213    Note
    214    ----
    215    Do not include the `self` parameter in the ``Parameters`` section.
    216
    217    Parameters
    218    ----------
    219    msg : str
    220        Human readable string describing the exception.
    221    code : :obj:`int`, optional
    222        Numeric error code.
    223
    224    Attributes
    225    ----------
    226    msg : str
    227        Human readable string describing the exception.
    228    code : int
    229        Numeric error code.
    230
    231    """
    232
    233    def __init__(self, msg, code):
    234        self.msg = msg
    235        self.code = code
    236
    237    def add_note(self, note: str):
    238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    239
    240    def with_traceback(self, object, /):
    241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    

Exceptions are documented in the same way as classes.

The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself.

Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it.

Note

Do not include the self parameter in the Parameters section.

Parameters
  • msg (str): Human readable string describing the exception.
  • code (int, optional): Numeric error code.
Attributes
  • msg (str): Human readable string describing the exception.
  • code (int): Numeric error code.
ExampleError(msg, code)
233    def __init__(self, msg, code):
    234        self.msg = msg
    235        self.code = code
    
msg
code
def add_note(self, note: str):
237    def add_note(self, note: str):
    238        """This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""
    

This method is present on Python 3.11+ and manually added here so that snapshots are consistent.

def with_traceback(self, object, /):
240    def with_traceback(self, object, /):
    241        """This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""
    

This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent.

class ExampleClass:
243class ExampleClass(object):
    244    """The summary line for a class docstring should fit on one line.
    245
    246    If the class has public attributes, they may be documented here
    247    in an ``Attributes`` section and follow the same formatting as a
    248    function's ``Args`` section. Alternatively, attributes may be documented
    249    inline with the attribute's declaration (see __init__ method below).
    250
    251    Properties created with the ``@property`` decorator should be documented
    252    in the property's getter method.
    253
    254    Attributes
    255    ----------
    256    attr1 : str
    257        Description of `attr1`.
    258    attr2 : :obj:`int`, optional
    259        Description of `attr2`.
    260
    261    """
    262
    263    def __init__(self, param1, param2, param3):
    264        """Example of docstring on the __init__ method.
    265
    266        The __init__ method may be documented in either the class level
    267        docstring, or as a docstring on the __init__ method itself.
    268
    269        Either form is acceptable, but the two should not be mixed. Choose one
    270        convention to document the __init__ method and be consistent with it.
    271
    272        Note
    273        ----
    274        Do not include the `self` parameter in the ``Parameters`` section.
    275
    276        Parameters
    277        ----------
    278        param1 : str
    279            Description of `param1`.
    280        param2 : :obj:`list` of :obj:`str`
    281            Description of `param2`. Multiple
    282            lines are supported.
    283        param3 : :obj:`int`, optional
    284            Description of `param3`.
    285
    286        """
    287        self.attr1 = param1
    288        self.attr2 = param2
    289        self.attr3 = param3  #: Doc comment *inline* with attribute
    290
    291        #: list of str: Doc comment *before* attribute, with type specified
    292        self.attr4 = ["attr4"]
    293
    294        self.attr5 = None
    295        """str: Docstring *after* attribute, with type specified."""
    296
    297    @property
    298    def readonly_property(self):
    299        """str: Properties should be documented in their getter method."""
    300        return "readonly_property"
    301
    302    @property
    303    def readwrite_property(self):
    304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    305        should only be documented in their getter method.
    306
    307        If the setter method contains notable behavior, it should be
    308        mentioned here.
    309        """
    310        return ["readwrite_property"]
    311
    312    @readwrite_property.setter
    313    def readwrite_property(self, value):
    314        value
    315
    316    def example_method(self, param1, param2):
    317        """Class methods are similar to regular functions.
    318
    319        Note
    320        ----
    321        Do not include the `self` parameter in the ``Parameters`` section.
    322
    323        Parameters
    324        ----------
    325        param1
    326            The first parameter.
    327        param2
    328            The second parameter.
    329
    330        Returns
    331        -------
    332        bool
    333            True if successful, False otherwise.
    334
    335        """
    336        return True
    337
    338    def __special__(self):
    339        """By default special members with docstrings are not included.
    340
    341        Special members are any methods or attributes that start with and
    342        end with a double underscore. Any special member with a docstring
    343        will be included in the output, if
    344        ``napoleon_include_special_with_doc`` is set to True.
    345
    346        This behavior can be enabled by changing the following setting in
    347        Sphinx's conf.py::
    348
    349            napoleon_include_special_with_doc = True
    350
    351        """
    352        pass
    353
    354    def __special_without_docstring__(self):
    355        pass
    356
    357    def _private(self):
    358        """By default private members are not included.
    359
    360        Private members are any methods or attributes that start with an
    361        underscore and are *not* special. By default they are not included
    362        in the output.
    363
    364        This behavior can be changed such that private members *are* included
    365        by changing the following setting in Sphinx's conf.py::
    366
    367            napoleon_include_private_with_doc = True
    368
    369        """
    370        pass
    371
    372    def _private_without_docstring(self):
    373        pass
    

The summary line for a class docstring should fit on one line.

If the class has public attributes, they may be documented here in an Attributes section and follow the same formatting as a function's Args section. Alternatively, attributes may be documented inline with the attribute's declaration (see __init__ method below).

Properties created with the @property decorator should be documented in the property's getter method.

Attributes
  • attr1 (str): Description of attr1.
  • attr2 (int, optional): Description of attr2.
ExampleClass(param1, param2, param3)
263    def __init__(self, param1, param2, param3):
    264        """Example of docstring on the __init__ method.
    265
    266        The __init__ method may be documented in either the class level
    267        docstring, or as a docstring on the __init__ method itself.
    268
    269        Either form is acceptable, but the two should not be mixed. Choose one
    270        convention to document the __init__ method and be consistent with it.
    271
    272        Note
    273        ----
    274        Do not include the `self` parameter in the ``Parameters`` section.
    275
    276        Parameters
    277        ----------
    278        param1 : str
    279            Description of `param1`.
    280        param2 : :obj:`list` of :obj:`str`
    281            Description of `param2`. Multiple
    282            lines are supported.
    283        param3 : :obj:`int`, optional
    284            Description of `param3`.
    285
    286        """
    287        self.attr1 = param1
    288        self.attr2 = param2
    289        self.attr3 = param3  #: Doc comment *inline* with attribute
    290
    291        #: list of str: Doc comment *before* attribute, with type specified
    292        self.attr4 = ["attr4"]
    293
    294        self.attr5 = None
    295        """str: Docstring *after* attribute, with type specified."""
    

Example of docstring on the __init__ method.

The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself.

Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it.

Note

Do not include the self parameter in the Parameters section.

Parameters
  • param1 (str): Description of param1.
  • param2 (list of str): Description of param2. Multiple lines are supported.
  • param3 (int, optional): Description of param3.
attr1
attr2
attr3
attr4
attr5

str: Docstring after attribute, with type specified.

readonly_property
297    @property
    298    def readonly_property(self):
    299        """str: Properties should be documented in their getter method."""
    300        return "readonly_property"
    

str: Properties should be documented in their getter method.

readwrite_property
302    @property
    303    def readwrite_property(self):
    304        """:obj:`list` of :obj:`str`: Properties with both a getter and setter
    305        should only be documented in their getter method.
    306
    307        If the setter method contains notable behavior, it should be
    308        mentioned here.
    309        """
    310        return ["readwrite_property"]
    

list of str: Properties with both a getter and setter should only be documented in their getter method.

If the setter method contains notable behavior, it should be mentioned here.

def example_method(self, param1, param2):
316    def example_method(self, param1, param2):
    317        """Class methods are similar to regular functions.
    318
    319        Note
    320        ----
    321        Do not include the `self` parameter in the ``Parameters`` section.
    322
    323        Parameters
    324        ----------
    325        param1
    326            The first parameter.
    327        param2
    328            The second parameter.
    329
    330        Returns
    331        -------
    332        bool
    333            True if successful, False otherwise.
    334
    335        """
    336        return True
    

Class methods are similar to regular functions.

Note

Do not include the self parameter in the Parameters section.

Parameters
  • param1: The first parameter.
  • param2: The second parameter.
Returns
  • bool: True if successful, False otherwise.
def foo(var1, var2, *args, long_var_name='hi', **kwargs):
376def foo(var1, var2, *args, long_var_name='hi', **kwargs):
    377    r"""Summarize the function in one line.
    378
    379    Several sentences providing an extended description. Refer to
    380    variables using back-ticks, e.g. `var`.
    381
    382    Parameters
    383    ----------
    384    var1 : array_like
    385        Array_like means all those objects -- lists, nested lists, etc. --
    386        that can be converted to an array.  We can also refer to
    387        variables like `var1`.
    388    var2 : int
    389        The type above can either refer to an actual Python type
    390        (e.g. ``int``), or describe the type of the variable in more
    391        detail, e.g. ``(N,) ndarray`` or ``array_like``.
    392    *args : iterable
    393        Other arguments.
    394    long_var_name : {'hi', 'ho'}, optional
    395        Choices in brackets, default first when optional.
    396    **kwargs : dict
    397        Keyword arguments.
    398
    399    Returns
    400    -------
    401    type
    402        Explanation of anonymous return value of type ``type``.
    403    describe : type
    404        Explanation of return value named `describe`.
    405    out : type
    406        Explanation of `out`.
    407    type_without_description
    408
    409    Other Parameters
    410    ----------------
    411    only_seldom_used_keywords : type
    412        Explanation.
    413    common_parameters_listed_above : type
    414        Explanation.
    415
    416    Raises
    417    ------
    418    BadException
    419        Because you shouldn't have done that.
    420
    421    See Also
    422    --------
    423    numpy.array : Relationship (optional).
    424    numpy.ndarray : Relationship (optional), which could be fairly long, in
    425                    which case the line wraps here.
    426    numpy.dot, numpy.linalg.norm, numpy.eye
    427
    428    Notes
    429    -----
    430    Notes about the implementation algorithm (if needed).
    431
    432    This can have multiple paragraphs.
    433
    434    You may include some math:
    435
    436    .. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
    437
    438    And even use a Greek symbol like :math:`\omega` inline.
    439
    440    References
    441    ----------
    442    Cite the relevant literature, e.g. [1]_.  You may also cite these
    443    references in the notes section above.
    444
    445    .. [1] O. McNoleg, "The integration of GIS, remote sensing,
    446       expert systems and adaptive co-kriging for environmental habitat
    447       modelling of the Highland Haggis using object-oriented, fuzzy-logic
    448       and neural-network techniques," Computers & Geosciences, vol. 22,
    449       pp. 585-588, 1996.
    450
    451    Examples
    452    --------
    453    These are written in doctest format, and should illustrate how to
    454    use the function.
    455
    456    >>> a = [1, 2, 3]
    457    >>> print([x + 3 for x in a])
    458    [4, 5, 6]
    459    >>> print("a\nb")
    460    a
    461    b
    462    """
    463    # After closing class docstring, there should be one blank line to
    464    # separate following codes (according to PEP257).
    465    # But for function, method and module, there should be no blank lines
    466    # after closing the docstring.
    467    pass
    

Summarize the function in one line.

Several sentences providing an extended description. Refer to variables using back-ticks, e.g. var.

Parameters
  • var1 (array_like): Array_like means all those objects -- lists, nested lists, etc. -- that can be converted to an array. We can also refer to variables like var1.
  • var2 (int): The type above can either refer to an actual Python type (e.g. int), or describe the type of the variable in more detail, e.g. (N,) ndarray or array_like.
  • -
  • *args (iterable): ? - +
  • *args (iterable): ? + Other arguments.
  • long_var_name ({'hi', 'ho'}, optional): Choices in brackets, default first when optional.
  • -
  • **kwargs (dict): ? -- +
  • **kwargs (dict): ? ++ Keyword arguments.
Returns
  • type: Explanation of anonymous return value of type type.
  • describe (type): Explanation of return value named describe.
  • out (type): Explanation of out.
  • type_without_description
Other Parameters
  • only_seldom_used_keywords (type): Explanation.
  • common_parameters_listed_above (type): Explanation.
Raises
  • BadException: Because you shouldn't have done that.
See Also

numpy.array: Relationship (optional).
numpy.ndarray: Relationship (optional), which could be fairly long, in which case the line wraps here.
numpy.dot,, numpy.linalg.norm,, numpy.eye

Notes

Notes about the implementation algorithm (if needed).

This can have multiple paragraphs.

You may include some math:

$$X(e^{j\omega } ) = x(n)e^{ - j\omega n}$$

And even use a Greek symbol like \( \omega \) inline.

References

Cite the relevant literature, e.g. 1. You may also cite these references in the notes section above.

Examples

These are written in doctest format, and should illustrate how to use the function.

>>> a = [1, 2, 3]
    >>> print([x + 3 for x in a])
    [4, 5, 6]
    >>> print("a\nb")
    a
    b
    

  1. O. McNoleg, "The integration of GIS, remote sensing, expert systems and adaptive co-kriging for environmental habitat modelling of the Highland Haggis using object-oriented, fuzzy-logic and neural-network techniques," Computers & Geosciences, vol. 22, pp. 585-588, 1996. 

def invalid_format(test):
470def invalid_format(test):
    471    """
    472    In this example, there is no description for the test argument
    473
    474    Parameters
    475    ----------
    476    param1
    477
    478    """
    

In this example, there is no description for the test argument

Parameters
  • param1
def invalid_format2() -> None:
480def invalid_format2() -> None:
    481    """
    482    Another example without description, but this time indented.
    483
    484    Returns
    485    -------
    486        Text describing the return value.
    487    """
    

Another example without description, but this time indented.

Returns
  • Text describing the return value.
def invalid_format3() -> None:
489def invalid_format3() -> None:
    490    """
    491    Another example with a multiline text.
    492
    493    Returns
    494    -------
    495        Multiline text
    496        describing the return value.
    497    """
    

Another example with a multiline text.

Returns
  • Multiline text
  • describing the return value.
====== 2 failed, 367 passed, 1 deselected, 1 warning in 523.76s (0:08:43) ====== ==> ERROR: A failure occurred in check().  Aborting... ==> ERROR: Build failed, check /var/lib/archbuild/extra-riscv64/felix-0/build receiving incremental file list pdoc-16.0.0-2-riscv64-build.log pdoc-16.0.0-2-riscv64-check.log sent 62 bytes received 387,071 bytes 258,088.67 bytes/sec total size is 2,730,165 speedup is 7.05