-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
formatterRelated to the formatterRelated to the formatter
Description
- List of keywords you searched for before creating this issue. Write them down here so that others can find this issue more easily and help provide feedback.
undocumented deviation black return
This is similar to #11791, but for return type annotations rather than variable annotations.
- A minimal code snippet that reproduces the bug.
With preview = True:
Black:
class Polygon:
def cut_section(self, line) -> tuple[
RegularPolygon | Polygon | Triangle | Point | Point2D | Point3D | Segment2D | Segment3D | Segment | None,
RegularPolygon | Polygon | Triangle | Point | Point2D | Point3D | Segment2D | Segment3D | Segment | None,
]: ...Ruff:
class Polygon:
def cut_section(
self, line
) -> tuple[
RegularPolygon | Polygon | Triangle | Point | Point2D | Point3D | Segment2D | Segment3D | Segment | None,
RegularPolygon | Polygon | Triangle | Point | Point2D | Point3D | Segment2D | Segment3D | Segment | None,
]: ...See microsoft/python-type-stubs@9eb6bb5 for a lot more examples
As an added note, with preview = False, I also get the following deviation:
Black:
def get_basis_vectors() -> tuple[
tuple[Literal[1], Literal[0], Literal[0]],
tuple[Literal[0], Literal[1], Literal[0]],
tuple[Literal[0], Literal[0], Literal[1]],
]: ...Ruff:
def get_basis_vectors() -> (
tuple[
tuple[Literal[1], Literal[0], Literal[0]],
tuple[Literal[0], Literal[1], Literal[0]],
tuple[Literal[0], Literal[0], Literal[1]],
]
): ...-
The command you invoked (e.g.,
ruff /path/to/file.py --fix), ideally including the--isolatedflag.
ruff format -
The current Ruff settings (any relevant sections from your
pyproject.toml).
[tool.ruff]
line-length = 130
# Target oldest supported Python version
target-version = "py39"
preview = true- The current Ruff version (
ruff --version).
ruff 0.7.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
formatterRelated to the formatterRelated to the formatter