Skip to content

Breaking existing numpy docstring. #128

Description

@galyfray

When running pyment on a file with already existing docstrings pyment will try to add again the arguments.

Running pyment on the following file

def add(left: int, right: int) -> int:
    """
    Add two intergers together.
    
    Really high tech !

    Parameters
    ----------
    left : int :
        Left element to add
    right : int :
        right element to add
  
    Returns
    -------

    
    """
    return left + right

will result in this file (the bug still occurs with or without the -w arg):

def add(left: int, right: int) -> int:
    """
    Add two intergers together.
    
    Really high tech ! like woa !

    Parameters
    ----------
    left : int :
        Left element to add
    right : int :
        right element to add
    left: int :
        
    right: int :
        

    Returns
    -------

    
    """
    return left + right

I at first thought that pyment was hard checking for the presence of those two lines, but it does not seem to be the case :

def add(left: int, right: int) -> int:
    """
    Add two intergers together.
    
    Really high tech ! like woa !

    Parameters
    ----------
    left : int :
        Left element to add
    right : int :
        right element to add
    left : int :
        
    right : int :
        
    left: int :
        
    right: int :
        

    Returns
    -------

    
    """
    return left + right

Tested on python 3.10.8, pyment 0.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions