From 1b0e268102b8d9a2ea921ebdeac87bd5eb793d55 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 16 Nov 2021 17:35:08 +0100 Subject: [PATCH] Improve fpdf.image_parsing (#6313) * Annotate more attributes, arguments, and return types. * Add "dims" argument to get_img_info(), added in 2.4.6. --- stubs/fpdf2/fpdf/image_parsing.pyi | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stubs/fpdf2/fpdf/image_parsing.pyi b/stubs/fpdf2/fpdf/image_parsing.pyi index ba17b8a8d..6355b3adf 100644 --- a/stubs/fpdf2/fpdf/image_parsing.pyi +++ b/stubs/fpdf2/fpdf/image_parsing.pyi @@ -1,6 +1,11 @@ -from typing import Any +from typing import Any, Tuple +from typing_extensions import Literal -SUPPORTED_IMAGE_FILTERS: Any +_ImageFilter = Literal["AUTO", "FlateDecode", "DCTDecode", "JPXDecode"] + +SUPPORTED_IMAGE_FILTERS: Tuple[_ImageFilter, ...] def load_image(filename): ... -def get_img_info(img, image_filter: str = ...): ... + +# Returned dict could be typed as a TypedDict. +def get_img_info(img, image_filter: _ImageFilter = ..., dims: Any | None = ...) -> dict[str, Any]: ...