autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

Does not generate docstring with @dataclass decorator

Open Akashdesarda opened this issue 3 years ago • 8 comments

Describe the bug It does not generate correct docstring when defining a class using @dataclass decorator method. It works fine with traditional class initialization. I have even tried with all available formats and nothing works.

Versions (please complete the following information):

  • autoDocstring Version: 0.5.4
  • Operating System: Windows 10 (WSL)
  • Vscode Version: 1.51.1

Original Code (with line to generate on):

@dataclass    
class MyClass:     
# generate on this line          
    para_a: int=1
    para_b: str=None
    para_c: Tuple[int, str]=(1,'a')

Expected Result:

@dataclass    
class MyClass:   
        """[summary]

        Parameters
        ----------
        para_a : int, optional
            [description], by default 1
        para_b : str, optional
            [description], by default 'abc'
        para_c : Tuple[int, str], optional
            [description], by default (1,'a')
        ""
    para_a: int=1
    para_b: str=None
    para_c: Tuple[int, str]=(1,'a')

Actual Result:

@dataclass    
class MyClass:
    """[summary]
    """        
    para_a: int=1
    para_b: str=None
    para_c: Tuple[int, str]=(1,'a')

Akashdesarda avatar Nov 20 '20 07:11 Akashdesarda

This plugin is only writing docstrings for python functions, not classes.

tweakimp avatar Nov 20 '20 13:11 tweakimp

This plugin is only writing docstrings for python functions, not classes.

But it does work with traditional class initialization using def __init__(). I use it all the time.

Akashdesarda avatar Nov 22 '20 17:11 Akashdesarda

I would love to have this feature as well!

mlisovyi avatar Jan 26 '21 17:01 mlisovyi

+1 I would love to have this feature as well!

AsiaCao avatar Oct 27 '21 16:10 AsiaCao

Came here hoping for an answer, but I'd love to see this feature added!

Ritmeester avatar Dec 11 '22 10:12 Ritmeester

Yup, this feature would be great

MorningLightMountain713 avatar Sep 01 '23 20:09 MorningLightMountain713

+1

WallE-Chang avatar Nov 30 '23 03:11 WallE-Chang