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 not respecting max-length flag #2239

Closed
onlinejudge95 opened this issue May 17, 2021 · 1 comment
Closed

black not respecting max-length flag #2239

onlinejudge95 opened this issue May 17, 2021 · 1 comment
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working

Comments

@onlinejudge95
Copy link

Describe the bug
black does not respect the --line-length default of 88 on a with statement

To Reproduce Steps to reproduce the behavior:

  1. Take the following piece of code defined in the following branch
async def send_batch_mail_async(params: List[Dict[str, Union[str, int, dict]]]) -> None:
    """
    Helper method to send batch mails asynchronously.
    This opens a new thread as sending a mail is an I/O bound process
    """
    with current_app._get_current_object().app_context(), mail.get_connection() as connection:
        messages = [
            EmailMessage(
                param["subject"],
                render_template(
                    f"email/{param['template_id']}.txt", **param["template_params"]
                ),
                param["sender"],
                [param["receiver"]],
                connection=connection,
            )
            for param in params
        ]
        connection.send_messages(messages)
  1. Run black with the following arguments black --config config/pyproject.toml .
  2. Config file used is
[tool.black]
verbose = true
target-version = ["py39"]
exclude = "migrations"

Expected behavior
Expectation from black is to be able to format the with statement in constraint to the --line-length config parameter.

Environment (please complete the following information):

  • black version: 21.5b1
  • OS version: ubuntu-20.04
  • Python version: 3.9.4

Does this bug also happen on main?
Yes the same issue persists using the main branch as well.
Link
Screenshot
Screenshot from 2021-05-17 15-38-48

Additional context
Issue is reported in the following GitHub action run https://github.com/unofficialopensource-knit/email_service/pull/40/checks?check_run_id=2599706530

@JelleZijlstra
Copy link
Collaborator

Duplicate of #664.

@ichard26 ichard26 added R: duplicate This issue or pull request already exists T: bug Something isn't working labels May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants