Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-19 10:50:40 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-19 10:56:40 +0300
commita24ef1f0cc4ebc29871289b5b92d76f4fe7b7e80 (patch)
tree4d8ba32769224823724f547289561d8be4ccf922 /sphinx/util/png.py
parent5c14375365fe9a9f7b97cc37988d17a8a3ec56d2 (diff)
refactor: Add Optional to type annotations
Diffstat (limited to 'sphinx/util/png.py')
-rw-r--r--sphinx/util/png.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sphinx/util/png.py b/sphinx/util/png.py
index c7f73fd50..22c35d991 100644
--- a/sphinx/util/png.py
+++ b/sphinx/util/png.py
@@ -10,6 +10,7 @@
import binascii
import struct
+from typing import Optional
LEN_IEND = 12
@@ -20,7 +21,7 @@ DEPTH_CHUNK_START = b'tEXtDepth\x00'
IEND_CHUNK = b'\x00\x00\x00\x00IEND\xAE\x42\x60\x82'
-def read_png_depth(filename: str) -> int:
+def read_png_depth(filename: str) -> Optional[int]:
"""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)