1e56357baee99a5fa02d54df0db476c58258ffbf,plantcv-pipeline.py,,db_connect,#Any#,368

Before Change



    if not args.create:
        // Get the last run ID
        for row in args.sq.execute("SELECT MAX(run_id) AS max FROM runinfo"):
            if row["max"] is not None:
                args.run_id = row["max"]

        // Get the last run ID
        for row in args.sq.execute("SELECT MAX(image_id) AS max FROM metadata"):
            if row["max"] is not None:
                args.image_id = row["max"]

After Change



    // Delete the existing database if create is true
    if args.create:
        if os.path.isfile(args.db):
            os.remove(args.db)

    if os.path.isfile(args.db):
        args.connect = sqlite3.connect(args.db)
        // Replace the row_factory result constructor with a dictionary constructor
        args.connect.row_factory = dict_factory
        // Change the text output format from unicode to UTF-8
        args.connect.text_factory = str
        // Database handler
        args.sq = args.connect.cursor()

        for row in args.sq.execute("SELECT MAX(run_id) AS max FROM runinfo"):
            if row["max"] is not None:
                args.run_id = row["max"]

        // Get the last run ID
        for row in args.sq.execute("SELECT MAX(image_id) AS max FROM metadata"):
            if row["max"] is not None:
                args.image_id = row["max"]

    if os.path.isfile(args.db)==False:
        // Connect to the database
        args.connect = sqlite3.connect(args.db)
        // Replace the row_factory result constructor with a dictionary constructor
        args.connect.row_factory = dict_factory
        // Change the text output format from unicode to UTF-8
        args.connect.text_factory = str
        // Database handler
        args.sq = args.connect.cursor()
        // Run and image IDs
        args.run_id = 0
        args.image_id = 0

    return args


//////////////////////////////////////////////////////////////////////////////////////
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: danforthcenter/plantcv
Commit Name: 1e56357baee99a5fa02d54df0db476c58258ffbf
Time: 2017-02-03
Author: mgehan@danforthcenter.org
File Name: plantcv-pipeline.py
Class Name:
Method Name: db_connect


Project Name: dPys/PyNets
Commit Name: 74c014b048f6e4df6780bb767702a852b1beba1c
Time: 2020-03-05
Author: dpisner@utexas.edu
File Name: pynets/dmri/dmri_utils.py
Class Name:
Method Name: make_gtab_and_bmask


Project Name: danforthcenter/plantcv
Commit Name: 4bd9e98e3a538f9ef3676db3f2f3947de138e256
Time: 2017-02-20
Author: maxjfeldman@gmail.com
File Name: plantcv-pipeline.py
Class Name:
Method Name: db_connect


Project Name: danforthcenter/plantcv
Commit Name: 1e56357baee99a5fa02d54df0db476c58258ffbf
Time: 2017-02-03
Author: mgehan@danforthcenter.org
File Name: plantcv-pipeline.py
Class Name:
Method Name: db_connect