autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

exceptions may occur multiple times

Open GabrielSchoenweiler opened this issue 2 years ago • 1 comments
trafficstars

Description when a certain exception is raised on multiple lines within the function, the exception will occur multiple times in the docstring.

Versions:

  • autoDocstring Version: v0.6.1
  • Operating System: Win 10
  • Vscode Version: 1.73.0

Original Code

def TestFxn(arg0: int, arg1: str) -> str:
        if len(arg1) * arg0 > 1000:
            raise ValueError("bad idea... too many chars")
        if not arg1:
            raise ValueError("empty string")

        return arg1 * arg0

Expected Result:

def TestFxn(arg0: int, arg1: str) -> str:
        """_summary_

        Args:
            arg0 (int): _description_
            arg1 (str): _description_

        Raises:
            ValueError: _description_

        Returns:
            str: _description_
        """

Actual Result:

def TestFxn(arg0: int, arg1: str) -> str:
        """_summary_

        Args:
            arg0 (int): _description_
            arg1 (str): _description_

        Raises:
            ValueError: _description_
            ValueError: _description_

        Returns:
            str: _description_
        """

GabrielSchoenweiler avatar Dec 01 '22 08:12 GabrielSchoenweiler

this could be done with a lambda {{#skipDuplicates}} for example...

GabrielSchoenweiler avatar Dec 01 '22 08:12 GabrielSchoenweiler