eb09eb97d28c918756c12a8960d5daa85d098abc,app/server/api.py,CSVHandler,parse,#CSVHandler#Any#,354

Before Change


        reader = csv.reader(file)
        columns = None
        for i, row in enumerate(reader, start=1):
            if i == 1:                           // skip header
                columns = row
                continue
            elif len(row) == len(columns) == 2:  // text with a label
                text, label = row
                yield text, label
            else:
                raise FileParseException(line_num=i, line=row)

    def render(self):
        raise NotImplementedError()

After Change


        for i, row in enumerate(reader, start=2):
            if len(row) == len(columns) and len(row) >= 2:
                text, label = row[:2]
                meta = json.dumps(dict(zip(columns[2:], row[2:])))
                data = {"text": text, "meta": meta}
                yield data, label
            else:
                raise FileParseException(line_num=i, line=row)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: chakki-works/doccano
Commit Name: eb09eb97d28c918756c12a8960d5daa85d098abc
Time: 2019-03-06
Author: light.tree.1.13@gmail.com
File Name: app/server/api.py
Class Name: CSVHandler
Method Name: parse


Project Name: pantsbuild/pants
Commit Name: 91cdde2ef79e87a9cb0d80cb55769bc23dc271cc
Time: 2014-08-19
Author: john.sirois@gmail.com
File Name: src/python/pants/backend/jvm/tasks/dependencies.py
Class Name: Dependencies
Method Name: console_output


Project Name: mathics/Mathics
Commit Name: f592ce49086098fe835de68a7ee7bf49967b14ad
Time: 2016-08-22
Author: Bernhard.Liebl@gmx.org
File Name: mathics/algorithm/clusters.py
Class Name:
Method Name: _shuffled_range