module sphinxext.sphinx_docassert_extension
¶
Short summary¶
module pyquickhelper.sphinxext.sphinx_docassert_extension
Defines a sphinx extension which if all parameters are documented.
Classes¶
class |
truncated documentation |
---|---|
Overrides one function with assigning it to a method |
Functions¶
function |
truncated documentation |
---|---|
Overwrites function #L197>`_. `make_field <https://github.com/sphinx-doc/sphinx/blob/master/sphinx/util/docfields.py … |
|
setup for docassert |
|
Setup for |
Methods¶
method |
truncated documentation |
---|---|
Constructor |
|
Transform a single field list node. Overwrite function transform. … |
Documentation¶
Defines a sphinx extension which if all parameters are documented.
- class pyquickhelper.sphinxext.sphinx_docassert_extension.OverrideDocFieldTransformer(replaced)[source]¶
Bases:
object
Overrides one function with assigning it to a method
Constructor
- Parameters:
replaced – should be DocFieldTransformer.transform
- __init__(replaced)[source]¶
Constructor
- Parameters:
replaced – should be DocFieldTransformer.transform
- 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.
- 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').
- pyquickhelper.sphinxext.sphinx_docassert_extension.setup_docassert(app)[source]¶
Setup for
docassert
extension (sphinx). This changesDocFieldTransformer.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.