PyCQA / docformatter

Formats docstrings to follow PEP 257
https://pypi.python.org/pypi/docformatter
MIT License
526 stars 61 forks source link

Invalid removal of black lines for function with only a docstring #173

Closed Sillocan closed 1 year ago

Sillocan commented 1 year ago

Using docformatter==1.6.0, all blank lines are removed after a function with only a single line docstring.

i.e.

"""Here are some examples.

This module docstring should be dedented.
"""

def launch_rocket():
    """Launch the rocket."""

def factorial(x):
    """Return x factorial.

    This uses math.factorial.
    """
    import math
    return math.factorial(x)

is being parsed to

"""Here are some examples.

This module docstring should be dedented.
"""

def launch_rocket():
    """Launch the rocket."""
def factorial(x):
    """Return x factorial.

    This uses math.factorial.
    """
    import math
    return math.factorial(x)

This seems like a regression

hofbi commented 1 year ago

Could be related to https://github.com/PyCQA/docformatter/issues/156

weibullguy commented 1 year ago

@Sillocan tag v1.6.1-rc1 should have the fix you need if you're interested in giving it a try before I officially release v1.6.1.

Sillocan commented 1 year ago

Worked like a charm!

On Wed, Apr 12, 2023, 4:02 PM Doyle Rowland @.***> wrote:

@Sillocan https://github.com/Sillocan tag v1.6.1-rc1 should have the fix you need if you're interested in giving it a try before I officially release v1.6.1.

— Reply to this email directly, view it on GitHub https://github.com/PyCQA/docformatter/issues/173#issuecomment-1506076312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMNNWO6CYSDLFP77KSVUFTXA4YB5ANCNFSM6AAAAAAWTLF6LU . You are receiving this because you were mentioned.Message ID: @.***>