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

Before Change


file_name = raw_input("Enter a file name: ")  // pick a file you have
count = 0
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)
    sys.exit()

file_stats = os.stat(file_name)
// create a dictionary to hold file info
file_info = {
    "fname": file_name,

After Change


    with open(file_name) as f:
        // 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: 4

Non-data size: 3

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: sony/nnabla
Commit Name: 5aa0e65747cd13c072749cbc7364f61bd149cadf
Time: 2020-03-24
Author: Yuchi.Wen@sony.com
File Name: python/src/nnabla/utils/save.py
Class Name:
Method Name: save


Project Name: recipy/recipy
Commit Name: 27aebd9429cd624a0dada25b9685ffc7af444919
Time: 2016-09-22
Author: michaelj@epcc.ed.ac.uk
File Name: integration_test/process.py
Class Name:
Method Name: execute_and_capture


Project Name: biocore/scikit-bio
Commit Name: c8fc3b5948f9d356cac1e27240fe531437c2d908
Time: 2015-10-06
Author: kestrel.gorlick@gmail.com
File Name: skbio/io/format/blast6.py
Class Name:
Method Name: _blast6_to_data_frame