Skip to content

docformatter weird behaviour #221

@jonyscathe

Description

@jonyscathe

Say I have a file that contains only:

def my_function(
    param1,
    param2,
    param3,
    param_file,
    param4,
) -> None:
    """
    Fit and save the wallet model, including the internal pipeline and the wallet wrapper.

    :param param1: Model data.
    :param param2: Data from build_wallet_features that would actually be used in production.
    :param param3: number of cv splits.
    :param param_file: filename.
    :param param4: hard rule settings.
    """

If I run docformatter over that file with arguments --black --in-place --pre-summary-newline -- wrap-summaries=120 --wrap-descriptions=120 then I get the output:

def my_function(
    param1,
    param2,
    param3,
    param_file,
    param4,
) -> None:
    """
    Fit and save the wallet model, including the internal pipeline and the wallet wrapper.

    :param param1: Model data. :param param2: Data from build_wallet_features that would actually be used in production.
    :param param3: number of cv splits. :param param_
    file:
    :param param1: Model data.
    :param param2: Data from build_wallet_features that would actually be used in production.
    :param param3: number of cv splits.
    :param param_file: filename.
    :param param4: hard rule settings.
    """

So docformatter has kept my 5 lines of parameter descriptions, but added three weird line above that....
The issue seems to be when there is a parameter ending with _file.

This was not an issue in 1.6.5, but is an issue in 1.7.1.

Not too sure how to fix this other than renaming all my variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions