Pillow: fix errors found by stubtest (#5629)

* Update Pillow stubtest allowlist

* Update cryptography allowlist
This commit is contained in:
Sebastian Rittau
2021-06-13 14:15:51 +02:00
committed by GitHub
parent 0744d8c30a
commit d3ba8a3858
7 changed files with 42 additions and 49 deletions

View File

@@ -1,15 +1,4 @@
PIL.Image.Image.category
PIL.Image.Image.resize
PIL.Image.fromarray
PIL.Image.open
PIL.ImageDraw.ImageDraw.multiline_text
PIL.ImageDraw.ImageDraw.multiline_textbbox
PIL.ImageDraw.ImageDraw.textbbox
PIL.ImageFile.ImageFile.__getattr__
PIL.ImageFile.ImageFile.__init__
PIL.ImageFont.FreeTypeFont.getlength
PIL.ImageFont.FreeTypeFont.getmask
PIL.ImageFont.FreeTypeFont.getmask2
PIL.ImageFont.FreeTypeFont.getsize
PIL.ImageFont.FreeTypeFont.getsize_multiline
PIL.__getattr__
PIL.FpxImagePlugin
PIL.ImageQt.ImageQt
PIL.MicImagePlugin
PIL.WmfImagePlugin.WmfHandler

View File

@@ -107,8 +107,6 @@ class Image:
readonly: int
pyaccess: Any
@property
def category(self) -> int: ... # obsolete
@property
def width(self) -> int: ...
@property
def height(self) -> int: ...
@@ -171,7 +169,11 @@ class Image:
def putpixel(self, xy, value): ...
def remap_palette(self, dest_map, source_palette=...): ...
def resize(
self, size: tuple[int, int], resample: _Resample = ..., box: tuple[float, float, float, float] | None = ...
self,
size: tuple[int, int],
resample: _Resample = ...,
box: tuple[float, float, float, float] | None = ...,
reducing_gap: float | None = ...,
) -> Image: ...
def reduce(self, factor, box=...): ...
def rotate(
@@ -204,10 +206,10 @@ class ImageTransformHandler: ...
def new(mode: _Mode, size: tuple[int, int], color: float | Tuple[float, ...] = ...) -> Image: ...
def frombytes(mode: _Mode, size: tuple[int, int], data, decoder_name: str = ..., *args) -> Image: ...
def frombuffer(mode: _Mode, size: tuple[int, int], data, decoder_name: str = ..., *args) -> Image: ...
def fromarray(obj, mode: _Mode = ...) -> Image: ...
def fromarray(obj, mode: _Mode | None = ...) -> Image: ...
def fromqimage(im) -> Image: ...
def fromqpixmap(im) -> Image: ...
def open(fp: str | bytes | Path | SupportsRead[bytes], mode: _Mode = ..., formats=...) -> Image: ...
def open(fp: str | bytes | Path | SupportsRead[bytes], mode: Literal["r"] = ..., formats=...) -> Image: ...
def alpha_composite(im1: Image, im2: Image) -> Image: ...
def blend(im1: Image, im2: Image, alpha) -> Image: ...
def composite(image1: Image, image2: Image, mask) -> Image: ...

View File

@@ -69,12 +69,12 @@ class ImageDraw:
text: str | bytes,
fill: _Ink | None = ...,
font: _Font | None = ...,
anchor=...,
anchor: Any | None = ...,
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] = ...,
features=...,
language: str = ...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
stroke_fill: _Ink | None = ...,
embedded_color: bool = ...,
@@ -110,28 +110,28 @@ class ImageDraw:
) -> int: ...
def textbbox(
self,
xy,
xy: tuple[float, float],
text: str | bytes,
font: _Font | None = ...,
anchor=...,
anchor: Any | None = ...,
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] = ...,
features=...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
embedded_color: bool = ...,
) -> tuple[int, int, int, int]: ...
def multiline_textbbox(
self,
xy,
xy: tuple[float, float],
text: str | bytes,
font: _Font | None = ...,
anchor=...,
anchor: Any | None = ...,
spacing: float = ...,
align: Literal["left", "center", "right"] = ...,
direction: Literal["rtl", "ltr", "ttb"] = ...,
features=...,
direction: Literal["rtl", "ltr", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
embedded_color: bool = ...,

View File

@@ -29,7 +29,12 @@ class FreeTypeFont:
def getname(self) -> tuple[str, str]: ...
def getmetrics(self): ...
def getlength(
self, text, mode=..., direction: Literal["ltr", "rtl", "ttb"] = ..., features=..., language: str | None = ...
self,
text,
mode=...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
) -> int: ...
def getbbox(
self, text, mode: str = ..., direction=..., features=..., language: str | None = ..., stroke_width: int = ..., anchor=...
@@ -37,17 +42,17 @@ class FreeTypeFont:
def getsize(
self,
text,
direction: Literal["ltr", "rtl", "ttb"] = ...,
features=...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: int = ...,
) -> tuple[int, int]: ...
def getsize_multiline(
self,
text,
direction: Literal["ltr", "rtl", "ttb"] = ...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
spacing: float = ...,
features=...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
): ...
@@ -56,8 +61,8 @@ class FreeTypeFont:
self,
text: str,
mode: str = ...,
direction: Literal["ltr", "rtl", "ttb"] = ...,
features=...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
anchor=...,
@@ -68,8 +73,8 @@ class FreeTypeFont:
text,
mode: str = ...,
fill=...,
direction: Literal["ltr", "rtl", "ttb"] = ...,
features=...,
direction: Literal["ltr", "rtl", "ttb"] | None = ...,
features: Any | None = ...,
language: str | None = ...,
stroke_width: float = ...,
anchor=...,

View File

@@ -1,8 +1,8 @@
from logging import Logger
from typing import Any
defs: str
ffi: Any
logger: Any
logger: Logger
class PyAccess:
readonly: Any

View File

@@ -116,8 +116,6 @@ class ImageFileDirectory_v2(MutableMapping[int, Any]):
def tobytes(self, offset: int = ...): ...
def save(self, fp): ...
name: Any
class ImageFileDirectory_v1(ImageFileDirectory_v2):
def __init__(self, *args, **kwargs) -> None: ...
tags: Any

View File

@@ -8,6 +8,9 @@ cryptography.hazmat.backends.interfaces.DHBackend.dh_parameters_supported
cryptography.hazmat.backends.interfaces.HMACBackend.cmac_algorithm_supported
cryptography.hazmat.bindings.openssl.binding.Binding.init_static_locks
cryptography.hazmat.primitives.asymmetric.dh.DHParameterNumbers.__init__
cryptography.hazmat.primitives.asymmetric.dsa.AsymmetricVerificationContext
cryptography.hazmat.primitives.asymmetric.ec.AsymmetricVerificationContext
cryptography.hazmat.primitives.asymmetric.rsa.AsymmetricVerificationContext
cryptography.hazmat.primitives.ciphers.aead.AESCCM.__init__
cryptography.hazmat.primitives.ciphers.modes.GCM.__init__
cryptography.hazmat.primitives.cmac.CMAC.__init__
@@ -18,22 +21,18 @@ cryptography.hazmat.primitives.hmac.HMAC.__init__
cryptography.hazmat.primitives.hmac.HMAC.update
cryptography.hazmat.primitives.serialization.pkcs12.serialize_key_and_certificates
cryptography.hazmat.primitives.serialization.pkcs7.PKCS7SignatureBuilder.__init__
cryptography.x509.CertificateBuilder.add_extension
cryptography.x509.CertificateBuilder.public_key
cryptography.x509.CertificateBuilder.serial_number
cryptography.x509.CertificateRevocationListBuilder.__init__
cryptography.x509.CertificateRevocationListBuilder.add_extension
cryptography.x509.CertificateRevocationListBuilder.issuer_name
cryptography.x509.CertificateRevocationListBuilder.last_update
cryptography.x509.CertificateRevocationListBuilder.next_update
cryptography.x509.CertificateSigningRequestBuilder.__init__
cryptography.x509.CertificateSigningRequestBuilder.add_extension
cryptography.x509.Extension.__init__
cryptography.x509.Extensions.__init__
cryptography.x509.NameAttribute.__init__
cryptography.x509.OCSPExtensionOID
cryptography.x509.RevokedCertificateBuilder.__init__
cryptography.x509.RevokedCertificateBuilder.add_extension
cryptography.x509.RevokedCertificateBuilder.serial_number
cryptography.x509.extensions.AccessDescription.__init__
cryptography.x509.extensions.AuthorityInformationAccess.__init__