python - Pycharm: Auto generate `:type param:` field in docstring -


when create function parameters, pycharm offers me create docstring :param param_name: field, pretty good. need add :type param_name:.

so :

def foo(bar, xyz):     return bar + xyz 

with generate docstring option have (even insert 'type' , 'rtype' documentation stub enable) :

def foo(bar, xyz):     """       :param bar:     :param xyz:     """     return bar + xyz 

and i that :

def foo(bar, xyz):     """       :param bar:     :type bar:     :param xyz:     :type xyz:     """     return bar + xyz 

per the documentation:

if configured, documentation comment stubs can generated type , rtype tags.

following link:

...

  1. in smart keys page, select check box insert 'type' , 'rtype' documentation comment stub.

once have done this, put cursor in parameter name in definition, activate smart keys feature (alt+enter, default) , select specify type reference in docstring. insert appropriate comment line . can put cursor in function/method name , select specify return type in docstring.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -