PyContracts is a Python package that allows to declare constraints on function parameters and return values. Contracts can be specified using Python3 annotations, or inside a docstring. PyContracts supports a basic type system, variables binding, arithmetic constraints, and has several specialized contracts and an extension API.
Sphinx allows types of parameters to be specified in the :param tag without
a separate :type line, such as ":param int a: desc", which results in a more
compact docstring.
This change adds support by extending the docstring parser to parse these lines.
Various test cases are included.
Note: My IDE removed a couple of trailing whitespaces in the edited files.
Sphinx allows types of parameters to be specified in the :param tag without a separate :type line, such as ":param int a: desc", which results in a more compact docstring. This change adds support by extending the docstring parser to parse these lines. Various test cases are included.
Note: My IDE removed a couple of trailing whitespaces in the edited files.