Is there any way to lint a Python file to check for Numpy documentation style adherence? [closed]

旧巷老猫 提交于 2019-12-05 04:42:23

Pylint seems to support that. Take a look at pylint.extensions.docparams.

To sum it up. You activate this checker of pylint by adding

load-plugins=pylint.extensions.docparams

in the Master section of your .pylintrc.

This checker verifies that all function, method, and constructor docstrings include documentation of the

  • parameters and their types

  • return value and its type

  • exceptions raised


Actually pydocstyle (formerly pep257) recently added support for the numpy docstring convention. Although, it's not perfect I think it's the closest to what you want to achieve and it will probably improve in the near future.

pydocstyle --convention=numpy example.py
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!