mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-28 08:59:57 +03:00
Do not allow coords to be sequence of lists
This commit is contained in:
parent
c7ed097dd1
commit
177629ca5e
|
@ -802,14 +802,10 @@ def test_rectangle_translucent_outline(bbox: Coords) -> None:
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"xy",
|
"xy",
|
||||||
[(10, 20, 190, 180), ([10, 20], [190, 180]), ((10, 20), (190, 180))],
|
[(10, 20, 190, 180), ((10, 20), (190, 180))],
|
||||||
)
|
)
|
||||||
def test_rounded_rectangle(
|
def test_rounded_rectangle(
|
||||||
xy: (
|
xy: tuple[int, int, int, int] | tuple[tuple[int, int], tuple[int, int]],
|
||||||
tuple[int, int, int, int]
|
|
||||||
| tuple[list[int]]
|
|
||||||
| tuple[tuple[int, int], tuple[int, int]]
|
|
||||||
),
|
|
||||||
) -> None:
|
) -> None:
|
||||||
# Arrange
|
# Arrange
|
||||||
im = Image.new("RGB", (200, 200))
|
im = Image.new("RGB", (200, 200))
|
||||||
|
|
|
@ -244,12 +244,12 @@ class ImageDraw:
|
||||||
if ink is not None:
|
if ink is not None:
|
||||||
self.draw.draw_lines(xy, ink, width)
|
self.draw.draw_lines(xy, ink, width)
|
||||||
if joint == "curve" and width > 4:
|
if joint == "curve" and width > 4:
|
||||||
points: Sequence[Sequence[float]]
|
points: Sequence[tuple[float, ...]]
|
||||||
if isinstance(xy[0], (list, tuple)):
|
if isinstance(xy[0], tuple):
|
||||||
points = cast(Sequence[Sequence[float]], xy)
|
points = cast(Sequence[tuple[float, ...]], xy)
|
||||||
else:
|
else:
|
||||||
points = [
|
points = [
|
||||||
cast(Sequence[float], tuple(xy[i : i + 2]))
|
tuple(cast(Sequence[float], xy)[i : i + 2])
|
||||||
for i in range(0, len(xy), 2)
|
for i in range(0, len(xy), 2)
|
||||||
]
|
]
|
||||||
for i in range(1, len(points) - 1):
|
for i in range(1, len(points) - 1):
|
||||||
|
|
|
@ -37,7 +37,7 @@ else:
|
||||||
return bool
|
return bool
|
||||||
|
|
||||||
|
|
||||||
Coords = Union[Sequence[float], Sequence[Sequence[float]]]
|
Coords = Union[Sequence[float], Sequence[tuple[float, ...]]]
|
||||||
|
|
||||||
|
|
||||||
_T_co = TypeVar("_T_co", covariant=True)
|
_T_co = TypeVar("_T_co", covariant=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user