mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Migrate to py3 style type annotation: sphinx.util.png
This commit is contained in:
parent
b5276b3965
commit
5115fb0172
@ -20,8 +20,7 @@ DEPTH_CHUNK_START = b'tEXtDepth\x00'
|
|||||||
IEND_CHUNK = b'\x00\x00\x00\x00IEND\xAE\x42\x60\x82'
|
IEND_CHUNK = b'\x00\x00\x00\x00IEND\xAE\x42\x60\x82'
|
||||||
|
|
||||||
|
|
||||||
def read_png_depth(filename):
|
def read_png_depth(filename: str) -> int:
|
||||||
# type: (str) -> int
|
|
||||||
"""Read the special tEXt chunk indicating the depth from a PNG file."""
|
"""Read the special tEXt chunk indicating the depth from a PNG file."""
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
f.seek(- (LEN_IEND + LEN_DEPTH), 2)
|
f.seek(- (LEN_IEND + LEN_DEPTH), 2)
|
||||||
@ -33,8 +32,7 @@ def read_png_depth(filename):
|
|||||||
return struct.unpack('!i', depthchunk[14:18])[0]
|
return struct.unpack('!i', depthchunk[14:18])[0]
|
||||||
|
|
||||||
|
|
||||||
def write_png_depth(filename, depth):
|
def write_png_depth(filename: str, depth: int) -> None:
|
||||||
# type: (str, int) -> None
|
|
||||||
"""Write the special tEXt chunk indicating the depth to a PNG file.
|
"""Write the special tEXt chunk indicating the depth to a PNG file.
|
||||||
|
|
||||||
The chunk is placed immediately before the special IEND chunk.
|
The chunk is placed immediately before the special IEND chunk.
|
||||||
|
Loading…
Reference in New Issue
Block a user