Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support for magic trailing comma #1683

Copy link
Copy link
@Jackenmen

Description

@Jackenmen
Issue body actions

Black auto-explodes imports, collections, function calls, etc. when they contain a trailing comma:
https://github.com/psf/black/blob/master/docs/the_black_code_style.md#the-magic-trailing-comma

This means that even though this would fit into one line:

from seven_dwwarfs import (
    Grumpy,
    Happy,
    Sleepy,
    Bashful,
    Sneezy,
    Dopey,
    Doc,
)

Black will NOT convert it into this:

from seven_dwwarfs import Grumpy, Happy, Sleepy, Bashful, Sneezy, Dopey, Doc

As long as the import list contains a trailing comma.

isort currently does not have the magic trailing comma handling as far as I can tell and will collapse the import list if it can fit within the line length limit.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    blackBlack compatibility issueBlack compatibility issueenhancementNew feature or requestNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.