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

Method check_rows

_plotly_utils/png.py:647–666  ·  view source on GitHub ↗

Yield each row in rows, but check each row first (for correct width).

(rows)

Source from the content-addressed store, hash-verified

645 vpr = self.width * self.planes
646
647 def check_rows(rows):
648 """
649 Yield each row in rows,
650 but check each row first (for correct width).
651 """
652 for i, row in enumerate(rows):
653 try:
654 wrong_length = len(row) != vpr
655 except TypeError:
656 # When using an itertools.ichain object or
657 # other generator not supporting __len__,
658 # we set this to False to skip the check.
659 wrong_length = False
660 if wrong_length:
661 # Note: row numbers start at 0.
662 raise ProtocolError(
663 "Expected %d values but got %d values, in row %d"
664 % (vpr, len(row), i)
665 )
666 yield row
667
668 if self.interlace:
669 fmt = "BH"[self.bitdepth > 8]

Callers

nothing calls this directly

Calls 1

ProtocolErrorClass · 0.85

Tested by

no test coverage detected