MCPcopy Index your code
hub / github.com/plotly/plotly.py / write_chunk

Function write_chunk

_plotly_utils/png.py:908–922  ·  view source on GitHub ↗

Write a PNG chunk to the output file, including length and checksum.

(outfile, tag, data=b"")

Source from the content-addressed store, hash-verified

906
907
908def write_chunk(outfile, tag, data=b""):
909 """
910 Write a PNG chunk to the output file, including length and
911 checksum.
912 """
913
914 data = bytes(data)
915 # http://www.w3.org/TR/PNG/#5Chunk-layout
916 outfile.write(struct.pack("!I", len(data)))
917 outfile.write(tag)
918 outfile.write(data)
919 checksum = zlib.crc32(tag)
920 checksum = zlib.crc32(data, checksum)
921 checksum &= 2**32 - 1
922 outfile.write(struct.pack("!I", checksum))
923
924
925def write_chunks(out, chunks):

Callers 3

write_packedMethod · 0.85
write_preambleMethod · 0.85
write_chunksFunction · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected