Skip to content

Commit

Permalink
Use Python 3.7+ compatible type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorSusmelj committed Dec 14, 2024
1 parent e2d0ade commit c03fbc7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/labelformat/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from pathlib import Path
from typing import Iterable
from typing import Iterable, Tuple

import PIL.Image

Expand All @@ -27,7 +27,7 @@ class ImageDimensionError(Exception):
pass


def get_jpeg_dimensions(file_path: Path) -> tuple[int, int]:
def get_jpeg_dimensions(file_path: Path) -> Tuple[int, int]:
"""Try to efficiently get JPEG dimensions from file headers without decoding the image.
This method reads only the JPEG file headers looking for the Start Of Frame (SOFn)
Expand Down Expand Up @@ -72,7 +72,7 @@ def get_jpeg_dimensions(file_path: Path) -> tuple[int, int]:
raise ImageDimensionError(f"Failed to read JPEG dimensions: {str(e)}")


def get_png_dimensions(file_path: Path) -> tuple[int, int]:
def get_png_dimensions(file_path: Path) -> Tuple[int, int]:
"""Try to efficiently get PNG dimensions from file headers without decoding the image.
This method reads only the PNG IHDR (Image Header) chunk which is always the first
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_png_dimensions(file_path: Path) -> tuple[int, int]:
raise ImageDimensionError(f"Failed to read PNG dimensions: {str(e)}")


def get_image_dimensions(image_path: Path) -> tuple[int, int]:
def get_image_dimensions(image_path: Path) -> Tuple[int, int]:
"""Get image dimensions using the most efficient method available.
Args:
Expand Down

0 comments on commit c03fbc7

Please sign in to comment.