f8d97b8a228504adc12a2286c62f0fd7827a3a3c,Projects/BasicRobotControl/runnable.py,,Main,#,31

Before Change


        // keeps the CPU time low
        sleep(0.05)

    if successful_exit is True:
        // on success
        exit(0)
    else:
        // on failure
        exit(1)

if __name__ == "__main__":
    Main()

After Change


    successful_exit = True
    refresh_rate = 20.0

    with Input(keynames = "curtsies", sigint_event = True) as input_generator:
        while True:
            period = 1 / refresh_rate
            // if nothing is captured in [period] seconds
            // then send() function returns None
            key = input_generator.send(period)

            // if we"ve captured something from the keyboard
            if key is not None:
                result = gopigo3.executeKeyboardJob(key)

                if result == "exit":
                    break

            // if we haven"t captured anything
            // and if the robot is set to manual_mode
            // then stop the robot from moving as soon as the key(s)
            // for moving (the robot around) are released
            elif manual_mode is True and result == "moving":
                gopigo3.executeKeyboardJob("x")


if __name__ == "__main__":
    // set up a handler for ignoring the Ctrl+Z commands
    signal.signal(signal.SIGTSTP, lambda signum, frame : print("Press the appropriate key for closing the app."))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: DexterInd/GoPiGo3
Commit Name: f8d97b8a228504adc12a2286c62f0fd7827a3a3c
Time: 2017-07-20
Author: robert.lucian.chiriac@gmail.com
File Name: Projects/BasicRobotControl/runnable.py
Class Name:
Method Name: Main


Project Name: DexterInd/GoPiGo3
Commit Name: 1fb289b0de21ec00d28046eff88d6da8f4c15319
Time: 2017-07-21
Author: robert.lucian.chiriac@gmail.com
File Name: Projects/BasicRobotControl/runnable.py
Class Name:
Method Name: Main


Project Name: google/language-resources
Commit Name: 9030040028a1b220d7b1dd0f7876a5ddd0879bec
Time: 2017-11-12
Author: mjansche@google.com
File Name: utils/phonology_json_validator.py
Class Name:
Method Name: main