Skip to content

Breaking # pyright: ignore[] used with # type: ignore[] comments on short lines #3399

@Avasam

Description

@Avasam

Describe the style change

When validating a project with both pyright and mypy, it's possible to independently validate both checkers. (since pyright 1.1.282)
However, both expect their ignore comment to be at the start of the line.

Examples in the current Black style

line-lenght=130

class Task(Future[_T_co], Generic[_T_co]):  # type: ignore[type-var]  # pyright: ignore[reportGeneralTypeIssues]
 # [...]
 pass

Desired style

class Task(  # type: ignore[type-var]
    Future[_T_co], Generic[_T_co]  # pyright: ignore[reportGeneralTypeIssues]
):
 # [...]
 pass

Additional context

microsoft/pyright#4243
microsoft/pyright#4259
python/mypy#12358
python/mypy#6948

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: commentsThe syntactic kind. Not in the language grammar, always on our minds. Best bugs.F: linebreakHow should we split up lines?T: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions