def validate_rows(self):
        """
        :raises ValueError:
        """

        invalid_row_idx_list = []

        for row_idx, row in enumerate(self.rows):
            if isinstance(row, (list, tuple)) and len(self.headers) != len(row):
                invalid_row_idx_list.append(row_idx)

            if isinstance(row, dict):
                if not all([header in row for header in self.headers]):
                    invalid_row_idx_list.append(row_idx)

        if not invalid_row_idx_list:
            return

        for invalid_row_idx in invalid_row_idx_list:
            logger.debug(
                "invalid row (line={}): {}".format(invalid_row_idx, self.rows[invalid_row_idx])
            )

        raise ValueError(
            "table header length and row length are mismatch:\n"
            + "  header(len={}): {}\n".format(len(self.headers), self.headers)
            + "  # of miss match rows: {} ouf of {}\n".format(
                len(invalid_row_idx_list), self.num_rows
            )
        )
def validate_rows ( self ) : invalid_row_idx_list = [ ] for row_idx , row in enumerate ( self . rows ) : if isinstance ( row , ( list , tuple ) ) and len ( self . headers ) != len ( row ) : invalid_row_idx_list . append ( row_idx ) if isinstance ( row , dict ) : if not all ( [ header in row for header in self . headers ] ) : invalid_row_idx_list . append ( row_idx ) if not invalid_row_idx_list : return for invalid_row_idx in invalid_row_idx_list : logger . debug ( "invalid row (line={}): {}" . format ( invalid_row_idx , self . rows [ invalid_row_idx ] ) ) raise ValueError ( "table header length and row length are mismatch:\n" + "  header(len={}): {}\n" . format ( len ( self . headers ) , self . headers ) + "  # of miss match rows: {} ouf of {}\n" . format ( len ( invalid_row_idx_list ) , self . num_rows ) )
:raises ValueError: