Yield each row in rows, but check each row first (for correct width).
(rows)
| 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] |
nothing calls this directly
no test coverage detected