mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-03 03:13:04 +03:00
Simplified type hints
This commit is contained in:
parent
e39765d755
commit
a655d7606e
|
@ -6,6 +6,7 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -336,25 +337,13 @@ def test_extended_information() -> None:
|
||||||
p = o.profile
|
p = o.profile
|
||||||
|
|
||||||
def assert_truncated_tuple_equal(
|
def assert_truncated_tuple_equal(
|
||||||
tup1: tuple[tuple[float, float, float], ...] | tuple[float],
|
tup1: tuple[Any, ...], tup2: tuple[Any, ...], digits: int = 10
|
||||||
tup2: (
|
|
||||||
tuple[tuple[tuple[float, float, float], ...], ...]
|
|
||||||
| tuple[tuple[float, float, float], ...]
|
|
||||||
| tuple[float]
|
|
||||||
),
|
|
||||||
digits: int = 10,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
# Helper function to reduce precision of tuples of floats
|
# Helper function to reduce precision of tuples of floats
|
||||||
# recursively and then check equality.
|
# recursively and then check equality.
|
||||||
power = 10**digits
|
power = 10**digits
|
||||||
|
|
||||||
def truncate_tuple(
|
def truncate_tuple(tuple_or_float: tuple[Any, ...]) -> tuple[Any, ...]:
|
||||||
tuple_or_float: (
|
|
||||||
tuple[tuple[tuple[float, float, float], ...], ...]
|
|
||||||
| tuple[tuple[float, float, float], ...]
|
|
||||||
| tuple[float, ...]
|
|
||||||
)
|
|
||||||
) -> tuple[tuple[float, ...], ...]:
|
|
||||||
return tuple(
|
return tuple(
|
||||||
(
|
(
|
||||||
truncate_tuple(val)
|
truncate_tuple(val)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user