'Trying to count the comment lines and the number of columns included.
A typical ARFF data block looks like this:
@DATA
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa'

def set_meta(self, dataset, **kwd):

    if dataset.has_data():
        comment_lines = 0
        first_real_line = False
        data_block = False
        with open(dataset.file_name) as handle:
            for line in handle:
                line = line.strip()
                if (not line):
                    continue
                if (line.startswith('%') and (not first_real_line)):
                    comment_lines += 1
                else:
                    first_real_line = True
                if data_block:
                    if line.startswith('{'):
                        '\n                                                                                                                                @data\n                                                                                                                                0,    X,    0,    Y,    "class    A",    {5}\n                                                                                                                or\n                                                                                                                                @data\n                                                                                                                                {1    X,    3    Y,    4    "class    A"},    {5}\n                                                                                                                '
                        token = line.split('}', 1)
                        first_part = token[0]
                        last_column = first_part.split(',')[(-1)].strip()
                        numeric_value = last_column.split()[0]
                        column_count = int(numeric_value)
                        if (len(token) > 1):
                            column_count -= 1
                    else:
                        columns = line.strip().split(',')
                        column_count = len(columns)
                        if columns[(-1)].strip().startswith('{'):
                            column_count -= 1
                    break
                if (line[:5].upper() == '@DATA'):
                    data_block = True
    dataset.metadata.comment_lines = comment_lines
    dataset.metadata.columns = column_count
