AndreaCensi / contracts

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.
http://andreacensi.github.io/contracts/
Other
398 stars 62 forks source link

Support Sphinx inline parameter syntax. #33

Closed denniskempin closed 9 years ago

denniskempin commented 9 years ago

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.

denniskempin commented 9 years ago

Documentation on the Sphinx syntax for parameter types: http://sphinx-doc.org/domains.html#info-field-lists.

AndreaCensi commented 9 years ago

Thanks! I don't have time to review this, but merging in master for the time being.