Fetch or create a real device that corresponds to a device model.
331615
static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
    // Get an existing real device.
    for (IDevice adbDevice : adb.getDevices()) {
      if (adbDevice.getSerialNumber().equals(serial)) {
        return adbDevice;
      }
    }
    throw new IllegalArgumentException("Unknown device serial: " + serial);
  }
1314307
def _find_device(self, idVendor, idProduct):
        """"""
        for bus in usb.busses():
            for device in bus.devices:
                if (device.idVendor == idVendor and
                    device.idProduct == idProduct):
                    return device
        return None
1192464
def _request_devices(self, url, _type):
        """"""
        res = self._request(url)
        return res.get(_type) if res else {}
520516
def create_api_equipment(self):
        """"""
        return ApiEquipment(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
862630
def model(self, model, create=True):
        ''''''
        manager = self.manager(model)
        sm = self._models.get(manager)
        if sm is None and create:
            sm = SessionModel(manager)
            self._models[manager] = sm
        return sm
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)
878498
def reload
      device = SimCtl.device(udid: udid)
      device.instance_variables.each do |ivar|
        instance_variable_set(ivar, device.instance_variable_get(ivar))
      end
    end
412873
def MobileDeviceProvisioningProfile(self, data=None, subset=None):
        """"""
        return self.factory.get_object(
            jssobjects.MobileDeviceProvisioningProfile, data, subset)
7806
def get(self, object_path, interfaces_and_properties=None):
        """"""
        # check this before creating the DBus object for more
        # controlled behaviour:
        if not interfaces_and_properties:
            interfaces_and_properties = self._objects.get(object_path)
            if not interfaces_and_properties:
                return None
        property_hub = PropertyHub(interfaces_and_properties)
        method_hub = MethodHub(
            self._proxy.object.bus.get_object(object_path))
        return Device(self, object_path, property_hub, method_hub)
36492
function Device() {
    this.available = false;
    this.platform = null;
    this.version = null;
    this.uuid = null;
    this.cordova = null;
    this.model = null;
    this.manufacturer = null;
    this.isVirtual = null;
    this.serial = null;

    var me = this;

    channel.onCordovaReady.subscribe(function() {
        me.getInfo(function(info) {
            //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js
            //TODO: CB-5105 native implementations should not return info.cordova
            var buildLabel = cordova.version;
            me.available = true;
            me.platform = info.platform;
            me.version = info.version;
            me.uuid = info.uuid;
            me.cordova = buildLabel;
            me.model = info.model;
            me.isVirtual = info.isVirtual;
            me.manufacturer = info.manufacturer || 'unknown';
            me.serial = info.serial || 'unknown';
            channel.onCordovaInfoReady.fire();
        },function(e) {
            me.available = false;
            utils.alert("[ERROR] Error initializing Cordova: " + e);
        });
    });
}
610686
def get(self, name):
        

        name = str(name)
        if name not in self._properties:
            raise ArgumentError("Unknown property in DeviceModel", name=name)

        return self._properties[name]
909508
def get_model(app, model):
    """"""
    if 'get_model' not in _LAZY_LOADS:
        _lazy_load_get_model()

    _get_model = _LAZY_LOADS['get_model']
    return _get_model(app, model)
180278
def match(self, device):
        """"""
        return all(match_value(getattr(device, k), v)
                   for k, v in self._match.items())
1246239
def _get_devices(params):
    '''
    
    '''
    if 'id' not in params:
        raise CommandExecutionError("Parameter ID is required.")

    return type(params['id']) == int and [params['id']] \
           or [int(dev) for dev in params['id'].split(",")]
1350963
def then_a_model_exists(context, model_name, key, value):
    
    model = apps.get_model(model_name)
    args = {
        key: value
    }
    obj = model.objects.get(**args)
    assert obj is not None
275700
def device_initialize(self):
    
    existing_device_initialize(self)
    self.type = 'Other'
    self.id = platform.node()
    self.os_version = platform.version()
    self.locale = locale.getdefaultlocale()[0]
942311
def fetch_object(self, model_id):
        """"""
        pk_field_instance = getattr(self.object_class, self.pk_field)
        qs = self.object_class.query.filter(pk_field_instance == model_id)
        model = qs.one_or_none()
        if not model:
            raise ReferenceNotFoundError
        return model