3bf5f2de89807642dcd1e030e45226ff3944779b,common.py,,get_filename,#Any#Any#,20

Before Change


    fname = submission.get("filename", None)
    user = submission.get("username", None)
    if fname and user:
        return "{}/{}".format(user, fname), fname
    return None


def download_submission(db, submission_id):

After Change


    cursor = postgres_db.cursor()
    cursor.execute(query)
    results = cursor.fetchone()
    filename = results[0]
    user_id = results[1]
    query = "SELECT username FROM users WHERE id = "{}"".format(user_id)
    cursor.execute(query)
    username = cursor.fetchone()[0]
    cursor.close()
    return "{}/{}".format(username, filename), filename


def download_submission(postgres_db, submission_id):
    S3_BUCKET = os.environ.get("S3_UPLOAD_BUCKET", "numerai-production-uploads")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: numerai/submission-criteria
Commit Name: 3bf5f2de89807642dcd1e030e45226ff3944779b
Time: 2017-11-10
Author: xander@numer.ai
File Name: common.py
Class Name:
Method Name: get_filename


Project Name: biocore/scikit-bio
Commit Name: c06175c0611f2c6cb44cc6751309306a943abc8c
Time: 2014-09-09
Author: ebolyen@gmail.com
File Name: skbio/tree/_tree.py
Class Name: TreeNode
Method Name: __str__


Project Name: numerai/submission-criteria
Commit Name: 3bf5f2de89807642dcd1e030e45226ff3944779b
Time: 2017-11-10
Author: xander@numer.ai
File Name: database_manager.py
Class Name: DatabaseManager
Method Name: get_date_created