49d41416e440926f0a9a8243b4d77f6f5468efe9,app/server/utils.py,JsonHandler,parse,#JsonHandler#Any#,242

Before Change


        for i, line in enumerate(file, start=1):
            try:
                j = json.loads(line)
                j["meta"] = json.dumps(j.get("meta", {}))
                yield j
            except json.decoder.JSONDecodeError:
                raise FileParseException(line_num=i, line=line)

After Change


    def parse(self, file):
        file = io.TextIOWrapper(file, encoding="utf-8")
        while True:
            batch = list(itertools.islice(file, IMPORT_BATCH_SIZE))
            if not batch:
                raise StopIteration
            yield [{"text": line.strip()} for line in batch]


class CSVParser(FileParser):
    Uploads csv file.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: chakki-works/doccano
Commit Name: 49d41416e440926f0a9a8243b4d77f6f5468efe9
Time: 2019-03-12
Author: light.tree.1.13@gmail.com
File Name: app/server/utils.py
Class Name: JsonHandler
Method Name: parse


Project Name: okfn-brasil/serenata-de-amor
Commit Name: e4d5b98f9d2ef79279300d1074cbaacde8e816dc
Time: 2016-11-20
Author: cuducos@gmail.com
File Name: src/fetch_sex_places.py
Class Name:
Method Name: sex_places_neraby


Project Name: pantsbuild/pants
Commit Name: 2d515b55b25a62b1f5961955e977e2fce4ae511e
Time: 2015-10-06
Author: stuhood@gmail.com
File Name: src/python/pants/backend/jvm/tasks/junit_run.py
Class Name: _JUnitRunner
Method Name: _calculate_tests_from_targets