dadadel / pyment

Format and convert Python docstrings and generates patches
GNU General Public License v3.0
905 stars 62 forks source link

Wrong docstring when complex types are used like Callable[...] #134

Open corzani opened 1 year ago

corzani commented 1 year ago

Considering the following demo functions:

def a(first: Callable[[Column], Column]) -> Callable[[str], Column]:
    """

    :param first: Callable[[Column]: 
    :param Column]: 

    """
    pass

def b(
    colName: str,
    startPos: Union[int, "Column"],
    length: Union[int, "Column"] = None,
) -> "Column":
    """

    :param colName: str: 
    :param startPos: Union[int: 
    :param "Column"]:  (Default value = None)
    :param length: Union[int: 

    """
    pass

Shouldn't the function "a" have a single parameter called first with type Callable[[Column], Column] instead of Callable[[Column]:? Same for the second example that contains quotation marks. It seems comma is used without taking in account the parent squared brakets. Both of those examples are using Column from pyspark. Within the pyspark code we have datatypes like Union[int, "Column"]