Push params to OnShape and synchronize the local copy
343259
def update(self, params=None, client=c):
        
        uri = self.parent.uri
        if not params or not self.res:
            self.get_params()
            return
        d = self.payload
        for k, v in params.items():
            m = d["currentConfiguration"][self.parameter_map[k]]["message"]
            if isinstance(v, bool) or isinstance(v, str):
                m["value"] = v
            else:
                try:
                    m["expression"] = str(v)
                except KeyError:
                    m["value"] = str(v)

        res = client.update_configuration(uri.did, uri.wvm, uri.eid, json.dumps(d))

        # If it was a good request, update config to be consistent with online.
        if res.status_code == 200:
            self.res = res
1172823
def copy(self):
        """"""
        other = ConcurrentMeanStdFilter(self.shape)
        other.sync(self)
        return other
184551
def copy(self):
        
        s = self.to_json()
        cpy = parameter_from_json(s)
        # TODO: may need to subclass for Parameters that require bundle by using this line instead:
        # cpy = parameter_from_json(s, bundle=self._bundle)
        cpy.set_uniqueid(_uniqueid())
        return cpy
1202493
def copy_with(self, mutable=False, **kwargs):
        """"""
        init_args = {'affine': self.affine, 'crs': self.crs, 'band_names': self.band_names, 'nodata': self.nodata_value}
        init_args.update(kwargs)

        # The image is a special case because we don't want to make a copy of a possibly big array
        # unless totally necessary
        if 'image' not in init_args and not self.not_loaded():
            init_args['image'] = self.image
        if mutable:
            _cls = MutableGeoRaster
        else:
            _cls = GeoRaster2

        return _cls(**init_args)
736792
def update_params(self, params):
        
        if not params.get('BINARY', True):
            raise Warning('To increase performance please use ElastiCache'
                          ' in binary mode')
        else:
            params['BINARY'] = True  # patch params, set binary mode
        if 'OPTIONS' not in params:
            # set special 'behaviors' pylibmc attributes
            params['OPTIONS'] = {
                'tcp_nodelay': True,
                'ketama': True
            }
229818
def push(**kwargs):
  '''  '''

  output, err = cli_syncthing_adapter.refresh(**kwargs)

  if output:
    click.echo("%s" % output, err=err)

  if kwargs['verbose'] and not err:
    with click.progressbar(
      iterable=None,
      length=100,
      label='Synchronizing') as bar:

      device_num = 0
      max_devices = 1
      prev_percent = 0

      while True:
        kwargs['progress'] = True
        kwargs['device_num'] = device_num
        data, err = cli_syncthing_adapter.refresh(**kwargs)

        device_num = data['device_num']
        max_devices = data['max_devices']

        cur_percent = math.floor(data['percent']) - prev_percent
        if cur_percent > 0:
          bar.update(cur_percent)
          prev_percent = math.floor(data['percent'])

        if device_num < max_devices:
          time.sleep(0.5)
        else:
          break
157950
@Override
    protected  void pushToSystem(HashMap<String, Object> cacheData, int supportedActions) {
        MouseInput.getInstance().notifyDragStart();
        ((MonocleApplication) Application.GetApplication()).enterDnDEventLoop();
        actionPerformed(Clipboard.ACTION_COPY_OR_MOVE);
    }
1186645
function cssTemplate (params) {
  // Localize parameters
  var items = params.items;
  var options = params.options;
  var tmplParams = {
    sprite: null,
    retina: null,
    items: [],
    options: options
  };

  var classFn = function (name, sep) {
    if (options.cssClass) {
      return '.' + cssesc(options.cssClass + sep + name, {isIdentifier: true});
    }
    else {
      return '.icon' + cssesc(sep + name, {isIdentifier: true});
    }
  };

  // Add class to each of the options
  items.forEach(function saveClass (item) {
    if (item.type === 'sprite') {
      item['class'] = classFn('', '');
      tmplParams.sprite = item;
    }
    else if (item.type === 'retina') {
      item['class'] = classFn('', '');
      tmplParams.retina = item;
    }
    else {
      item['class'] = classFn(item.name, '-');
      tmplParams.items.push(item);
    }
  });
  // Render and return CSS
  var tmplFile = options.template ?
    fs.readFileSync(path.resolve(process.cwd(), options.template), 'utf8') :
    tmpl[options.processor];
  var css = mustache.render(tmplFile, tmplParams);
  return css;
}
100101
def _push_render(self):
        
        bokeh.io.push_notebook(handle=self.handle)
        self.last_update = time.time()
1272558
function(callback) {
        grunt.log.write(wrap('===== saving hashes... '));
        ftpout.put(new Buffer(JSON.stringify(localHashes)), 'push-hashes', function(err) {
          if (err) { done(err); }
          grunt.log.writeln(wrapRight('[SUCCESS]').green);
          callback();
        });
      }
334162
function syncItem ( pinboard, item ) {
	return pify(pinboard.add.bind(pinboard))(item)
		.then(( res ) => {
			if ( typeof res === 'undefined' ) {
				return Promise.reject('Unknown error occured while syncing with Pinboard.');
			}
			if ( res.result_code !== 'done' ) {
				return Promise.reject(`Error while syncing with Pinboard: ${res.result_code}`);
			}
			return {
				url: item.url,
				pinboardResponse: res
			};
		});
}
39005
@Override
    public void applyUpdate(StepFunction function, INDArray params, INDArray grad, boolean isFinalStep) {

        try {
            updatesLock.readLock().lock();

            firstOne.compareAndSet(-1L, Thread.currentThread().getId());

            if (hasSomething.get())
                function.step(params, updates);

            barrier.await();
            if (firstOne.get() == Thread.currentThread().getId()) {
                // one thread just nullifies this array
                updates.assign(0.0);
                hasSomething.set(false);

                firstOne.set(-1L);
            }

            updatesLock.readLock().unlock();
            barrier.await();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
        } catch (BrokenBarrierException e) {
            throw new RuntimeException(e);
        }
    }
543220
def _update_params(param_arrays, grad_arrays, updater, num_device,
                   kvstore=None, param_names=None):
    """"""
    updates = [[] for _ in range(num_device)]
    for i, pair in enumerate(zip(param_arrays, grad_arrays)):
        arg_list, grad_list = pair
        if grad_list[0] is None:
            continue
        index = i
        if kvstore:
            name = param_names[index]
            # push gradient, priority is negative index
            kvstore.push(name, grad_list, priority=-index)
            # pull back the sum gradients, to the same locations.
            kvstore.pull(name, grad_list, priority=-index)
        for k, p in enumerate(zip(arg_list, grad_list)):
            # faked an index here, to make optimizer create diff
            # state for the same index but on diff devs, TODO(mli)
            # use a better solution later
            w, g = p
            updates[k].append((index*num_device+k, g, w))
    for dev_updates in updates:
        # update params if param_arrays and grad_arrays are not empty
        if dev_updates:
            i, w, g = zip(*dev_updates)
            updater(i, w, g)
1336215
private void copyPartsInParallel(CopyPartRequestFactory requestFactory) {
        while (requestFactory.hasMoreRequests()) {
            if (threadPool.isShutdown())
                throw new CancellationException(
                        "TransferManager has been shutdown");
            CopyPartRequest request = requestFactory.getNextCopyPartRequest();
            futures.add(threadPool.submit(new CopyPartCallable(s3, request)));
        }
    }
580432
def __push_params(self, tid, params):
        
        stack = self.__paramStack.get( tid, [] )
        stack.append(params)
        self.__paramStack[tid] = stack
65423
def connect_params_async(self):
        
        kwargs = self.connect_params.copy()
        kwargs.update({
            'minsize': self.min_connections,
            'maxsize': self.max_connections,
            'enable_json': self._enable_json,
            'enable_hstore': self._enable_hstore,
        })
        return kwargs
178722
function LocalStorage (params) {
  events.EventEmitter.call(this);

  if (!params || typeof params === 'string') {
    params = {
      ns: params || ''
    };
  }

  this.ns = params.ns || '';

  if (typeof this.ns !== 'string') {
    throw new Error('Namespace must be a string.');
  }

  this.preSave = params.preSave || defProcessor;
  this.postLoad = params.postLoad || defProcessor;

  if (this.preSave && typeof this.preSave !== 'function') {
    throw new Error('preSave option must be a function');
  }

  if (this.postLoad && typeof this.postLoad !== 'function') {
    throw new Error('postLoad option must be a function');
  }

  this.EVENTS = EVENTS;
}