791e09b24641b6d372ba08c59b6b801440c767b2,fileinfo.py,,,#,19

Before Change


if sys.version_info >= (3, 0):
    raw_input = input

try_count = 16

while try_count:
    file_name = raw_input("Enter a file name: ")      // pick a file you have
    fhand = open(file_name)
    count = 0
    for lines in fhand:
        count = count + 1
    fhand = open(file_name)
    inp = fhand.read()
    t_char = len(inp) 
    try_count >>= 1
    try:
        file_stats = os.stat(file_name)

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

Frequency: 3

Non-data size: 7

Instances


Project Name: geekcomputers/Python
Commit Name: 791e09b24641b6d372ba08c59b6b801440c767b2
Time: 2019-08-14
Author: 35282147+Hong199@users.noreply.github.com
File Name: fileinfo.py
Class Name:
Method Name:


Project Name: pantsbuild/pants
Commit Name: 6101d42a47f4dca09a862090f7665bf83373f9d8
Time: 2013-07-29
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/tasks/nailgun_task.py
Class Name: NailgunTask
Method Name: _await_nailgun_server


Project Name: pantsbuild/pants
Commit Name: 7dcc1b532d21e47c98ba2422cab7d48360149f89
Time: 2013-10-06
Author: benjyw@gmail.com
File Name: src/python/twitter/pants/tasks/nailgun_task.py
Class Name: NailgunTask
Method Name: _await_nailgun_server