autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

Issue with quoted type hint (again) this time with quoted hint in return section

Open bastienboutonnet opened this issue 5 years ago • 4 comments
trafficstars

Describe the bug The following situation where you have a quoted type hint for the return leads to args to be skipped and return type is not guessed correctly. It's a pretty funky one!

Versions (please complete the following information):

  • autoDocstring Version: 0.5.3
  • Operating System: OSX Mojave
  • Vscode Version: 1.46.1

Original Code (with line to generate on):

def foo(bar: "int", buzz: int) -> "pd.DataFrame":
    """[summary]

    Returns:
        [type]: [description]
    """
    a = bar + buzz
    return a

Expected Result:

```python
def foo(bar: "int", buzz: int) -> "pd.DataFrame":
    """[summary]

	Args:
		bar (int): [description]
		buzz (int): [description

    Returns:
        pd.DataFrame: [description]
    """
    a = bar + buzz
    return a

**Actual Result:**
```python
def foo(bar: "int", buzz: int) -> "pd.DataFrame":
    """[summary]

    Returns:
        [type]: [description]
    """
    a = bar + buzz
    return a

Stack trace: If an error was reported by autodocstring please copy the stack trace from the autoDocstring output channel.

Additional context Add any other context about the problem here.

bastienboutonnet avatar Jun 24 '20 18:06 bastienboutonnet

Getting exactly the same issue.

  • autoDocstring Version: 0.5.3
  • Operating System: Linux (Ubuntu) x64
  • Vscode Version: 1.47.3

IniasP avatar Aug 12 '20 15:08 IniasP

I have a question about this. I have found that the return type is not specified inside the documentation when using type annotations. I found this in this examples for Google and Numpy styles. This would change the desired output to be:

def foo(bar: "int", buzz: int) -> "pd.DataFrame":
    """[summary]

	 Args:
	    bar: [description]
	    buzz: [description]

         Returns:
             [description]
    """
    a = bar + buzz
    return a

NumberPiOso avatar Oct 16 '20 02:10 NumberPiOso

@NumberPiOso I followed the Google link and I can see returns in docstring when a return hint is present. Which to me looks like what should happen.

Or did I misunderstand your comment?

bastienboutonnet avatar Oct 16 '20 05:10 bastienboutonnet

Which one are you looking at ?

I am looking at this example. image source

NumberPiOso avatar Oct 16 '20 19:10 NumberPiOso