3aa4d13e15bea9a6bca68a4261b50c433400eb6e,torchtext/data/example.py,Example,fromCSV,#Any#Any#Any#,34

Before Change


    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):

After 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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


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


Project Name: biocore/scikit-bio
Commit Name: 8f30b61898a2cf9ac07eab30382e698dd5b4d7e4
Time: 2015-12-17
Author: ebolyen@gmail.com
File Name: skbio/io/registry.py
Class Name: IORegistry
Method Name: _read_gen