mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-26 07:04:45 +03:00
Type annotations: _imaging.pyi: Many improvements.
This commit is contained in:
parent
8db8e3214f
commit
72393d7703
|
@ -1,8 +1,5 @@
|
|||
if False:
|
||||
from PIL.aliases import *
|
||||
|
||||
from typing import Any # temporarily, hopefully ;)
|
||||
from typing import Optional, List, Text
|
||||
from typing import Optional, List, Text, Any
|
||||
|
||||
PILLOW_VERSION = ...
|
||||
DEFAULT_STRATEGY = ...
|
||||
|
@ -22,8 +19,7 @@ def map_buffer(target_data: Any, size: Size, decoder_name: Text,
|
|||
bbox: Optional[Any], offset: int, args: Tuple[Mode, int, int]
|
||||
) -> ImagingCore: ... ### what are data & bbox?
|
||||
|
||||
def crc32(buffer: Any, hilo: Tuple[int, int]=(0,0)) -> Tuple[int, int]: ...
|
||||
### buffer is bytesarray? Should Tuple[int, int] be another named type?
|
||||
def crc32(buffer: bytes, hilo: Tuple[int, int]=(0,0)) -> Tuple[int, int]: ...
|
||||
|
||||
def effect_mandelbrot(size: Size=(512,512),
|
||||
extent: Tuple[float, float, float, float]=(-3,-2.5,2,2.5),
|
||||
|
@ -33,63 +29,56 @@ def linear_gradient(mode: Mode) -> ImagingCore: ...
|
|||
def radial_gradient(mode: Mode) -> ImagingCore: ...
|
||||
def wedge(mode: Mode) -> ImagingCore: ...
|
||||
|
||||
### FIXME TYPING: Should defaults be included here? they could get out of sync with _imaging.c
|
||||
### FIXME TYPING: Unsure of the default values in some cases.
|
||||
|
||||
class ImagingCore:
|
||||
mode = ... # type: str
|
||||
size = ... # type: Size ## close enough?
|
||||
mode = ... # type: Mode
|
||||
size = ... # type: Size
|
||||
bands = ... # type: int
|
||||
id = ... ### use? size_t? int?
|
||||
ptr = ... ###
|
||||
id = ... # type: Any ### FIXME TYPING: Can be more specific?
|
||||
ptr = ... # type: Any ### FIXME TYPING: Can be more specific?
|
||||
|
||||
def getpixel(self, xy: XY) -> Optional[Any]: ...
|
||||
def putpixel(self, xy: XY, value: Any) -> None: ...
|
||||
def getpixel(self, xy: XY) -> Optional[Color]: ...
|
||||
def putpixel(self, xy: XY, value: Any) -> None: ... ### FIXME TYPING: Color?
|
||||
def pixel_access(self, readonly: int) -> Any: ...
|
||||
|
||||
def convert(self, mode: Mode, dither: int=..., paletteimage: Any=...) -> ImagingCore: ... ### what is paletteimage?
|
||||
def convert(self, mode: Mode, dither: int=..., paletteimage: ImagingCore=...) -> ImagingCore: ...
|
||||
def convert2(self, im1: ImagingCore, im2: ImagingCore) -> None: ...
|
||||
def convert_matrix(self, mode: Mode, matrix: Union[Matrix4, Matrix12]) -> ImagingCore: ...
|
||||
def convert_transparent(self, mode: Mode, t: Union[Tuple[int, int, int], int]) -> ImagingCore: ... ### Name t better?
|
||||
def convert_transparent(self, mode: Mode, t: Union[Tuple[int, int, int], int]) -> ImagingCore: ...
|
||||
def copy(self) -> ImagingCore: ...
|
||||
def crop(self, bbox: LURD) -> ImagingCore: ...
|
||||
def expand(self, xmargin: int, ymargin: int, mode_index: int=0) -> Any: ... ### Include default?
|
||||
def filter(self, size: Size, divisor: float, offset: float, kernel: Any) -> ImagingCore: ... ### what is kernel?
|
||||
def histogram(self, tuple2: Tuple[float, float]=..., mask: ImagingCore=...) -> List[int]: ... ### Do these have default values? Do they take None? What is tuple2?
|
||||
|
||||
def expand(self, xmargin: int, ymargin: int, mode_index: int=0) -> ImagingCore: ...
|
||||
def filter(self, size: Size, divisor: float, offset: float, kernel: List[float]) -> ImagingCore: ...
|
||||
def histogram(self, extrema: Union[Tuple[float, float], Tuple[int, int]]=...,
|
||||
mask: ImagingCore=...) -> List[int]: ... ### Do they take None?
|
||||
def modefilter(self, i: int) -> Any: ...
|
||||
|
||||
# def offset(self): ... ### Function removed?
|
||||
|
||||
def paste(self, core: ImagingCore, box: LURD, coremask: ImagingCore) -> None: ...
|
||||
def point(self, lut: Any, mode: Optional[Mode]) -> ImagingCore: ... ### Clarify Any
|
||||
def point_transform(self, scale: float=1.0, offset: float=0.0) -> ImagingCore: ... ### Include defaults or not?
|
||||
def putdata(self, data: Any, scale: float=1.0, offset: float=0.0) -> None: ... ### Include defaults or not?
|
||||
|
||||
def point(self, lut: Union[List[int], List[float]], mode: Optional[Mode]) -> ImagingCore: ...
|
||||
def point_transform(self, scale: float=1.0, offset: float=0.0) -> ImagingCore: ...
|
||||
def putdata(self, data: Any, scale: float=1.0, offset: float=0.0) -> None: ...
|
||||
def quantize(self, colors: int=..., method: int=..., kmeans: int=...) -> ImagingCore: ...
|
||||
|
||||
def rankfilter(self, size: int, rank: int) -> ImagingCore: ...
|
||||
|
||||
def resize(self, size: Size, resample: int=...) -> ImagingCore: ...
|
||||
def transpose(self, method: int) -> ImagingCore: ...
|
||||
def transform2(self, box: LURD, core: ImagingCore, method: int, data: Any, resample: int=..., fill: int=...) -> None: ... ### What is data?
|
||||
|
||||
def transform2(self, box: LURD, core: ImagingCore, method: int,
|
||||
data: list[float], resample: int=..., fill: int=...) -> None: ...
|
||||
def isblock(self) -> int: ...
|
||||
|
||||
def getbbox(self) -> Optional[LURD]: ...
|
||||
def getcolors(self, maxcolors: int) -> List[Tuple[int, Any]]: ... ### Any is a 'Color'?
|
||||
def getcolors(self, maxcolors: int) -> Optional[List[Tuple[int, Color]]]: ... ###################
|
||||
def getextrema(self) -> Tuple[float, float]: ...
|
||||
def getprojection(self) -> Tuple[Any, Any]: ... ### Need types
|
||||
|
||||
def getprojection(self) -> Tuple[List[int], List[int]]: ...
|
||||
def getband(self, band: int) -> ImagingCore: ...
|
||||
def putband(self, image: ImagingCore, band_index: int) -> None: ...
|
||||
def split(self) -> List[ImagingCore]: ...
|
||||
def fillband(self, band: int, color: int) -> None: ...
|
||||
|
||||
def setmode(self, mode: Mode) -> None: ...
|
||||
|
||||
def getpalette(self, mode: Mode="RGB", rawmode: Mode="RGB") -> Any: ... ### returns bytearray?
|
||||
def getpalette(self, mode: Mode="RGB", rawmode: Mode="RGB") -> bytes: ...
|
||||
def getpalettemode(self) -> Mode: ...
|
||||
def putpalette(self, rawmode: Mode, palettes) -> None: ... ### palettes is a bytesarray?
|
||||
def putpalette(self, rawmode: Mode, palettes: bytes) -> None: ...
|
||||
def putpalettealpha(self, index: int, alpha: int=...) -> None: ...
|
||||
def putpalettealphas(self, alphas) -> None: ... ### alphas is a bytesarray?
|
||||
def putpalettealphas(self, alphas: bytes) -> None: ...
|
||||
|
||||
### chop_* here
|
||||
|
||||
|
@ -98,7 +87,5 @@ class ImagingCore:
|
|||
### box_blur here
|
||||
|
||||
def effect_spread(self, distance: int) -> ImagingCore: ...
|
||||
|
||||
def new_block(self, mode: Mode, size: Size) -> ImagingCore: ...
|
||||
|
||||
def save_ppm(self, file: Text) -> None: ...
|
||||
|
|
Loading…
Reference in New Issue
Block a user