Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black does not accuse unnecessary spaces in the docstring #1812

Closed
LeonardoFurtado opened this issue Nov 10, 2020 · 2 comments
Closed

Black does not accuse unnecessary spaces in the docstring #1812

LeonardoFurtado opened this issue Nov 10, 2020 · 2 comments
Labels
T: bug Something isn't working

Comments

@LeonardoFurtado
Copy link

Describe the bug Black does not accuse unnecessary spaces in some docstrings

To Reproduce Steps to reproduce the behavior:

  1. Try to use black on a file with this code:
def get_accepted_answers(accepted_answer_ids: List[str]) -> List[str]:
    """      Take an accepted answer id and return the body of it """

    answers_bodies = []
  1. no changes will be made.

Expected behavior docstring should be formatted

  • Version: Stable
  • OS and Python version: [Windows/Python 3.8]

I've try to use https://black.now.sh/?version=master but the result was the same.

In code snippets like this:

def get_answers(query, traceback, off):
    """         This coordinate the answer aquisition process. It goes like this:
    1- Example;
    2.1- Example;
    2.1- Example;
    3- Example;
    """
    ids,accepted = get_questions(query)

The output is:

def get_answers(query, traceback, off):
    """This coordinate the answer aquisition process. It goes like this:
    1- Example;
    2.1- Example;
    2.1- Example;
    3- Example;
    """
    ids, accepted = get_questions(query)

As you can see, the formatting was done and and the spaces have been removed.

@LeonardoFurtado LeonardoFurtado added the T: bug Something isn't working label Nov 10, 2020
@YashVadhadiya
Copy link

Hello @LeonardoFurtado
I get your problem and I'll try to resolve give me some time to know this thing.
I'll get back to you.
Check it once.

@stinos
Copy link

stinos commented Mar 1, 2021

To summarize: I have the impression the problem is that single-line docstrings are treated differently than multi-line ones. Or perhaps that single-line docstrings aren't recognized as docstrings because it seems whatever you do with the text inside it, they remain untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants