summaryrefslogtreecommitdiff
path: root/sphinx/util/png.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/png.py')
-rw-r--r--sphinx/util/png.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/sphinx/util/png.py b/sphinx/util/png.py
index d2718da18..6c942194e 100644
--- a/sphinx/util/png.py
+++ b/sphinx/util/png.py
@@ -4,7 +4,6 @@ from __future__ import annotations
import binascii
import struct
-from typing import Optional
LEN_IEND = 12
LEN_DEPTH = 22
@@ -14,7 +13,7 @@ DEPTH_CHUNK_START = b'tEXtDepth\x00'
IEND_CHUNK = b'\x00\x00\x00\x00IEND\xAE\x42\x60\x82'
-def read_png_depth(filename: str) -> Optional[int]:
+def read_png_depth(filename: str) -> int | None:
"""Read the special tEXt chunk indicating the depth from a PNG file."""
with open(filename, 'rb') as f:
f.seek(- (LEN_IEND + LEN_DEPTH), 2)