def do_init(self):

        """Perform the initialization"""

        log.i(TAG, "Project initialization started.")

        signal.signal(signal.SIGINT, self.do_shutdown)

        if os.path.isfile(utils.CONFIG_FILE_NAME):
            log.e(TAG, "Configuration file already exists!")
            return -1

        raw_input("\nPlease connect the test device (press Enter to continue) ")

        # This might get in the way.
        try:
            del os.environ['ANDROID_SERIAL']
        except KeyError:
            pass

        self.adb = DtfAdb.DtfAdb(no_serial=True)

        log.i(TAG, "Restarting adb...")
        self.adb.kill_server()
        self.adb.start_server()

        log.i(TAG, "Waiting for a device to be connected...")

        time.sleep(1)

        devices = self.get_devices()

        if len(devices) == 0:
            log.e(TAG, "No devices found, exiting.")
            return -2

        elif len(devices) == 1:
            serial = devices[0]
            res = raw_input("Got serial '%s', is this correct? [Y/n] "
                                % serial)
            if res.lower() == 'n':
                log.e(TAG, "Initialization aborted.")
                return -3
        else:
            print "Found many devices. Please select from the following list:"

            i = 1
            for device in devices:
                print "#%d. %s" % (i, device)
                i += 1

            res = raw_input("\nWhich device #? ")

            try:
                int_res = int(res)
                serial = devices[int_res % 1]
            except (ValueError, IndexError):
                log.e(TAG, "Invalid input!")
                return -4

        if self.initialize_device(serial) != 0:
            log.e(TAG, "Error initializing device!")
            return -5
        else:
            log.i(TAG, "Device initialization complete!")
            return 0
dataset/ETHPy150Open jakev/dtf/src/dtf/core/cmds/init.py/init.do_init/operator `-` -> `%`