Device constructor.
559931
def init_device(self):
        """"""
        start_time = time.time()
        Device.init_device(self)
        self._pb_id = ''
        LOG.debug('init PB device %s, time taken %.6f s (total: %.2f s)',
                  self.get_name(), (time.time() - start_time),
                  (time.time() - self._start_time))
        self.set_state(DevState.STANDBY)
199404
protected function _construct() {
		parent::_construct();
		$this
			->_prop(self::$P__ITEM_CLASS, DF_V_STRING_NE)
			->_prop(self::$P__ITEMS_A, DF_V_ARRAY)
		;
	}
103099
public function _construct()
    {
        $this->_init(
            \Dotdigitalgroup\Email\Model\Contact::class,
            \Dotdigitalgroup\Email\Model\ResourceModel\Contact::class
        );
    }
1207795
def create_device(device_args):
    
    device = AlarmDecoder(USBDevice.find(device_args))
    device.on_message += handle_message
    device.open()

    return device
958282
async def create(cls, block_device: BlockDevice, size: int):
        
        params = {}
        if isinstance(block_device, BlockDevice):
            params['system_id'] = block_device.node.system_id
            params['device_id'] = block_device.id
        else:
            raise TypeError(
                'block_device must be a BlockDevice, not %s' % (
                    type(block_device).__name__))

        if not size:
            raise ValueError("size must be provided and greater than zero.")
        params['size'] = size
        return cls._object(await cls._handler.create(**params))
37417
public function build()
    {
        $hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
        if (is_array($hwpaths) && (count($hwpaths) > 0)) {
            $hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT));
        }
        if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
            for ($h = 0; $h < $totalh; $h++) {
                $this->_temperature($hwpaths[$h]);
                $this->_voltage($hwpaths[$h]);
                $this->_fans($hwpaths[$h]);
                $this->_power($hwpaths[$h]);
                $this->_current($hwpaths[$h]);
            }
        }
    }
1119631
def up(self):
        '''  '''

        # Get existing device flags
        ifreq = struct.pack('16sh', self.name, 0)
        flags = struct.unpack('16sh', fcntl.ioctl(sockfd, SIOCGIFFLAGS, ifreq))[1]

        # Set new flags
        flags = flags | IFF_UP
        ifreq = struct.pack('16sh', self.name, flags)
        fcntl.ioctl(sockfd, SIOCSIFFLAGS, ifreq)
6184
def build(capabilities, device_handler):
        ""
        if device_handler:
            # This is used as kwargs dictionary for lxml's Element() function.
            # Therefore the arg-name ("nsmap") is used as key here.
            xml_namespace_kwargs = { "nsmap" : device_handler.get_xml_base_namespace_dict() }
        else:
            xml_namespace_kwargs = {}
        hello = new_ele("hello", **xml_namespace_kwargs)
        caps = sub_ele(hello, "capabilities")
        def fun(uri): sub_ele(caps, "capability").text = uri
        #python3 changes
        if sys.version < '3':
            map(fun, capabilities)
        else:
            list(map(fun, capabilities))
        return to_xml(hello)
577313
private function init()
    {
        $genericDevice = $this->getDevice(WURFL_Constants::GENERIC);
        if (!is_null($genericDevice)) {
            $this->_capabilitiesName = array_keys($genericDevice->getCapabilities());
            $this->_groupIDCapabilitiesMap = $genericDevice->getGroupIdCapabilitiesNameMap();
        }
    }
848743
def setup(self):
        
        self.devices = self.system.devman.devices
        self.ndevice = len(self.devices)

        self.gcalls = [''] * self.ndevice
        self.fcalls = [''] * self.ndevice
        self.gycalls = [''] * self.ndevice
        self.fxcalls = [''] * self.ndevice
        self.jac0s = [''] * self.ndevice

        self.build_vec()
        self.build_strings()
        self._compile_newton()
        self._compile_fdpf()
        self._compile_pfload()
        self._compile_pfgen()
        self._compile_seriesflow()
        self._compile_int()
        self._compile_int_f()
        self._compile_int_g()
        self._compile_bus_injection()
52271
function construct (constructor, args) {
  function Factory () {
    return constructor.apply(this, args);
  }

  Factory.prototype = constructor.prototype;

  return new Factory();
}
1309211
def initialiseDevice(self):
        
        logger.debug("Initialising device")
        self.getInterruptStatus()
        self.setAccelerometerSensitivity(self._accelerationFactor * 32768.0)
        self.setGyroSensitivity(self._gyroFactor * 32768.0)
        self.setSampleRate(self.fs)
        for loop in self.ZeroRegister:
            self.i2c_io.write(self.MPU6050_ADDRESS, loop, 0)
        # Sets clock source to gyro reference w/ PLL
        self.i2c_io.write(self.MPU6050_ADDRESS, self.MPU6050_RA_PWR_MGMT_1, 0b00000010)
        # Controls frequency of wakeups in accel low power mode plus the sensor standby modes
        self.i2c_io.write(self.MPU6050_ADDRESS, self.MPU6050_RA_PWR_MGMT_2, 0x00)
        # Enables any I2C master interrupt source to generate an interrupt
        self.i2c_io.write(self.MPU6050_ADDRESS, self.MPU6050_RA_INT_ENABLE, 0x01)
        # enable the FIFO
        self.enableFifo()
        logger.debug("Initialised device")
431822
function DeviceLoader() {
  var self = this;

  // call super class
  EventEmitter2.call(this, {
    wildcard: true,
    delimiter: ':',
    maxListeners: 1000 // default would be 10!
  });

  if (this.log) {
    this.log = _.wrap(this.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
  } else if (DeviceLoader.prototype.log) {
    DeviceLoader.prototype.log = _.wrap(DeviceLoader.prototype.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
    this.log = DeviceLoader.prototype.log;
  } else {
    var debug = require('debug')(this.constructor.name);
    this.log = function(msg) {
      debug(msg);
    };
  }

  this.lookupIntervalId = null;
  this.oldDevices = [];

  this.isRunning = false;
}
193837
@Override
    public void initialize() {
        deviceDirectory = getDeviceDirectory();

        /*
         First try to register ports specified in the properties
         file.  If that doesn't exist, then scan for ports.
         */
        for (int PortType = CommPortIdentifier.PORT_SERIAL; PortType <= CommPortIdentifier.PORT_PARALLEL; PortType++) {
            if (!registerSpecifiedPorts(PortType)) {
                if (!registerKnownPorts(PortType)) {
                    registerScannedPorts(PortType);
                }
            }
        }
    }
100223
function constructor(o) {
    var f = main.bind(o);
    o.current = o.states.initial || o.initial();
    o.machine = f;
    return f;
}
832968
public function build()
    {
        if (PSI_OS == 'Linux') {
            $hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT);
            if (is_array($hwpaths) && (count($hwpaths) > 0)) {
                $hwpaths = array_merge($hwpaths, glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT));
            }
            if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
                for ($h = 0; $h < $totalh; $h++) {
                    $this->_temperature($hwpaths[$h]);
                }
            }
        } else {
            $smp = 1;
            CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp);
            for ($i = 0; $i < $smp; $i++) {
                $temp = 0;
                if (CommonFunctions::executeProgram('sysctl', '-n dev.cpu.'.$i.'.temperature', $temp)) {
                    $temp = preg_replace('/C/', '', $temp);
                    $dev = new SensorDevice();
                    $dev->setName("CPU ".($i + 1));
                    $dev->setValue($temp);
//                    $dev->setMax(70);
                    $this->mbinfo->setMbTemp($dev);
                }
            }
        }
    }
1351846
def create_instance(self, port):
        """"""
        instance_type = self.get_instance_type(port)
        if not instance_type:
            return
        i_res = MechResource(port['device_id'], instance_type, a_const.CREATE)
        self.provision_queue.put(i_res)