Search all of the capabilities of the device and return the supported binary state field.
        Default to returning powered.
504393
def binary_state_name(self):
        
        return_field = "powered"
        _capabilities = self.json_state.get('capabilities')
        if _capabilities is not None:
            _fields = _capabilities.get('fields')
            if _fields is not None:
                for field in _fields:
                    if field.get('field') in SUPPORTED_BINARY_STATE_FIELDS:
                        return_field = field.get('field')
        return return_field
1194416
def async_get_ac_states(self, uid, limit=1, offset=0, fields='*'):
        """"""
        return (yield from self._get('/pods/{}/acStates'.format(uid),
                                     limit=limit,
                                     fields=fields,
                                     offset=offset))
678599
def devices(self):
        
        data = self.query(MyPlexDevice.key)
        return [MyPlexDevice(self, elem) for elem in data]
291834
def _get_capabilities_from_driver_type(driver_name):
        
        if driver_name == 'firefox':
            return DesiredCapabilities.FIREFOX.copy()
        elif driver_name == 'chrome':
            return DesiredCapabilities.CHROME.copy()
        elif driver_name == 'safari':
            return DesiredCapabilities.SAFARI.copy()
        elif driver_name == 'opera':
            return DesiredCapabilities.OPERA.copy()
        elif driver_name == 'iexplore':
            return DesiredCapabilities.INTERNETEXPLORER.copy()
        elif driver_name == 'edge':
            return DesiredCapabilities.EDGE.copy()
        elif driver_name == 'phantomjs':
            return DesiredCapabilities.PHANTOMJS.copy()
        elif driver_name in ('android', 'ios', 'iphone'):
            return {}
        raise Exception('Unknown driver {0}'.format(driver_name))
1324770
def get_state(self, force_update=False):
        
        # The base implementation using GetBinaryState doesn't work for Maker (always returns 0).
        # So pull the switch state from the atrributes instead
        if force_update or self._state is None:
            return(int(self.maker_attribs.get('switchstate',0)))
        return self._state
793568
def get_supported_boot_mode(self):
        
        system = self._get_host_details()
        bios_uefi_class_val = 0  # value for bios_only boot mode
        if ('Bios' in system['Oem']['Hp'] and
                'UefiClass' in system['Oem']['Hp']['Bios']):
            bios_uefi_class_val = (system['Oem']['Hp']
                                         ['Bios']['UefiClass'])
        return mappings.GET_SUPPORTED_BOOT_MODE_RIS_MAP.get(
            bios_uefi_class_val)
170573
def get_state(self, **kwargs):
        ""
        state = {'x_cls':self.x.__class__, 'x_proc':self.x.processor,
                 'y_cls':self.y.__class__, 'y_proc':self.y.processor,
                 'tfms':self.tfms, 'tfm_y':self.tfm_y, 'tfmargs':self.tfmargs}
        if hasattr(self, 'tfms_y'):    state['tfms_y']    = self.tfms_y
        if hasattr(self, 'tfmargs_y'): state['tfmargs_y'] = self.tfmargs_y
        return {**state, **kwargs}
1285452
def _get_tpm_capability(self):
        
        tpm_values = {"NotPresent": False,
                      "PresentDisabled": True,
                      "PresentEnabled": True}
        try:
            tpm_state = self._get_bios_setting('TpmState')
        except exception.IloCommandNotSupportedError:
            tpm_state = "NotPresent"
        tpm_result = tpm_values[tpm_state]
        return tpm_result
1212704
def is_capable(cls, requested_capability):
        
        for c in requested_capability:
            if not c in cls.capability:
                return False
        return True
337584
def get_power_state(self, userid):
        """"""
        LOG.debug('Querying power stat of %s' % userid)
        requestData = "PowerVM " + userid + " status"
        action = "query power state of '%s'" % userid
        with zvmutils.log_and_reraise_smt_request_failed(action):
            results = self._request(requestData)
        with zvmutils.expect_invalid_resp_data(results):
            status = results['response'][0].partition(': ')[2]
        return status
1080236
def which(self):
        

        if self.binary is None:
            return None

        return which(self.binary, path=self.env_path)
846410
def registered_capabilities(self):
        
        return dict ([ (CAPABILITIES[c.id],c) for c in self.capabilities
                 if c.id in CAPABILITIES ])
426214
def state(self):
        
        # Check if device is disconnected.
        if not self.available:
            return STATE_UNKNOWN
        # Check if device is off.
        if not self.screen_on:
            return STATE_OFF
        # Check if screen saver is on.
        if not self.awake:
            return STATE_IDLE
        # Check if the launcher is active.
        if self.launcher or self.settings:
            return STATE_STANDBY
        # Check for a wake lock (device is playing).
        if self.wake_lock:
            return STATE_PLAYING
        # Otherwise, device is paused.
        return STATE_PAUSED
1242141
def devices(opts=[]):
    
    adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_DEVICES, _convert_opts(opts)]
    return _exec_command(adb_full_cmd)
571878
def set_state(self, state):
        
        if self.index() == 0:
            values = {"outlets": [{"desired_state": {"powered": state}}, {}]}
        else:
            values = {"outlets": [{}, {"desired_state": {"powered": state}}]}

        response = self.api_interface.set_device_state(self, values, id_override=self.parent_id(),
                                                       type_override="powerstrip")
        self._update_state_from_response(response)
1001664
def get_server_capabilities(self):
        
        capabilities = {}
        data = self.get_host_health_data()
        ilo_firmware = self._get_ilo_firmware_version(data)
        if ilo_firmware:
            capabilities.update(ilo_firmware)
        rom_firmware = self._get_rom_firmware_version(data)
        if rom_firmware:
            capabilities.update(rom_firmware)
        capabilities.update({'server_model': self.get_product_name()})
        capabilities.update(self._get_number_of_gpu_devices_connected(data))
        boot_modes = common.get_supported_boot_modes(
            self.get_supported_boot_mode())
        capabilities.update({
            'boot_mode_bios': boot_modes.boot_mode_bios,
            'boot_mode_uefi': boot_modes.boot_mode_uefi})
        return capabilities
1247998
def set_state(self, state):
        
        desired_state = {"desired_state": {"powered": state}}
        response = self.api_interface.set_device_state(self, desired_state)
        self._update_state_from_response(response)