7c977cb5f370d2e8a8ceda762f8d22a3c668e8f0,fileinfo.py,,,#,20

Before Change


t_char = 0
try:
    with open(file_name) as f:
        line = f.readline()
        t_char += len(line)
        while line:
            count += 1
            line = f.readline()
            t_char += len(line)
except FileNotFoundError as e:
    print(e)

After Change


        // Source: https://stackoverflow.com/a/1019572
        count = (sum(1 for line in f))
        f.seek(0)
        t_char = (sum([len(line) for line in f]))
except FileNotFoundError as e:
    print(e)
    sys.exit(1)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: geekcomputers/Python
Commit Name: 7c977cb5f370d2e8a8ceda762f8d22a3c668e8f0
Time: 2020-03-22
Author: alopex4@163.com
File Name: fileinfo.py
Class Name:
Method Name:


Project Name: stanfordnlp/stanza
Commit Name: ae1a7796a3df1add1ee420467afea82bde8bd44c
Time: 2018-06-07
Author: zyh@stanford.edu
File Name: models/lemma/loader.py
Class Name: DataLoader
Method Name: load_file


Project Name: estnltk/estnltk
Commit Name: 158e4cb12d7ab478ea230e099a18644b2ac2bd17
Time: 2015-07-01
Author: tpetmanson@gmail.com
File Name: estnltk/corpus.py
Class Name:
Method Name: read_json_corpus