Move a rollout to a selected device
174386
def to_device(self, device, non_blocking=True):
        
        return Trajectories(
            num_steps=self.num_steps,
            num_envs=self.num_envs,
            environment_information=self.environment_information,
            transition_tensors={k: v.to(device, non_blocking=non_blocking) for k, v in self.transition_tensors.items()},
            rollout_tensors={k: v.to(device, non_blocking=non_blocking) for k, v in self.rollout_tensors.items()},
            extra_data=self.extra_data
        )
1087690
def _move_data_entries(destination_eggdir, dist_data):
        """"""
        dist_data = os.path.join(destination_eggdir, dist_data)
        dist_data_scripts = os.path.join(dist_data, 'scripts')
        if os.path.exists(dist_data_scripts):
            egg_info_scripts = os.path.join(
                destination_eggdir, 'EGG-INFO', 'scripts')
            os.mkdir(egg_info_scripts)
            for entry in os.listdir(dist_data_scripts):
                # Remove bytecode, as it's not properly handled
                # during easy_install scripts install phase.
                if entry.endswith('.pyc'):
                    os.unlink(os.path.join(dist_data_scripts, entry))
                else:
                    os.rename(
                        os.path.join(dist_data_scripts, entry),
                        os.path.join(egg_info_scripts, entry),
                    )
            os.rmdir(dist_data_scripts)
        for subdir in filter(os.path.exists, (
            os.path.join(dist_data, d)
            for d in ('data', 'headers', 'purelib', 'platlib')
        )):
            unpack(subdir, destination_eggdir)
        if os.path.exists(dist_data):
            os.rmdir(dist_data)
180370
function deployToSim(appPath, target) {
    // Select target device for emulator. Default is 'iPhone-6' 
    if (!target) {
        return require('./list-emulator-images').run()
        .then(function (emulators) {
            if (emulators.length > 0) {
                target = emulators[0];
            }
            emulators.forEach(function (emulator) {
                if (emulator.indexOf('iPhone') === 0) {
                    target = emulator;
                }
            });
            events.emit('log','No target specified for emulator. Deploying to ' + target + ' simulator');
            return startSim(appPath, target);
        });
    } else {
        return startSim(appPath, target);
    }
}
181684
def add_device(dev):
    """"""
    global DEV_IDX, DEFAULT_DEV
    with DEV_LOCK:
        for idx in range(len(DEVS)):
            test_dev = DEVS[idx]
            if test_dev.dev_name_short == dev.dev_name_short:
                # This device is already in our list. Delete the old one
                if test_dev is DEFAULT_DEV:
                    DEFAULT_DEV = None
                del DEVS[idx]
                break
        if find_device_by_name(dev.name):
            # This name is taken - make it unique
            dev.name += '-%d' % DEV_IDX
        dev.name_path = '/' + dev.name + '/'
        DEVS.append(dev)
        DEV_IDX += 1
        if DEFAULT_DEV is None:
            DEFAULT_DEV = dev
886601
def put(self, deviceId):
        
        device = request.get_json()
        logger.debug("Received /devices/" + deviceId + " - " + str(device))
        self._deviceController.accept(deviceId, device)
        return None, 200
995551
def _on_device_update(self, devid):
        """"""
        if isinstance(devid, (tuple, list)):
            devid = devid[0]

        if devid is None:
            _LOGGER.warning("Device update with no device id.")
            return

        _LOGGER.debug("Device update event for device ID: %s", devid)

        device = self._abode.get_device(devid, True)

        if not device:
            _LOGGER.debug("Got device update for unknown device: %s", devid)
            return

        for callback in self._device_callbacks.get(device.device_id, ()):
            _execute_callback(callback, device)
245464
def device_selected(self, index):
        """"""
        device = self.devicelist_model.itemFromIndex(index)
        print(device.device.addr)
        self.btnConnect.setEnabled(True)
387393
def move(self, fnames=None, directory=None):
        """"""
        if fnames is None:
            fnames = self.get_selected_filenames()
        orig = fixpath(osp.dirname(fnames[0]))
        while True:
            self.redirect_stdio.emit(False)
            if directory is None:
                folder = getexistingdirectory(self, _("Select directory"),
                                              orig)
            else:
                folder = directory
            self.redirect_stdio.emit(True)
            if folder:
                folder = fixpath(folder)
                if folder != orig:
                    break
            else:
                return
        for fname in fnames:
            basename = osp.basename(fname)
            try:
                misc.move_file(fname, osp.join(folder, basename))
            except EnvironmentError as error:
                QMessageBox.critical(self, _("Error"),
                                     _("<b>Unable to move <i>%s</i></b>"
                                       "<br><br>Error message:<br>%s"
                                       ) % (basename, to_text_string(error)))
106668
def rollout(self, **kwargs):
        
        if kwargs.has_key('tau'):
            timesteps = int(self.timesteps / kwargs['tau'])
        else: 
            timesteps = self.timesteps
        self.x_track = np.zeros(timesteps)
        
        self.reset_state()
        for t in range(timesteps):
            self.x_track[t] = self.x 
            self.step(**kwargs)

        return self.x_track
610445
def _sync_to_group(self, device):
        '''
        '''

        config_sync_cmd = 'config-sync to-group %s' % self.name
        device.tm.cm.exec_cmd('run', utilCmdArgs=config_sync_cmd)
519368
def use_device(cls, device):
        """"""
        if device == cls.ops.device:
            yield
        else:
            curr_Ops, curr_ops = (cls.Ops, cls.ops)
            cls.Ops = get_ops(device)
            cls.ops = cls.Ops()
            yield
            cls.Ops = curr_Ops
            cls.ops = curr_ops
133
def move_partition_replica(self, under_loaded_rg, eligible_partition):
        """"""
        # Evaluate possible source and destination-broker
        source_broker, dest_broker = self._get_eligible_broker_pair(
            under_loaded_rg,
            eligible_partition,
        )
        if source_broker and dest_broker:
            self.log.debug(
                'Moving partition {p_name} from broker {source_broker} to '
                'replication-group:broker {rg_dest}:{dest_broker}'.format(
                    p_name=eligible_partition.name,
                    source_broker=source_broker.id,
                    dest_broker=dest_broker.id,
                    rg_dest=under_loaded_rg.id,
                ),
            )
            # Move partition if eligible brokers found
            source_broker.move_partition(eligible_partition, dest_broker)
509383
def prepare_network(self):
        """"""
        hydpy.pub.selections = selectiontools.Selections()
        hydpy.pub.selections += hydpy.pub.networkmanager.load_files()
        self.update_devices(hydpy.pub.selections.complete)
824143
function bindToggles() {
  // Watch for changes on the checkboxes in the device dropdown
  var iphone = $('#device-iphone');
  var android = $('#device-android');
  var windows = $('#device-windows');

  var devices = [iphone, android, windows];
  for(var i in devices) {
    devices[i].addEventListener('change', function(e) {
      var device = this.name;
      console.log('Device changed', device, this.checked);

      showDevice(device, this.checked);
      saveLastDevices(device, this.checked);
    });
  }
}
887144
function Rollout(client) {
  this.client     = client || redis.createClient();
  this._id        = 'id';
  this._namespace = null;
  this._groups    = {};

  this.group('all', function(user) { return true; });
}
68659
def move_selection(reverse=False):
    
    global selected_pid
    if selected_pid not in gunicorns:
        selected_pid = None
    found = False
    pids = sorted(gunicorns.keys(), reverse=reverse)
    # Iterate items twice to enable wrapping.
    for pid in pids + pids:
        if selected_pid is None or found:
            selected_pid = pid
            return
        found = pid == selected_pid
1266140
def move_application(self, app_id, queue):
        
        self._call('moveApplication', proto.MoveRequest(id=app_id, queue=queue))