Skip to content

Formatter: wrap_multiple_context_managers_in_parens preview style #8889

@MichaReiser

Description

@MichaReiser

Implement Black's wrap_multiple_context_managers_in_parens as a preview style. The new style only applies to Py39+.

with \
     make_context_manager1() as cm1, \
     make_context_manager2() as cm2, \
     make_context_manager3() as cm3, \
     make_context_manager4() as cm4 \
:
    pass

Gets formatted as

with (
    make_context_manager1() as cm1,
    make_context_manager2() as cm2,
    make_context_manager3() as cm3,
    make_context_manager4() as cm4,
):
    pass

Black automatically detects the python version used in a file based on the syntax used. E.g. a file using match statements is Py310+. I'm unsure if we should autodetect the python version based on the syntax or rely on requires-python

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatterpreviewRelated to preview mode features

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions