Get number of devices
184525
def num_devices(self):
        
        c_count = c_uint()
        _check_return(_NVML.get_function(
            "nvmlDeviceGetCount_v2")(byref(c_count)))
        return c_count.value
1186040
def desc(self):
        """"""
        return '{0} (ID: {1}) - {2} - {3}'.format(
            self.name, self.device_id, self.type, self.status)
829342
def scan(self):
        """"""
        devices = []
        diff = 65
        rom = False
        count = 0
        for _ in range(0xff):
            rom, diff = self._search_rom(rom, diff)
            if rom:
                count += 1
                if count > self.maximum_devices:
                    raise RuntimeError(
                        "Maximum device count of {} exceeded."\
                        .format(self.maximum_devices))
                devices.append(OneWireAddress(rom))
            if diff == 0:
                break
        return devices
1149693
def _check_device_number(self, devices):
        '''
        '''

        if len(devices) < 2 or len(devices) > 4:
            msg = 'The number of devices to cluster is not supported.'
            raise ClusterNotSupported(msg)
505359
def list_devices(names=None, continue_from=None, **kwargs):
    """"""

    if not names:
        names = [device for device, _type in settings.GOLDEN_DEVICES if _type == 'OpenThread']

    if continue_from:
        continue_from = names.index(continue_from)
    else:
        continue_from = 0

    for port in names[continue_from:]:
        try:
            with OpenThreadController(port) as otc:
                print('%s: %s' % (port, otc.version))
        except:
            logger.exception('failed to get version of %s' % port)
236139
def get_device(self, device_id, refresh=False):
        """"""
        if self._devices is None:
            self.get_devices()
            refresh = False

        device = self._devices.get(device_id)

        if device and refresh:
            device.refresh()

        return device
401090
def devices(self):
        
        devices = None
        with self.socket.Connect():
            devices = self._command("host:devices")

        return parse_device_list(devices)
831759
def _get_serial_number(self):
        
        return usb.util.get_string(self._device.usb_dev, 64, self._device.usb_dev.iSerialNumber)
1227282
def list_devices():
    
    output = {}
    for device_id, device in devices.items():
        output[device_id] = {
            'host': device.host,
            'state': device.state
        }
    return jsonify(devices=output)
335593
def get_device_names(self):
        """"""
        dev_names = {}
        for device in self.get_device_ids():
            dev_names[device] = self.get_device_name(device)
        return dev_names
1294350
def get_device_info(self, bigip):
        '''
        '''

        coll = bigip.tm.cm.devices.get_collection()
        device = [device for device in coll if device.selfDevice == 'true']
        assert len(device) == 1
        return device[0]
1308000
def _get_setup(self, result):
        """"""
        self.__devices = {}

        if ('setup' not in result.keys() or
                'devices' not in result['setup'].keys()):
            raise Exception(
                "Did not find device definition.")

        for device_data in result['setup']['devices']:
            device = Device(self, device_data)
            self.__devices[device.url] = device

        self.__location = result['setup']['location']
        self.__gateway = result['setup']['gateways']
333040
def listDevices(self, interface_id):
        """"""
        LOG.debug("RPCFunctions.listDevices: interface_id = %s, _devices_raw = %s" % (
            interface_id, str(self._devices_raw)))
        remote = interface_id.split('-')[-1]
        if remote not in self._devices_raw:
            self._devices_raw[remote] = []
        if self.systemcallback:
            self.systemcallback('listDevices', interface_id)
        return self._devices_raw[remote]
883123
def devices(self):
        ''
        return self.fs is not None and [JFSDevice(d, self, parentpath=self.rootpath) for d in self.fs.devices.iterchildren()] or [x for x in []]
583365
async def device_info():
    """"""
    async with aiohttp.ClientSession() as session:
        ghlocalapi = DeviceInfo(LOOP, session, IPADDRESS)
        await ghlocalapi.get_device_info()

        print("Device info:", ghlocalapi.device_info)
244558
def parse_devices(self):
        """"""
        devices = []
        for device in self._channel_dict["devices"]:
            devices.append(Device(device, self._is_sixteen_bit, self._ignore_list))
        return devices
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