def discover_devices(self):
        neos = self.get()
        existing_devs = []
        for neo in neos:
            if neo._dev:
                neo._mutex.lock()
                existing_devs.append(neo._dev)
                neo._dev = None

        new_neos = []
        dead_neos = neos[:]
        state_reset = False  # Set True after state reset

        try:
            discovered = open_all_devices(existing_devs)
            if 1000 > self._sleep:  # State reset!
                self._sleep = 1000  # Reset sleep time
                state_reset = True
        except ResetStateException as e:
            discovered = e.devices
            self._sleep = 3500  # Increase sleep time

        for dev in discovered:
            for neo in dead_neos[:]:
                if dev.serial == neo.serial and dev.version == neo.version \
                        and dev.device_type == dev.device_type:
                    neo._set_device(dev)
                    neo._mutex.unlock()
                    dead_neos.remove(neo)
                    break
            else:
                new_neos.append(YubiKeyNeo(dev))

        for neo in dead_neos:
            neos.remove(neo)
            neo.removed.emit()
            neo._mutex.unlock()
        if new_neos or dead_neos or state_reset:
            self._mutex.lock()
            self._neos = neos + new_neos
            neos_copy = self._neos[:]
            self._mutex.unlock()
            self.changed.emit(neos_copy)
dataset/ETHPy150Open Yubico/yubikey-neo-manager/neoman/model/neo.py/AvailableNeos.discover_devices/swapped operands of `>`