d9f6e28568406c162b79f582ae037a89a3118d26,prep_model.py,,post_process,#,67

Before Change


    
    with open(log_file_path, "r") as f:
        log_file_tail = f.read().splitlines()[log_line_num]
    top5_err = re.findall(r"\d+\.\d+", re.findall(r", err-top5=\d+\.\d+", log_file_tail)[0])[0].split(".")[1]

    sha1_value = calc_sha1(model_file_path)

    dst_model_file_name = "{}-{}-{}.{}".format(model_name, top5_err, sha1_value[:8], dst_model_file_ext)
    dst_model_file_path = os.path.join(dst_dir_path, dst_model_file_name)
    os.rename(model_file_path, dst_model_file_path)
    os.rename(log_file_path, dst_model_file_path + ".log")

After Change


    
    with open(log_file_path, "r") as f:
        log_file_tail = f.read().splitlines()[log_line_num]
    err5_str = re.findall(r", err-top5=\d+\.\d+", log_file_tail)
    if len(err5_str) != 0:
        top5_err = re.findall(r"\d+\.\d+", err5_str[0])[0].split(".")[1]
    else:
        with open(log_file_path, "r") as f:
            log_file_tail = f.read().splitlines()[log_line_num - 1]
        err5_str = re.findall(r", err-top5=\d+\.\d+", log_file_tail)
        top5_err = re.findall(r"\d+\.\d+", err5_str[0])[0].split(".")[1]

    sha1_value = calc_sha1(model_file_path)

    dst_model_file_name = "{}-{}-{}.{}".format(model_name, top5_err, sha1_value[:8], dst_model_file_ext)
    dst_model_file_path = os.path.join(dst_dir_path, dst_model_file_name)
    os.rename(model_file_path, dst_model_file_path)
    os.rename(log_file_path, dst_model_file_path + ".log")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: osmr/imgclsmob
Commit Name: d9f6e28568406c162b79f582ae037a89a3118d26
Time: 2021-02-16
Author: osemery@gmail.com
File Name: prep_model.py
Class Name:
Method Name: post_process


Project Name: acl-org/acl-anthology
Commit Name: e17e429183b6cffaf25a525ceb9834c5da86d7f2
Time: 2020-07-03
Author: post@cs.jhu.edu
File Name: bin/ingest.py
Class Name:
Method Name: main


Project Name: acl-org/acl-anthology
Commit Name: da3203cb47df1c583452f671c8e9600214925ff2
Time: 2019-05-30
Author: post@cs.jhu.edu
File Name: bin/add_attachment.py
Class Name:
Method Name: main