module sphinxext.sphinx_docassert_extension

Inheritance diagram of pyquickhelper.sphinxext.sphinx_docassert_extension

Short summary

module pyquickhelper.sphinxext.sphinx_docassert_extension

Defines a sphinx extension which if all parameters are documented.

source on GitHub

Classes

class

truncated documentation

OverrideDocFieldTransformer

Overrides one function with assigning it to a method

Functions

function

truncated documentation

check_typed_make_field

Overwrites function #L197>`_. `make_field <https://github.com/sphinx-doc/sphinx/blob/master/sphinx/util/docfields.py

setup

setup for docassert

setup_docassert

Setup for docassert extension (sphinx). This changes DocFieldTransformer.transform and replaces it by a …

Methods

method

truncated documentation

__init__

Constructor

override_transform

Transform a single field list node. Overwrite function transform. …

Documentation

Defines a sphinx extension which if all parameters are documented.

source on GitHub

class pyquickhelper.sphinxext.sphinx_docassert_extension.OverrideDocFieldTransformer(replaced)[source]

Bases: object

Overrides one function with assigning it to a method

source on GitHub

Constructor

Parameters:

replaced – should be DocFieldTransformer.transform

source on GitHub

__init__(replaced)[source]

Constructor

Parameters:

replaced – should be DocFieldTransformer.transform

source on GitHub

override_transform(other_self, node)[source]

Transform a single field list node. Overwrite function transform. It only adds extra verification and returns results from the replaced function.

Parameters:
  • other_self – the builder

  • node – node the replaced function changes or replace

The function parses the original function and checks that the list of arguments declared by the function is the same the list of documented arguments.

source on GitHub

pyquickhelper.sphinxext.sphinx_docassert_extension.check_typed_make_field(self, types, domain, items, env=None, parameters=None, function_name=None, docname=None, kind=None)[source]

Overwrites function #L197>`_. `make_field <https://github.com/sphinx-doc/sphinx/blob/master/sphinx/util/docfields.py Processes one argument of a function.

Parameters:
  • self – from original function

  • types – from original function

  • domain – from original function

  • items – from original function

  • env – from original function

  • parameters – list of known arguments for the function or method

  • function_name – function name these arguments belong to

  • docname – document which contains the object

  • kind – tells which kind of object function_name is (function, method or class)

Example of warnings it raises:

[docassert] 'onefunction' has no parameter 'a' (in '...project_name\subproject\myexampleb.py').
[docassert] 'onefunction' has undocumented parameters 'a, b' (...project_name\subproject\myexampleb.py').

source on GitHub

pyquickhelper.sphinxext.sphinx_docassert_extension.setup(app)[source]

setup for docassert

pyquickhelper.sphinxext.sphinx_docassert_extension.setup_docassert(app)[source]

Setup for docassert extension (sphinx). This changes DocFieldTransformer.transform and replaces it by a function which calls the current function and does extra checking on the list of parameters.

Warning

This class does not handle methods if the parameter name for the class is different from self. Classes included in other classes are not properly handled.

source on GitHub