Enable flake8-pyi's Y037 (#9686)

This commit is contained in:
Alex Waygood
2023-02-07 03:01:02 +00:00
committed by GitHub
parent c4c4bee8aa
commit 0ef9c3f8e8
38 changed files with 119 additions and 201 deletions
+5 -5
View File
@@ -2,7 +2,7 @@ from _typeshed import Incomplete, Self, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from enum import IntEnum
from pathlib import Path
from typing import Any, ClassVar, Protocol, SupportsBytes, Union
from typing import Any, ClassVar, Protocol, SupportsBytes
from typing_extensions import Literal, TypeAlias
from PIL.PyAccess import PyAccess
@@ -22,13 +22,13 @@ _Resample: TypeAlias = Literal[0, 1, 2, 3, 4, 5]
_Size: TypeAlias = tuple[int, int]
_Box: TypeAlias = tuple[int, int, int, int]
_ConversionMatrix: TypeAlias = Union[
tuple[float, float, float, float], tuple[float, float, float, float, float, float, float, float, float, float, float, float]
]
_ConversionMatrix: TypeAlias = (
tuple[float, float, float, float] | tuple[float, float, float, float, float, float, float, float, float, float, float, float]
)
# `str` values are only accepted if mode="RGB" for an `Image` object
# `float` values are only accepted for certain modes such as "F"
# See https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.new
_Color: TypeAlias = Union[int, tuple[int], tuple[int, int, int], tuple[int, int, int, int], str, float, tuple[float]]
_Color: TypeAlias = int | tuple[int] | tuple[int, int, int] | tuple[int, int, int, int] | str | float | tuple[float]
class _Writeable(SupportsWrite[bytes], Protocol):
def seek(self, __offset: int) -> Any: ...
+1 -2
View File
@@ -1,7 +1,6 @@
from typing import Union
from typing_extensions import TypeAlias
_RGB: TypeAlias = Union[tuple[int, int, int], tuple[int, int, int, int]]
_RGB: TypeAlias = tuple[int, int, int] | tuple[int, int, int, int]
_Ink: TypeAlias = str | int | _RGB
_GreyScale: TypeAlias = tuple[int, int]
+2 -2
View File
@@ -1,12 +1,12 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Protocol, Union
from typing import Protocol
from typing_extensions import TypeAlias
from .Image import Image, Resampling, _Resample, _Size
from .ImageColor import _Ink
_Border: TypeAlias = Union[int, tuple[int, int], tuple[int, int, int, int]]
_Border: TypeAlias = int | tuple[int, int] | tuple[int, int, int, int]
class _Deformer(Protocol):
def getmesh(self, image: Image): ...
+2 -2
View File
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Any, NamedTuple, Union
from typing import Any, NamedTuple
from typing_extensions import Literal, TypeAlias
class _TagInfo(NamedTuple):
@@ -37,7 +37,7 @@ DOUBLE: Literal[12]
IFD: Literal[13]
_TagType: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
_TagTuple: TypeAlias = Union[tuple[str, _TagType, int], tuple[str, _TagInfo, int, dict[str, int]]]
_TagTuple: TypeAlias = tuple[str, _TagType, int] | tuple[str, _TagInfo, int, dict[str, int]]
TAGS_V2: dict[int, _TagTuple]
TAGS_V2_GROUPS: dict[int, dict[int, _TagTuple]]