Return the device index in the chain based on prompt.
181445
def get_device_index_based_on_prompt(self, prompt):
        """"""
        conn_info = ""
        for device in self.devices:
            conn_info += str(device) + "->"
            if device.prompt == prompt:
                self.connection.log("Connected: {}".format(conn_info))
                return self.devices.index(device)
        else:
            return None
819961
def get_vm_status(self, device='FLOPPY'):
        """"""
        dic = {'DEVICE': device.upper()}
        data = self._execute_command(
            'GET_VM_STATUS', 'RIB_INFO', 'read', dic)
        return data['GET_VM_STATUS']
153729
def get_device_type(device_type=0):
    """"""
    device_types = {
        0: "Unknown",
        1: "Classic - BR/EDR devices",
        2: "Low Energy - LE-only",
        3: "Dual Mode - BR/EDR/LE"
    }
    if device_type in [0, 1, 2, 3]:
        return_value = device_types[device_type]
    else:
        return_value = device_types[0]
    return return_value
618133
def GetIndex(self):
        '''
        '''
        if self.index is None:
            return None

        if self.index:
            res, ui = chmlib.chm_resolve_object(self.file, self.index)
            if (res != chmlib.CHM_RESOLVE_SUCCESS):
                return None

        size, text = chmlib.chm_retrieve_object(self.file, ui, 0l, ui.length)
        if (size == 0):
            sys.stderr.write('GetIndex: file size = 0\n')
            return None
        return text
531979
def get_device(self):
        
        addr = self.address
        servers = [server for server in pyrax.cloudservers.list()
                if addr in server.networks.get("private", "")]
        try:
            return servers[0]
        except IndexError:
            return None
381002
def device_id(self):
        
        if self.is_block:
            for filename in self._P.Block.Symlinks:
                parts = decode_ay(filename).split('/')
                if parts[-2] == 'by-id':
                    return parts[-1]
        elif self.is_drive:
            return self._assocdrive._P.Drive.Id
        return ''
1241428
def _get_index(n_items, item_size, n):
    """"""
    index = np.arange(n_items)
    index = np.repeat(index, item_size)
    index = index.astype(np.float64)
    assert index.shape == (n,)
    return index
756462
def devid(self):
        
        d = self.device
        vend_id = d.get('ID_VENDOR_ID')
        model_id = d.get('ID_MODEL_ID')
        return (vend_id, model_id)
343452
def get_devices(self):
        
        def process_result(result):
            return [self.get_device(dev) for dev in result]

        return Command('get', [ROOT_DEVICES], process_result=process_result)
1227912
async def device_info():
    """"""
    async with aiohttp.ClientSession() as session:
        ghlocalapi = NetworkScan(LOOP, session)
        result = await ghlocalapi.scan_for_units(IPRANGE)
        print(result)
932973
def get_current_index(self):
        

        # Need to convert to int; currently API returns a tuple of string
        curSel = self.__lb.curselection()
        if curSel and len(curSel) > 0:
            return int(curSel[0])
        else:
            return -1
245464
def device_selected(self, index):
        """"""
        device = self.devicelist_model.itemFromIndex(index)
        print(device.device.addr)
        self.btnConnect.setEnabled(True)
796553
def _get_future_devices(self, context):
        """"""
        monitor = Monitor.from_netlink(context)
        monitor.filter_by("hidraw")
        monitor.start()

        self._scanning_log_message()
        for device in iter(monitor.poll, None):
            if device.action == "add":
                # Sometimes udev rules has not been applied at this point,
                # causing permission denied error if we are running in user
                # mode. With this sleep this will hopefully not happen.
                sleep(1)

                yield device
                self._scanning_log_message()
1281734
def list_devices(self, shop_id=None, page_index=1, page_size=20):
        
        data = optionaldict(
            shop_id=shop_id,
            pageindex=page_index,
            pagesize=page_size
        )
        res = self._post(
            'device/list',
            data=data,
            result_processor=lambda x: x['data']
        )
        return res
648536
def get_xid_device(device_number):
    
    scanner = XidScanner()
    com = scanner.device_at_index(device_number)
    com.open()
    return XidDevice(com)
164598
def get(self, device_id: int) -> Optional[Device]:
        """"""
        return self._devices.get(device_id)
12160
def start_index(self):
        """"""
        paginator = self.paginator
        # Special case, return zero if no items.
        if paginator.count == 0:
            return 0
        elif self.number == 1:
            return 1
        return (
            (self.number - 2) * paginator.per_page + paginator.first_page + 1)