Obtains the unique path for the device.

  Args:
    device_handle: reference to the device

  Returns:
    A unique path for the device, obtained from the IO Registry
545092
def GetDevicePath(device_handle):
  
  # Obtain device path from IO Registry
  io_service_obj = iokit.IOHIDDeviceGetService(device_handle)
  str_buffer = ctypes.create_string_buffer(DEVICE_PATH_BUFFER_SIZE)
  iokit.IORegistryEntryGetPath(io_service_obj, K_IO_SERVICE_PLANE, str_buffer)

  return str_buffer.value
1233375
def get_device(self, device_id):
        
        api = self._get_api(device_directory.DefaultApi)
        return Device(api.device_retrieve(device_id))
159680
def get_hosting_device_config(self, client, hosting_device_id):
        """"""
        return client.get((self.resource_path + HOSTING_DEVICE_CONFIG) %
                          hosting_device_id)
1339031
def GetSubkeyByPath(self, key_path):
    
    pyregf_key = self._pyregf_key.get_sub_key_by_path(key_path)
    if not pyregf_key:
      return None

    key_path = key_paths.JoinKeyPath([self._key_path, key_path])
    return REGFWinRegistryKey(pyregf_key, key_path=key_path)
427027
def _new_device_id(self, key):
        
        device_id = Id.SERVER + 1
        if key in self._key2deviceId:
            return self._key2deviceId[key]
        while device_id in self._clients:
            device_id += 1
        return device_id
1185542
def device_id_from_name(device_name, nodes):
        
        device_id = None
        for node in nodes:
            if device_name == node['properties']['name']:
                device_id = node['id']
                break
        return device_id
162128
def get_device(name, device_dict, loader, resource_dict):
    
    device = Device(name, device_dict.get('delimiter', ';').encode('utf-8'))

    device_dict = get_bases(device_dict, loader)

    err = device_dict.get('error', {})
    device.add_error_handler(err)

    for itype, eom_dict in device_dict.get('eom', {}).items():
        device.add_eom(itype, *_get_pair(eom_dict))

    update_component(name, device, device_dict)

    for ch_name, ch_dict in device_dict.get('channels', {}).items():
        device.add_channels(ch_name, get_channel(device, ch_name, ch_dict,
                                                 loader, resource_dict))

    return device
644454
def get_device_opts(opts, salt_obj=None):
    '''
    
    '''
    network_device = {}
    # by default, look in the proxy config details
    device_dict = opts.get('proxy', {}) if is_proxy(opts) else opts.get('napalm', {})
    if opts.get('proxy') or opts.get('napalm'):
        opts['multiprocessing'] = device_dict.get('multiprocessing', False)
        # Most NAPALM drivers are SSH-based, so multiprocessing should default to False.
        # But the user can be allows one to have a different value for the multiprocessing, which will
        #   override the opts.
    if not device_dict:
        # still not able to setup
        log.error('Incorrect minion config. Please specify at least the napalm driver name!')
    # either under the proxy hier, either under the napalm in the config file
    network_device['HOSTNAME'] = device_dict.get('host') or \
                                 device_dict.get('hostname') or \
                                 device_dict.get('fqdn') or \
                                 device_dict.get('ip')
    network_device['USERNAME'] = device_dict.get('username') or \
                                 device_dict.get('user')
    network_device['DRIVER_NAME'] = device_dict.get('driver') or \
                                    device_dict.get('os')
    network_device['PASSWORD'] = device_dict.get('passwd') or \
                                 device_dict.get('password') or \
                                 device_dict.get('pass') or \
                                 ''
    network_device['TIMEOUT'] = device_dict.get('timeout', 60)
    network_device['OPTIONAL_ARGS'] = device_dict.get('optional_args', {})
    network_device['ALWAYS_ALIVE'] = device_dict.get('always_alive', True)
    network_device['PROVIDER'] = device_dict.get('provider')
    network_device['UP'] = False
    # get driver object form NAPALM
    if 'config_lock' not in network_device['OPTIONAL_ARGS']:
        network_device['OPTIONAL_ARGS']['config_lock'] = False
    if network_device['ALWAYS_ALIVE'] and 'keepalive' not in network_device['OPTIONAL_ARGS']:
        network_device['OPTIONAL_ARGS']['keepalive'] = 5  # 5 seconds keepalive
    return network_device
951399
def device_slug_to_id(slug):
    

    if not isinstance(slug, str):
        raise ArgumentError("Invalid device slug that is not a string", slug=slug)

    try:
        device_slug = IOTileDeviceSlug(slug, allow_64bits=False)
    except ValueError:
        raise ArgumentError("Unable to recognize {} as a device id".format(slug))

    return device_slug.get_id()
290205
def get(cls, device_id, custom_headers=None):
        

        if custom_headers is None:
            custom_headers = {}

        api_client = client.ApiClient(cls._get_api_context())
        endpoint_url = cls._ENDPOINT_URL_READ.format(device_id)
        response_raw = api_client.get(endpoint_url, {}, custom_headers)

        return BunqResponseDevice.cast_from_bunq_response(
            cls._from_json(response_raw)
        )
325329
function getRelayHandleKey(
  handleName: string,
  key: ?string,
  fieldName: ?string,
): string {
  if (key && key !== DEFAULT_HANDLE_KEY) {
    return `__${key}_${handleName}`;
  }

  invariant(
    fieldName != null,
    'getRelayHandleKey: Expected either `fieldName` or `key` in `handle` to be provided',
  );
  return `__${fieldName}_${handleName}`;
}
792684
def get(self, dev_id):
        """"""
        path = '/'.join(['device', dev_id])
        return self.rachio.get(path)
570187
def getTrackedDeviceIndexForControllerRole(self, unDeviceType):
        """"""

        fn = self.function_table.getTrackedDeviceIndexForControllerRole
        result = fn(unDeviceType)
        return result
140858
def hid_device_path_exists(device_path, guid = None):
    
    # expecing HID devices
    if not guid:
        guid = winapi.GetHidGuid()

    info_data         = winapi.SP_DEVINFO_DATA()
    info_data.cb_size = sizeof(winapi.SP_DEVINFO_DATA)

    with winapi.DeviceInterfaceSetInfo(guid) as h_info:
        for interface_data in winapi.enum_device_interfaces(h_info, guid):
            test_device_path = winapi.get_device_path(h_info,
                    interface_data,
                    byref(info_data))
            if test_device_path == device_path:
                return True
    # Not any device now with that path
    return False
97209
def get_device_address(usb_device):
        
        try:
            usb_device.ctrl_transfer(0x21, 0x09, 0x0300, 0, GrizzlyUSB.COMMAND_GET_ADDR)
            internal_addr = usb_device.ctrl_transfer(0xa1, 0x01, 0x0301, 0, 2)[1]
            return internal_addr >> 1
        except usb.USBError as e:
            return GrizzlyUSB.USB_DEVICE_ERROR
450688
def getDevice(self, **kwargs): 
        
        filterchain = self.get(**kwargs)
        
        if not filterchain:
            return None
        
        # get filterchain init parameters that are compatible with RTSPCameraDevice input parameters
        pars = filterchain.getParDic(DataModel.RTSPCameraDevice.parameter_defs) 
        # .. and instantiate an RTSPCameraDevice with those parameters
        device = DataModel.RTSPCameraDevice(**pars)
        
        print(self.pre, "getDevice :", pars, device)
        
        return device
190563
def get_stream_handle(stream=sys.stdout):
    
    handle = stream
    if os.name == "nt":
        from ctypes import windll

        handle_id = WIN_STDOUT_HANDLE_ID
        handle = windll.kernel32.GetStdHandle(handle_id)
    return handle