5a2b9314cd5b3f4da053a3813dceed362b039043,tindetheus/tindetheus.py,,command_line_run,#,578

Before Change


    try:
        with open("config.txt") as f:
            lines = f.readlines()
            facebook_token = lines[0].split(" ")[-1].strip()
            try:
                model_dir = lines[1].split(" ")[-1].strip()
            except:
                model_dir = "20170512-110547"

After Change



def command_line_run():
    // settings to look for
    defaults = {"facebook_token": None,
                "model_dir": "20170512-110547",
                "image_batch": 1000,
                "distance": 5}
    // check for a config file first
    try:
        with open("config.txt") as f:
            lines = f.readlines()
            for line in lines:
                my_line_list = line.split(" ")
                if my_line_list[0] is "image_batch":
                    defaults["image_batch"] = int(my_line_list[2])
                elif my_line_list[0] is "distance":
                    defaults["distance"] = int(my_line_list[2])
                else:
                    defaults[my_line_list[0]] = my_line_list[2]

    except:
        print("No config.txt found")
        print("You must create a config.txt file as specified in the README")
        // create_new_config = input("Would you like us to create a
        // new config.txt file? (y,n) : ")
        // if create_new_config == "y" or create_new_config == "Y":
        //     print("Creating a new config...")
    if defaults["facebook_token"] is None:
        raise("ERROR: No facebook token in config.txt. You must supply a "
              "facebook token in order to use tindetheus!")
    // parse the supplied arguments
    args = parse_arguments(sys.argv[1:], defaults)

    // run the main function with parsed arguments
    main(args, defaults["facebook_token"])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: cjekel/tindetheus
Commit Name: 5a2b9314cd5b3f4da053a3813dceed362b039043
Time: 2018-11-03
Author: cjekel@gmail.com
File Name: tindetheus/tindetheus.py
Class Name:
Method Name: command_line_run


Project Name: pyannote/pyannote-audio
Commit Name: abbfdc5b04ec1824e42cebb472626d234ff7bd36
Time: 2017-01-09
Author: bredin@limsi.fr
File Name: scripts/speaker_embedding.py
Class Name:
Method Name: tune


Project Name: pyannote/pyannote-audio
Commit Name: abbfdc5b04ec1824e42cebb472626d234ff7bd36
Time: 2017-01-09
Author: bredin@limsi.fr
File Name: scripts/speaker_embedding.py
Class Name:
Method Name: test