autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

How to generate Return value's name and type by using numpy Docstring Formats?

Open wangyexiang opened this issue 2 years ago • 1 comments

Describe the bug Dear all, How to generate Return value's name and type by using numpy Docstring Formats? Currently, It only generates Return value's TYPE.

Versions (please complete the following information):

  • autoDocstring Version: v0.6.1
  • Operating System: Windows_NT x64 10.0.19044
  • Vscode Version: 1.68.0 (user setup)

Original Code:

def add(num1, num2=3):
    results = num1 + num2
    return results, num1

Expected Result:

def add(num1, num2=3):
    '''_summary_

    Parameters
    ----------
    num1 : _type_
        _description_
    num2 : int, optional
        _description_, by default 3

    Returns
    -------
    results : _type_
        _description_
    num1 :  _type_
        _description_
    '''
    results = num1 + num2
    return results, num1

Actual Result:

def add(num1, num2=3):
    '''_summary_

    Parameters
    ----------
    num1 : _type_
        _description_
    num2 : int, optional
        _description_, by default 3

    Returns
    -------
    _type_----------------------->here only Return value's type!
        _description_
    '''
    results = num1 + num2
    return results, num1

I can get the Expected Result in anaconda's spyder IDE by using Generate docstring command(Ctrl+Alt+D), here is the results: image Can I get the same result by using this extention? THANKS.

wangyexiang avatar Jun 13 '22 14:06 wangyexiang

I've had the same issue here, this needs to added in, as the numpy documentation specifies that all values in the return tuple should have a description in the docstring.

eltonnk avatar Sep 20 '22 15:09 eltonnk