Private: Creates a device

 name    - The device name
 address - The device address

 Returns nothing
500569
def create_device(name, address, type)
      Device.new(
        name:     name.gsub(/\u00a0/, ' '),
        address:  address,
        type:     type
      )
    end
499324
def get_device_name(file_name, sys_obj_id, delimiter=":"):
    

    try:
        with open(file_name, "rb") as csv_file:
            csv_reader = csv.reader(csv_file, delimiter=delimiter)
            for row in csv_reader:
                if len(row) >= 2 and row[0] == sys_obj_id:
                    return row[1]
    except IOError:
        pass  # file does not exists

    return sys_obj_id
60998
def sethostname(name):
    """"""
    # TODO: replace with socket.sethostname, which is available from Python 3.3
    name = name.encode()
    _libc.sethostname(name, len(name))
1365854
def name(device, partition, name):
    '''
    
    '''
    _validate_device(device)

    try:
        int(partition)
    except Exception:
        raise CommandExecutionError(
            'Invalid partition passed to partition.name'
        )

    valid = string.ascii_letters + string.digits + ' _-'
    for letter in name:
        if letter not in valid:
            raise CommandExecutionError(
                'Invalid characters passed to partition.name'
            )

    cmd = '''parted -m -s {0} name {1} "'{2}'"'''.format(device, partition, name)
    out = __salt__['cmd.run'](cmd).splitlines()
    return out
563555
public URL copyWithDevice(String deviceAddress, String attrName, String attrValue) {
        return new URL(this.protocol, this.adapterAddress, deviceAddress, Collections.singletonMap(attrName, attrValue),
                this.serviceUUID, this.characteristicUUID, this.fieldName);
    }
554864
def bootdevice(device, reboot = false, persistent = false)
      if config.bootdevices.include?(device)
        bootstatus = config.bootdevice(device, persistent)
        power.cycle if reboot && bootstatus
      else
        logger.error("Device with name: #{device} is not a valid boot device for host #{options['hostname']}") if logger
        raise "Device with name: #{device} is not a valid boot device for host #{options['hostname']}"
      end
    end
1116331
def add_x10_device(self, housecode, unitcode, feature='OnOff'):
        
        device = insteonplm.devices.create_x10(self, housecode,
                                               unitcode, feature)
        if device:
            self.devices[device.address.id] = device
        return device
1095031
def get_device_ip(device)
      ip_addr = device_config_show(device).lines("\n").grep(/IP Address/).shift
      return nil unless ip_addr
      ip_addr.strip.split.last
    end
172626
def interface_by_name(self, name):
        '''
        
        '''
        if name in self._devinfo:
            return self._devinfo[name]
        raise KeyError("No device named {}".format(name))
227533
def sysname(self):
		

		pchar = self._libinput.libinput_device_get_sysname(self._handle)
		return string_at(pchar).decode()
1142983
def device_info(index=None):
    
    if index is None:
        return (device_info(i) for i in range(_pa.Pa_GetDeviceCount()))
    else:
        info = _pa.Pa_GetDeviceInfo(index)
        if not info:
            raise RuntimeError("Invalid device")
        assert info.structVersion == 2

        if 'DirectSound' in hostapi_info(info.hostApi)['name']:
            enc = 'mbcs'
        else:
            enc = 'utf-8'

        return {'name': ffi.string(info.name).decode(encoding=enc,
                                                     errors='ignore'),
                'hostapi': info.hostApi,
                'max_input_channels': info.maxInputChannels,
                'max_output_channels': info.maxOutputChannels,
                'default_low_input_latency': info.defaultLowInputLatency,
                'default_low_output_latency': info.defaultLowOutputLatency,
                'default_high_input_latency': info.defaultHighInputLatency,
                'default_high_output_latency': info.defaultHighOutputLatency,
                'default_samplerate': info.defaultSampleRate}
183718
def call_rename(*args, **kwargs):
    '''
    
    '''
    dev_id = _get_devices(kwargs)
    if len(dev_id) > 1:
        raise CommandExecutionError("Only one device can be renamed at a time")

    if 'title' not in kwargs:
        raise CommandExecutionError("Title is missing")

    return _set(dev_id[0], {"name": kwargs['title']}, method="")
569345
private String getDeviceName(String eventName) {
        int pos = eventName.lastIndexOf('.');
        return eventName.substring(0, pos);
    }
665835
protected function _createDevice()
    {
        $browserType = $this->getBrowserType();
        $classname   = $this->_getUserAgentDevice($browserType);
        $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig());
    }
670172
def _get_name(self):
        
        if self._name is None:
            self._name = self._generate_name()
        return self._name
268155
public synchronized void setDeviceName(String name) {
        if (name.getBytes().length > DEVICE_NAME_LENGTH) {
            throw new IllegalArgumentException("name cannot be more than " + DEVICE_NAME_LENGTH + " bytes long");
        }
        Arrays.fill(announcementBytes, DEVICE_NAME_OFFSET, DEVICE_NAME_LENGTH, (byte)0);
        System.arraycopy(name.getBytes(), 0, announcementBytes, DEVICE_NAME_OFFSET, name.getBytes().length);
    }
1039686
def start_device(name, frontend, backend):
    
    device = getattr(devices, name)
    device(frontend, backend)