Use assignments for enums in pillow (#11959)

This commit is contained in:
Ali Hamdan
2024-05-19 12:13:48 +02:00
committed by GitHub
parent d9f47c37b3
commit 08b9c86488
3 changed files with 59 additions and 59 deletions

View File

@@ -218,23 +218,23 @@ class D3DFMT(IntEnum):
A2B10G10R10_XR_BIAS = 119
BINARYBUFFER = 199
UYVY: int
R8G8_B8G8: int
YUY2: int
G8R8_G8B8: int
DXT1: int
DXT2: int
DXT3: int
DXT4: int
DXT5: int
DX10: int
BC4S: int
BC4U: int
BC5S: int
BC5U: int
ATI1: int
ATI2: int
MULTI2_ARGB8: int
UYVY = 1498831189 # i32(b"UYVY")
R8G8_B8G8 = 1195525970 # i32(b"RGBG")
YUY2 = 844715353 # i32(b"YUY2")
G8R8_G8B8 = 1111970375 # i32(b"GRGB")
DXT1 = 827611204 # i32(b"DXT1")
DXT2 = 844388420 # i32(b"DXT2")
DXT3 = 861165636 # i32(b"DXT3")
DXT4 = 877942852 # i32(b"DXT4")
DXT5 = 894720068 # i32(b"DXT5")
DX10 = 808540228 # i32(b"DX10")
BC4S = 1395934018 # i32(b"BC4S")
BC4U = 1429488450 # i32(b"BC4U")
BC5S = 1395999554 # i32(b"BC5S")
BC5U = 1429553986 # i32(b"BC5U")
ATI1 = 826889281 # i32(b"ATI1")
ATI2 = 843666497 # i32(b"ATI2")
MULTI2_ARGB8 = 827606349 # i32(b"MET1")
DDSD_CAPS: Final = 0x1
DDSD_HEIGHT: Final = 0x2

View File

@@ -2,7 +2,7 @@ from _typeshed import Incomplete, SupportsRead, SupportsWrite, Unused
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from enum import IntEnum
from pathlib import Path
from typing import Any, ClassVar, Literal, Protocol, SupportsBytes
from typing import Any, ClassVar, Final, Literal, Protocol, SupportsBytes
from typing_extensions import Self, TypeAlias, TypeGuard
from PIL.PyAccess import PyAccess
@@ -65,13 +65,13 @@ class Transpose(IntEnum):
TRANSVERSE = 6
# All Transpose items
FLIP_LEFT_RIGHT: Literal[0]
FLIP_TOP_BOTTOM: Literal[1]
ROTATE_90: Literal[2]
ROTATE_180: Literal[3]
ROTATE_270: Literal[4]
TRANSPOSE: Literal[5]
TRANSVERSE: Literal[6]
FLIP_LEFT_RIGHT: Final = 0
FLIP_TOP_BOTTOM: Final = 1
ROTATE_90: Final = 2
ROTATE_180: Final = 3
ROTATE_270: Final = 4
TRANSPOSE: Final = 5
TRANSVERSE: Final = 6
class Transform(IntEnum):
AFFINE = 0
@@ -81,11 +81,11 @@ class Transform(IntEnum):
MESH = 4
# All Transform items
AFFINE: Literal[0]
EXTENT: Literal[1]
PERSPECTIVE: Literal[2]
QUAD: Literal[3]
MESH: Literal[4]
AFFINE: Final = 0
EXTENT: Final = 1
PERSPECTIVE: Final = 2
QUAD: Final = 3
MESH: Final = 4
class Resampling(IntEnum):
NEAREST = 0
@@ -96,12 +96,12 @@ class Resampling(IntEnum):
HAMMING = 5
# All Resampling items
NEAREST: Literal[0]
LANCZOS: Literal[1]
BILINEAR: Literal[2]
BICUBIC: Literal[3]
BOX: Literal[4]
HAMMING: Literal[5]
NEAREST: Final = 0
LANCZOS: Final = 1
BILINEAR: Final = 2
BICUBIC: Final = 3
BOX: Final = 4
HAMMING: Final = 5
class Dither(IntEnum):
NONE = 0
@@ -110,18 +110,18 @@ class Dither(IntEnum):
FLOYDSTEINBERG = 3
# All Dither items
NONE: Literal[0]
ORDERED: Literal[1]
RASTERIZE: Literal[2]
FLOYDSTEINBERG: Literal[3]
NONE: Final = 0
ORDERED: Final = 1
RASTERIZE: Final = 2
FLOYDSTEINBERG: Final = 3
class Palette(IntEnum):
WEB = 0
ADAPTIVE = 1
# All Palette items
WEB: Literal[0]
ADAPTIVE: Literal[1]
WEB: Final = 0
ADAPTIVE: Final = 1
class Quantize(IntEnum):
MEDIANCUT = 0
@@ -130,10 +130,10 @@ class Quantize(IntEnum):
LIBIMAGEQUANT = 3
# All Quantize items
MEDIANCUT: Literal[0]
MAXCOVERAGE: Literal[1]
FASTOCTREE: Literal[2]
LIBIMAGEQUANT: Literal[3]
MEDIANCUT: Final = 0
MAXCOVERAGE: Final = 1
FASTOCTREE: Final = 2
LIBIMAGEQUANT: Final = 3
ID: list[str]
OPEN: dict[str, Any]

View File

@@ -1,13 +1,13 @@
def i8(c): ...
def o8(i): ...
def i16le(c, o: int = 0): ...
def si16le(c, o: int = 0): ...
def si16be(c, o: int = 0): ...
def i32le(c, o: int = 0): ...
def si32le(c, o: int = 0): ...
def i16be(c, o: int = 0): ...
def i32be(c, o: int = 0): ...
def o16le(i): ...
def o32le(i): ...
def o16be(i): ...
def o32be(i): ...
def i8(c: bytes) -> int: ...
def o8(i: int) -> bytes: ...
def i16le(c: bytes, o: int = 0) -> int: ...
def si16le(c: bytes, o: int = 0) -> int: ...
def si16be(c: bytes, o: int = 0) -> int: ...
def i32le(c: bytes, o: int = 0) -> int: ...
def si32le(c: bytes, o: int = 0) -> int: ...
def i16be(c: bytes, o: int = 0) -> int: ...
def i32be(c: bytes, o: int = 0) -> int: ...
def o16le(i: int) -> bytes: ...
def o32le(i: int) -> bytes: ...
def o16be(i: int) -> bytes: ...
def o32be(i: int) -> bytes: ...