Replace Any with Incomplete in many places (#9558)

This commit is contained in:
Alex Waygood
2023-01-18 08:48:16 +00:00
committed by GitHub
parent ddfaca3200
commit 4fea314594
460 changed files with 3779 additions and 2909 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -19,5 +20,5 @@ class GifImageFile(ImageFile):
RAWMODE: Any
def get_interlace(im): ...
def getheader(im, palette: Any | None = ..., info: Any | None = ...): ...
def getheader(im, palette: Incomplete | None = ..., info: Incomplete | None = ...): ...
def getdata(im, offset=..., **params): ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -20,7 +21,7 @@ class IcnsFile:
def itersizes(self): ...
def bestsize(self): ...
def dataforsize(self, size): ...
def getimage(self, size: Any | None = ...): ...
def getimage(self, size: Incomplete | None = ...): ...
class IcnsImageFile(ImageFile):
format: ClassVar[Literal["ICNS"]]
+19 -4
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from .Image import ImagePointHandler
@@ -24,18 +25,32 @@ class ImageCmsTransform(ImagePointHandler):
output_mode: Any
output_profile: Any
def __init__(
self, input, output, input_mode, output_mode, intent=..., proof: Any | None = ..., proof_intent=..., flags: int = ...
self,
input,
output,
input_mode,
output_mode,
intent=...,
proof: Incomplete | None = ...,
proof_intent=...,
flags: int = ...,
) -> None: ...
def point(self, im): ...
def apply(self, im, imOut: Any | None = ...): ...
def apply(self, im, imOut: Incomplete | None = ...): ...
def apply_in_place(self, im): ...
def get_display_profile(handle: Any | None = ...): ...
def get_display_profile(handle: Incomplete | None = ...): ...
class PyCMSError(Exception): ...
def profileToProfile(
im, inputProfile, outputProfile, renderingIntent=..., outputMode: Any | None = ..., inPlace: bool = ..., flags: int = ...
im,
inputProfile,
outputProfile,
renderingIntent=...,
outputMode: Incomplete | None = ...,
inPlace: bool = ...,
flags: int = ...,
): ...
def getOpenProfile(profileFilename): ...
def buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent=..., flags: int = ...): ...
+4 -3
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Container, Sequence
from typing import Any, overload
from typing_extensions import Literal, TypeAlias
@@ -82,7 +83,7 @@ class ImageDraw:
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: int = ...,
stroke_fill: _Ink | None = ...,
@@ -126,7 +127,7 @@ class ImageDraw:
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: int = ...,
embedded_color: bool = ...,
@@ -140,7 +141,7 @@ class ImageDraw:
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: int = ...,
embedded_color: bool = ...,
+3 -2
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
class Pen:
@@ -18,9 +19,9 @@ class Draw:
draw: Any
image: Any
transform: Any
def __init__(self, image, size: Any | None = ..., color: Any | None = ...) -> None: ...
def __init__(self, image, size: Incomplete | None = ..., color: Incomplete | None = ...) -> None: ...
def flush(self): ...
def render(self, op, xy, pen, brush: Any | None = ...) -> None: ...
def render(self, op, xy, pen, brush: Incomplete | None = ...) -> None: ...
def settransform(self, offset) -> None: ...
def arc(self, xy, start, end, *options) -> None: ...
def chord(self, xy, start, end, *options) -> None: ...
+3 -3
View File
@@ -18,7 +18,7 @@ class ImageFile(Image):
decodermaxblock: Any
fp: Any
filename: Any
def __init__(self, fp: Any | None = ..., filename: Any | None = ...) -> None: ...
def __init__(self, fp: Incomplete | None = ..., filename: Incomplete | None = ...) -> None: ...
def get_format_mimetype(self): ...
def verify(self) -> None: ...
map: Any
@@ -64,5 +64,5 @@ class PyDecoder:
def decode(self, buffer) -> None: ...
def cleanup(self) -> None: ...
def setfd(self, fd) -> None: ...
def setimage(self, im, extents: Any | None = ...) -> None: ...
def set_as_raw(self, data, rawmode: Any | None = ...) -> None: ...
def setimage(self, im, extents: Incomplete | None = ...) -> None: ...
def set_as_raw(self, data, rawmode: Incomplete | None = ...) -> None: ...
+3 -3
View File
@@ -1,4 +1,4 @@
from _typeshed import Self
from _typeshed import Incomplete, Self
from collections.abc import Callable, Iterable, Sequence
from typing import Any
from typing_extensions import Literal, TypeAlias
@@ -18,7 +18,7 @@ class BuiltinFilter(MultibandFilter):
class Kernel(BuiltinFilter):
name: str
filterargs: _FilterArgs
def __init__(self, size: Sequence[int], kernel: Sequence[int], scale: Any | None = ..., offset: int = ...) -> None: ...
def __init__(self, size: Sequence[int], kernel: Sequence[int], scale: Incomplete | None = ..., offset: int = ...) -> None: ...
class RankFilter(Filter):
name: str
@@ -133,6 +133,6 @@ class Color3DLUT(MultibandFilter):
callback: Callable[..., Iterable[float]],
with_normals: bool = ...,
channels: Literal[3, 4] | None = ...,
target_mode: Any | None = ...,
target_mode: Incomplete | None = ...,
) -> Self: ...
def filter(self, image) -> Image: ...
+6 -6
View File
@@ -1,4 +1,4 @@
from _typeshed import StrOrBytesPath, SupportsRead
from _typeshed import Incomplete, StrOrBytesPath, SupportsRead
from typing import Any, Protocol
from typing_extensions import Literal
@@ -33,7 +33,7 @@ class FreeTypeFont:
text: str | bytes,
mode: str = ...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
) -> int: ...
def getbbox(
@@ -50,7 +50,7 @@ class FreeTypeFont:
self,
text: str | bytes,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: int = ...,
) -> tuple[int, int]: ...
@@ -59,7 +59,7 @@ class FreeTypeFont:
text: str | bytes,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
spacing: float = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: float = ...,
) -> tuple[int, int]: ...
@@ -69,7 +69,7 @@ class FreeTypeFont:
text: str | bytes,
mode: str = ...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: float = ...,
anchor: str | None = ...,
@@ -82,7 +82,7 @@ class FreeTypeFont:
mode: str = ...,
fill=...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
features: Incomplete | None = ...,
language: str | None = ...,
stroke_width: float = ...,
anchor: str | None = ...,
+2 -2
View File
@@ -1,8 +1,8 @@
from typing import Any
from _typeshed import Incomplete
from .Image import Image, _Box
def grab(
bbox: _Box | None = ..., include_layered_windows: bool = ..., all_screens: bool = ..., xdisplay: Any | None = ...
bbox: _Box | None = ..., include_layered_windows: bool = ..., all_screens: bool = ..., xdisplay: Incomplete | None = ...
) -> Image: ...
def grabclipboard() -> Image | None: ...
+2 -1
View File
@@ -1,9 +1,10 @@
from _typeshed import Incomplete
from typing import Any
class _Operand:
im: Any
def __init__(self, im) -> None: ...
def apply(self, op, im1, im2: Any | None = ..., mode: Any | None = ...): ...
def apply(self, op, im1, im2: Incomplete | None = ..., mode: Incomplete | None = ...): ...
def __bool__(self) -> bool: ...
def __abs__(self): ...
def __pos__(self): ...
+8 -3
View File
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any, Protocol, Union
from typing import Protocol, Union
from typing_extensions import TypeAlias
from .Image import Image, Resampling, _Resample, _Size
@@ -24,12 +25,16 @@ def colorize(
) -> Image: ...
def contain(image: Image, size: _Size, method: Resampling | _Resample = ...) -> Image: ...
def pad(
image: Image, size: _Size, method: Resampling | _Resample = ..., color: Any | None = ..., centering: Iterable[float] = ...
image: Image,
size: _Size,
method: Resampling | _Resample = ...,
color: Incomplete | None = ...,
centering: Iterable[float] = ...,
) -> Image: ...
def crop(image: Image, border: _Border = ...) -> Image: ...
def scale(image: Image, factor: float, resample: Resampling | _Resample = ...) -> Image: ...
def deform(image: Image, deformer: _Deformer, resample: Resampling | _Resample = ...) -> Image: ...
def equalize(image: Image, mask: Any | None = ...) -> Image: ...
def equalize(image: Image, mask: Incomplete | None = ...) -> Image: ...
def expand(image: Image, border: _Border = ..., fill: _Ink = ...) -> Image: ...
def fit(
image: Image, size: _Size, method: Resampling | _Resample = ..., bleed: float = ..., centering: Iterable[float] = ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from .Image import Image
@@ -8,7 +9,7 @@ class ImagePalette:
palette: Any
colors: Any
dirty: Any
def __init__(self, mode: str = ..., palette: Any | None = ..., size: int = ...) -> None: ...
def __init__(self, mode: str = ..., palette: Incomplete | None = ..., size: int = ...) -> None: ...
def copy(self) -> ImagePalette: ...
def getdata(self): ...
def tobytes(self) -> bytes: ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
class Iterator:
@@ -8,4 +9,4 @@ class Iterator:
def __iter__(self): ...
def __next__(self): ...
def all_frames(im, func: Any | None = ...): ...
def all_frames(im, func: Incomplete | None = ...): ...
+2 -2
View File
@@ -3,7 +3,7 @@ from typing import Any
from typing_extensions import Literal
def register(viewer, order: int = ...) -> None: ...
def show(image, title: Any | None = ..., **options): ...
def show(image, title: Incomplete | None = ..., **options): ...
class Viewer:
def show(self, image, **options): ...
@@ -45,7 +45,7 @@ class EogViewer(UnixViewer):
def get_command_ex(self, file, **options): ...
class XVViewer(UnixViewer):
def get_command_ex(self, file, title: Any | None = ..., **options): ...
def get_command_ex(self, file, title: Incomplete | None = ..., **options): ...
class IPythonViewer(Viewer):
def show_image(self, image, **options): ...
+2 -1
View File
@@ -1,9 +1,10 @@
from _typeshed import Incomplete
from typing import Any
class Stat:
h: Any
bands: Any
def __init__(self, image_or_list, mask: Any | None = ...) -> None: ...
def __init__(self, image_or_list, mask: Incomplete | None = ...) -> None: ...
def __getattr__(self, id: str): ...
Global = Stat
+4 -3
View File
@@ -1,15 +1,16 @@
from _typeshed import Incomplete
from typing import Any
class PhotoImage:
tk: Any
def __init__(self, image: Any | None = ..., size: Any | None = ..., **kw) -> None: ...
def __init__(self, image: Incomplete | None = ..., size: Incomplete | None = ..., **kw) -> None: ...
def __del__(self) -> None: ...
def width(self): ...
def height(self): ...
def paste(self, im, box: Any | None = ...) -> None: ...
def paste(self, im, box: Incomplete | None = ...) -> None: ...
class BitmapImage:
def __init__(self, image: Any | None = ..., **kw) -> None: ...
def __init__(self, image: Incomplete | None = ..., **kw) -> None: ...
def __del__(self) -> None: ...
def width(self): ...
def height(self): ...
+5 -4
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
class HDC:
@@ -14,17 +15,17 @@ class Dib:
image: Any
mode: Any
size: Any
def __init__(self, image, size: Any | None = ...) -> None: ...
def __init__(self, image, size: Incomplete | None = ...) -> None: ...
def expose(self, handle): ...
def draw(self, handle, dst, src: Any | None = ...): ...
def draw(self, handle, dst, src: Incomplete | None = ...): ...
def query_palette(self, handle): ...
def paste(self, im, box: Any | None = ...) -> None: ...
def paste(self, im, box: Incomplete | None = ...) -> None: ...
def frombytes(self, buffer): ...
def tobytes(self): ...
class Window:
hwnd: Any
def __init__(self, title: str = ..., width: Any | None = ..., height: Any | None = ...) -> None: ...
def __init__(self, title: str = ..., width: Incomplete | None = ..., height: Incomplete | None = ...) -> None: ...
def ui_handle_clear(self, dc, x0, y0, x1, y1) -> None: ...
def ui_handle_damage(self, x0, y0, x1, y1) -> None: ...
def ui_handle_destroy(self) -> None: ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -29,4 +30,4 @@ samplings: Any
def convert_dict_qtables(qtables): ...
def get_sampling(im): ...
def jpeg_factory(fp: Any | None = ..., filename: Any | None = ...): ...
def jpeg_factory(fp: Incomplete | None = ..., filename: Incomplete | None = ...): ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -12,4 +13,4 @@ class MpoImageFile(JpegImageFile):
def seek(self, frame) -> None: ...
def tell(self): ...
@staticmethod
def adopt(jpeg_instance, mpheader: Any | None = ...): ...
def adopt(jpeg_instance, mpheader: Incomplete | None = ...): ...
+11 -5
View File
@@ -1,4 +1,5 @@
import collections
from _typeshed import Incomplete
from typing import Any
def encode_text(s: str) -> bytes: ...
@@ -86,7 +87,12 @@ class PdfParser:
trailer_dict: Any
xref_table: Any
def __init__(
self, filename: Any | None = ..., f: Any | None = ..., buf: Any | None = ..., start_offset: int = ..., mode: str = ...
self,
filename: Incomplete | None = ...,
f: Incomplete | None = ...,
buf: Incomplete | None = ...,
start_offset: int = ...,
mode: str = ...,
) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
@@ -98,7 +104,7 @@ class PdfParser:
def write_comment(self, s) -> None: ...
def write_catalog(self): ...
def rewrite_pages(self) -> None: ...
def write_xref_and_trailer(self, new_root_ref: Any | None = ...) -> None: ...
def write_xref_and_trailer(self, new_root_ref: Incomplete | None = ...) -> None: ...
def write_page(self, ref, *objs, **dict_obj): ...
def write_obj(self, ref, *objs, **dict_obj): ...
def del_root(self) -> None: ...
@@ -106,7 +112,7 @@ class PdfParser:
def get_buf_from_file(f): ...
file_size_this: Any
def read_pdf_info(self) -> None: ...
def next_object_id(self, offset: Any | None = ...): ...
def next_object_id(self, offset: Incomplete | None = ...): ...
delimiter: bytes
delimiter_or_ws: bytes
whitespace: bytes
@@ -145,7 +151,7 @@ class PdfParser:
re_stream_start: Any
re_stream_end: Any
@classmethod
def get_value(cls, data, offset, expect_indirect: Any | None = ..., max_nesting: int = ...): ...
def get_value(cls, data, offset, expect_indirect: Incomplete | None = ..., max_nesting: int = ...): ...
re_lit_str_token: Any
escaped_chars: Any
@classmethod
@@ -155,4 +161,4 @@ class PdfParser:
re_xref_entry: Any
def read_xref_table(self, xref_section_offset): ...
def read_indirect(self, ref, max_nesting: int = ...): ...
def linearize_page_tree(self, node: Any | None = ...): ...
def linearize_page_tree(self, node: Incomplete | None = ...): ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -32,7 +33,7 @@ class iTXt(str):
lang: Any
tkey: Any
@staticmethod
def __new__(cls, text, lang: Any | None = ..., tkey: Any | None = ...): ...
def __new__(cls, text, lang: Incomplete | None = ..., tkey: Incomplete | None = ...): ...
class PngInfo:
chunks: Any
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -24,5 +25,5 @@ class SpiderImageFile(ImageFile):
def convert2byte(self, depth: int = ...): ...
def tkPhotoImage(self): ...
def loadImageSeries(filelist: Any | None = ...): ...
def loadImageSeries(filelist: Incomplete | None = ...): ...
def makeSpiderHeader(im): ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from collections.abc import MutableMapping
from numbers import Rational
from typing import Any, ClassVar
@@ -143,7 +144,7 @@ class TiffImageFile(ImageFile):
format_description: ClassVar[str]
tag_v2: Any
tag: Any
def __init__(self, fp: Any | None = ..., filename: Any | None = ...) -> None: ...
def __init__(self, fp: Incomplete | None = ..., filename: Incomplete | None = ...) -> None: ...
@property
def n_frames(self): ...
im: Any
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, NamedTuple, Union
from typing_extensions import Literal, TypeAlias
@@ -11,7 +12,7 @@ class _TagInfo(NamedTuple):
class TagInfo(_TagInfo):
def __new__(
cls,
value: Any | None = ...,
value: Incomplete | None = ...,
name: str = ...,
type: _TagType | None = ...,
length: int | None = ...,
+2 -1
View File
@@ -1,4 +1,5 @@
import sys
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -15,4 +16,4 @@ if sys.platform == "win32":
class WmfStubImageFile(StubImageFile):
format: ClassVar[Literal["WMF"]]
format_description: ClassVar[str]
def load(self, dpi: Any | None = ...) -> None: ...
def load(self, dpi: Incomplete | None = ...) -> None: ...
+2 -1
View File
@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
modules: Any
@@ -20,4 +21,4 @@ def get_supported_features(): ...
def check(feature): ...
def version(feature): ...
def get_supported(): ...
def pilinfo(out: Any | None = ..., supported_formats: bool = ...) -> None: ...
def pilinfo(out: Incomplete | None = ..., supported_formats: bool = ...) -> None: ...