autoDocstring icon indicating copy to clipboard operation
autoDocstring copied to clipboard

Existing heredoc strings in a function will prevent autodocstring generation

Open queglay opened this issue 2 years ago • 0 comments

Describe the bug When a heredoc format string is used anywhere in a function, this disabled the autoDocstring code form attempting to generate a docstring.

Versions (please complete the following information):

  • autoDocstring Version: [0.6.1]
  • Operating System: Windows 10
  • Vscode Version: 1.67.2

Original Code (with line to generate on):

def addFloatParmFunction(sMultiShotSwitchNodePath):
    sNewParmExpr = """
return hou.pwd().hm().evalMultiShotSwitchCustomParm(hou.evaluatingParm().path(), hou.pwd().path())
"""
    # User will set name and label in generic function
    oNewCustomParm = hou.FloatParmTemplate('tempName', 'Temp Label', 1, (0,), min=0, max=1.0,
        join_with_next=True,
        default_expression=([sNewParmExpr]), default_expression_language=([hou.scriptLanguage.Python]),
        help="")
    addParmFunctionGeneric(sMultiShotSwitchNodePath, oNewCustomParm)

Expected Result:

def addFloatParmFunction(sMultiShotSwitchNodePath):
    """Shared function when adding any custom MultiShot Parm.

    Args:
        sMultiShotSwitchNodePath (string): The path to the MultiShot Switch node.
    """
    sNewParmExpr = """
return hou.pwd().hm().evalMultiShotSwitchCustomParm(hou.evaluatingParm().path(), hou.pwd().path())
"""
    # User will set name and label in generic function
    oNewCustomParm = hou.FloatParmTemplate('tempName', 'Temp Label', 1, (0,), min=0, max=1.0,
        join_with_next=True,
        default_expression=([sNewParmExpr]), default_expression_language=([hou.scriptLanguage.Python]),
        help="")
    addParmFunctionGeneric(sMultiShotSwitchNodePath, oNewCustomParm)

Actual Result:

def addFloatParmFunction(sMultiShotSwitchNodePath):
    sNewParmExpr = """
return hou.pwd().hm().evalMultiShotSwitchCustomParm(hou.evaluatingParm().path(), hou.pwd().path())
"""
    # User will set name and label in generic function
    oNewCustomParm = hou.FloatParmTemplate('tempName', 'Temp Label', 1, (0,), min=0, max=1.0,
        join_with_next=True,
        default_expression=([sNewParmExpr]), default_expression_language=([hou.scriptLanguage.Python]),
        help="")
    addParmFunctionGeneric(sMultiShotSwitchNodePath, oNewCustomParm)

queglay avatar Jun 14 '22 06:06 queglay