9fd70d1acbe56f009fd8bcbac94f97e615983300,torchtext/data/example.py,Example,fromCSV,#Any#Any#Any#,38

Before Change


        if six.PY2:
            data = data.encode("utf-8")
        // Use Python CSV module to parse the CSV line
        parsed_csv_lines = csv.reader([data])

        // If Python 2, decode back to unicode (the original input format).
        if six.PY2:
            for line in parsed_csv_lines:
                parsed_csv_line = [six.text_type(col, "utf-8") for col in line]
                break
        else:
            parsed_csv_line = list(parsed_csv_lines)[0]
        return cls.fromlist(parsed_csv_line, fields)

    @classmethod
    def fromlist(cls, data, fields):
        ex = cls()

After Change



    @classmethod
    def fromCSV(cls, data, fields):
        if data[-1] == "\n":
            data = data[:-1]
        return cls.fromlist(list(csv.reader([data]))[0], fields)

    @classmethod
    def fromlist(cls, data, fields):
        ex = cls()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: pytorch/text
Commit Name: 9fd70d1acbe56f009fd8bcbac94f97e615983300
Time: 2017-09-07
Author: jekbradbury@gmail.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromCSV


Project Name: pytorch/text
Commit Name: 3aa4d13e15bea9a6bca68a4261b50c433400eb6e
Time: 2017-09-07
Author: nelson-liu@users.noreply.github.com
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromCSV


Project Name: pytorch/text
Commit Name: 7c3b1d311bb6e1dcfb5e0929a9fc93b22af2acf4
Time: 2017-09-07
Author: nfliu@cs.washington.edu
File Name: torchtext/data/example.py
Class Name: Example
Method Name: fromCSV