コード例 #1
0
class CountNonNullRows(Pipe):
    """Count runs of non empty rows, to detect the break before a state or county name"""

    def process_header(self, headers):
        self.row_proxy = RowProxy(headers)

        self.bundle.non_null_row_count = 0 

        return headers

    def process_body(self, row):

        if not bool(self.row_proxy.set_row(row).state_county_city.strip()):
            self.bundle.non_null_row_count = 0
        else:
            self.bundle.non_null_row_count += 1
            
        return row
コード例 #2
0
    def process_header(self, headers):
        self.row_proxy = RowProxy(headers)

        self.bundle.non_null_row_count = 0 

        return headers