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

Method preamble

_plotly_utils/png.py:1598–1619  ·  view source on GitHub ↗

Extract the image metadata by reading the initial part of the PNG file up to the start of the ``IDAT`` chunk. All the chunks that precede the ``IDAT`` chunk are read and either processed for metadata or discarded. If the optional `lenient` argument e

(self, lenient=False)

Source from the content-addressed store, hash-verified

1596 raise FormatError("PNG file has invalid signature.")
1597
1598 def preamble(self, lenient=False):
1599 """
1600 Extract the image metadata by reading
1601 the initial part of the PNG file up to
1602 the start of the ``IDAT`` chunk.
1603 All the chunks that precede the ``IDAT`` chunk are
1604 read and either processed for metadata or discarded.
1605
1606 If the optional `lenient` argument evaluates to `True`,
1607 checksum failures will raise warnings rather than exceptions.
1608 """
1609
1610 self.validate_signature()
1611
1612 while True:
1613 if not self.atchunk:
1614 self.atchunk = self._chunk_len_type()
1615 if self.atchunk is None:
1616 raise FormatError("This PNG file has no IDAT chunks.")
1617 if self.atchunk[1] == b"IDAT":
1618 return
1619 self.process_chunk(lenient=lenient)
1620
1621 def _chunk_len_type(self):
1622 """

Callers 2

readMethod · 0.95
asDirectMethod · 0.95

Calls 4

validate_signatureMethod · 0.95
_chunk_len_typeMethod · 0.95
process_chunkMethod · 0.95
FormatErrorClass · 0.85

Tested by

no test coverage detected