Merge branch 'main' into imagetype

This commit is contained in:
Andrew Murray 2023-12-27 08:36:09 +11:00
commit dc78fd7de0
7 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/python3
from __future__ import annotations
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -13,7 +15,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
import atheris

View File

@ -1,5 +1,7 @@
#!/usr/bin/python3
from __future__ import annotations
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -13,7 +15,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
import atheris

View File

@ -233,7 +233,7 @@ htmlhelp_basename = "PillowPILForkdoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
latex_elements: dict[str, str] = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').

View File

@ -5,7 +5,7 @@ from PIL import Image, ImageDraw, ImageFont
font = ImageFont.truetype("Tests/fonts/NotoSans-Regular.ttf", 16)
def test(anchor):
def test(anchor: str) -> Image.Image:
im = Image.new("RGBA", (200, 100), "white")
d = ImageDraw.Draw(im)
d.line(((100, 0), (100, 100)), "gray")

View File

@ -15,7 +15,7 @@ except AttributeError:
pass
def testimage():
def testimage() -> None:
"""
PIL lets you create in-memory images with various pixel types:

View File

@ -24,7 +24,7 @@ class ContainerIO:
file (for example a TAR file).
"""
def __init__(self, file, offset, length):
def __init__(self, file, offset, length) -> None:
"""
Create file object.

View File

@ -16,6 +16,7 @@
from __future__ import annotations
import io
from types import TracebackType
from . import ContainerIO
@ -23,7 +24,7 @@ from . import ContainerIO
class TarIO(ContainerIO.ContainerIO):
"""A file object that provides read access to a given member of a TAR file."""
def __init__(self, tarfile, file):
def __init__(self, tarfile: str, file: str) -> None:
"""
Create file object.
@ -57,11 +58,16 @@ class TarIO(ContainerIO.ContainerIO):
super().__init__(self.fh, self.fh.tell(), size)
# Context manager support
def __enter__(self):
def __enter__(self) -> TarIO:
return self
def __exit__(self, *args):
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None:
self.close()
def close(self):
def close(self) -> None:
self.fh.close()