In-place method that updates fingerprint with new data

        Parameters
        ----------
        egg : quail.Egg
            Data to update fingerprint
        Returns
        ----------
        None
332917
def update(self, egg, permute=False, nperms=1000,
                 parallel=False):
        

        # increment n
        self.n+=1

        next_weights = np.nanmean(_analyze_chunk(egg,
                          analysis=fingerprint_helper,
                          analysis_type='fingerprint',
                          pass_features=True,
                          permute=permute,
                          n_perms=nperms,
                          parallel=parallel).values, 0)

        if self.state is not None:

            # multiply states by n
            c = self.state*self.n

            # update state
            self.state = np.nansum(np.array([c, next_weights]), axis=0)/(self.n+1)

        else:

            self.state = next_weights

        # update the history
        self.history.append(next_weights)
553584
def _update_data(self, datapoint, key, new_data):
        
        if new_data:
            try:
                self.data[datapoint].update({key: new_data})
            except KeyError:
                self.data[datapoint] = {key: new_data}
860036
def update(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.update, user, identity)
1014737
def create_update(self, trainer, xp, time_updated=None):
		
		
		if isinstance(trainer, Trainer):
			trainer = trainer.id
		url = api_url+'trainers/'+str(trainer)+'/updates/'
		payload = {'trainer' : int(trainer), 'xp' : int(xp)}
		
		if time_updated is None:
			payload['update_time'] = maya.now().iso8601()
		else:
			payload['update_time'] = time_updated.iso8601()
		if self.identifier:
			payload['meta_source'] = self.identifier
		
		r = requests.post(url, data=json.dumps(payload), headers=self.headers)
		print(request_status(r))
		r.raise_for_status()
		return Update(r.json())
800118
def update(self, interfaces=None):
        

        data = {'interfaces': interfaces}

        return super(ApiInterfaceRequest, self).put('api/v3/interface/', data)
1020437
def do_update(self, line):
        
        curr_pid, pid_new, input_file = self._split_args(line, 3, 0)
        self._command_processor.science_object_update(curr_pid, input_file, pid_new)
        self._print_info_if_verbose(
            'Added update operation for identifier "{}" to write queue'.format(curr_pid)
        )
999729
def _process_state_embryo(self, job_record):
        
        uow, is_duplicate = self.insert_and_publish_uow(job_record, 0, 0)
        try:
            target_state = self._compute_next_job_state(job_record)
            self.update_job(job_record, uow, target_state)
        except ValueError:
            # do no processing for the future timeperiods
            pass
282107
def add(self, pubkey):
        
        f = get_fingerprint_from_public_key(pubkey)
        if f not in self._keys:
            self._order[len(self._keys)] = f
            self._keys[f] = pubkey
1021283
def install(self, new_egg, new_egg_gpg_sig):
        

        # make sure a valid egg was provided
        if not new_egg:
            the_message = 'Must provide a valid Core installation path.'
            logger.debug(the_message)
            return {'success': False, 'message': the_message}

        # if running in gpg mode, check for valid sig
        if self.config.gpg and new_egg_gpg_sig is None:
            the_message = "Must provide a valid Core GPG installation path."
            logger.debug(the_message)
            return {'success': False, 'message': the_message}

        # debug
        logger.debug("Installing the new Core %s", new_egg)
        if self.config.gpg:
            logger.debug("Installing the new Core GPG Sig %s", new_egg_gpg_sig)

        # Make sure /var/lib/insights exists
        try:
            if not os.path.isdir(constants.insights_core_lib_dir):
                logger.debug("Creating directory %s for the Core." %
                             (constants.insights_core_lib_dir))
                os.mkdir(constants.insights_core_lib_dir)
        except OSError:
            logger.info("There was an error creating %s for core installation." % (
                constants.insights_core_lib_dir))
            raise

        # Copy the NEW (/tmp/insights-core.egg) egg to /var/lib/insights/newest.egg
        # Additionally, copy NEW (/tmp/insights-core.egg.asc) to /var/lib/insights/newest.egg.asc
        try:
            logger.debug("Copying %s to %s." % (new_egg, constants.insights_core_newest))
            shutil.copyfile(new_egg, constants.insights_core_newest)
            shutil.copyfile(new_egg_gpg_sig, constants.insights_core_gpg_sig_newest)
        except IOError:
            logger.info("There was an error copying the new core from %s to %s." % (
                new_egg, constants.insights_core_newest))
            raise

        logger.debug("The new Insights Core was installed successfully.")
        return {'success': True}
376054
def update(self, use_template=False, **metadata_defaults):
        

        self.validate()

        tree_to_update = self._xml_tree if not use_template else self._get_template(**metadata_defaults)
        supported_props = self._metadata_props

        # Iterate over keys, and extract non-primitive root for all XPATHs
        #    xroot = identificationInfo/MD_DataIdentification/abstract/
        #    xpath = identificationInfo/MD_DataIdentification/abstract/CharacterString
        #
        # This prevents multiple primitive tags from being inserted under an element

        for prop, xpath in iteritems(self._data_map):
            if not prop.startswith('_') or prop.strip('_') in supported_props:
                # Send only public or alternate properties
                xroot = self._trim_xpath(xpath, prop)
                values = getattr(self, prop, u'')
                update_property(tree_to_update, xroot, xpath, prop, values, supported_props)

        return tree_to_update
103806
def update(self):
        
        # Init new stats
        stats = self.get_init_value()

        # Exist if we can not grab the stats
        if import_error_tag:
            return stats

        if self.input_method == 'local':
            # Update stats using the standard system lib

            # Grab network interface stat using the psutil net_io_counter method
            try:
                netiocounters = psutil.net_io_counters(pernic=True)
            except UnicodeDecodeError:
                return stats

            for net in netiocounters:
                # Do not take hidden interface into account
                if self.is_hide(net):
                    continue

                # Grab the stats using the Wifi Python lib
                try:
                    wifi_cells = Cell.all(net)
                except InterfaceError as e:
                    # Not a Wifi interface
                    logger.debug("WIFI plugin: Scan InterfaceError ({})".format(e))
                    pass
                except Exception as e:
                    # Other error
                    logger.debug("WIFI plugin: Can not grab cellule stats ({})".format(e))
                    pass
                else:
                    for wifi_cell in wifi_cells:
                        hotspot = {
                            'key': self.get_key(),
                            'ssid': wifi_cell.ssid,
                            'signal': wifi_cell.signal,
                            'quality': wifi_cell.quality,
                            'encrypted': wifi_cell.encrypted,
                            'encryption_type': wifi_cell.encryption_type if wifi_cell.encrypted else None
                        }
                        # Add the hotspot to the list
                        stats.append(hotspot)

        elif self.input_method == 'snmp':
            # Update stats using SNMP

            # Not implemented yet
            pass

        # Update the stats
        self.stats = stats

        return self.stats
970257
boolean updateMoreAggInfo(Table aggTable, AppAggregationKey appAggKey,
      JobDetails jobDetails) throws IOException {

    int attempts = 0;
    boolean status = false;
    // update number of runs
    while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) {
      status = updateNumberRuns(appAggKey, aggTable, jobDetails);
      attempts++;
    }

    // update queue
    attempts = 0;
    status = false;
    while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) {
      status = updateQueue(appAggKey, aggTable, jobDetails);
      attempts++;
    }

    // update cost
    attempts = 0;
    status = false;
    while ((!status) && (attempts < AggregationConstants.RETRY_COUNT)) {
      status = updateCost(appAggKey, aggTable, jobDetails);
      attempts++;
    }

    // create a put for username, appid
    byte[] rowKey = aggConv.toBytes(appAggKey);
    Put p = new Put(rowKey);
    p.addColumn(Constants.INFO_FAM_BYTES, AggregationConstants.USER_BYTES,
        Bytes.toBytes(appAggKey.getUserName()));
    p.addColumn(Constants.INFO_FAM_BYTES, AggregationConstants.APP_ID_COL_BYTES,
        Bytes.toBytes(appAggKey.getAppId()));
    aggTable.put(p);
    return true;
  }
1269484
def update_or_create(self, attributes, values=None, joining=None, touch=True):
        
        if values is None:
            values = {}

        instance = self._query.where(attributes).first()

        if instance is None:
            return self.create(values, joining, touch)

        instance.fill(**values)

        instance.save({"touch": False})

        return instance
74873
function updateApplication(uuid, opts, callback) {
    assert.string(uuid, 'uuid');
    assert.object(opts, 'opts');

    return (this.put(sprintf('/applications/%s', uuid), opts, callback));
}
721821
def update(cls, id, name, size, quantity, password, sshkey, upgrade,
               console, snapshot_profile, reset_mysql_password, background):
        """"""
        if not background and not cls.intty():
            background = True

        paas_params = {}

        if name:
            paas_params['name'] = name

        if size:
            paas_params['size'] = size

        if quantity:
            paas_params['quantity'] = quantity

        if password:
            paas_params['password'] = password

        paas_params.update(cls.convert_sshkey(sshkey))

        if upgrade:
            paas_params['upgrade'] = upgrade

        if console:
            paas_params['console'] = console

        # XXX to delete a snapshot_profile the value has to be an empty string
        if snapshot_profile is not None:
            paas_params['snapshot_profile'] = snapshot_profile

        if reset_mysql_password:
            paas_params['reset_mysql_password'] = reset_mysql_password

        result = cls.call('paas.update', cls.usable_id(id), paas_params)
        if background:
            return result

        # interactive mode, run a progress bar
        cls.echo('Updating your PaaS instance.')
        cls.display_progress(result)
1130834
def Run(self, args):
    """"""
    with vfs.VFSOpen(
        args.pathspec, progress_callback=self.Progress) as file_obj:
      fingerprinter = Fingerprinter(self.Progress, file_obj)
      response = rdf_client_action.FingerprintResponse()
      response.pathspec = file_obj.pathspec
      if args.tuples:
        tuples = args.tuples
      else:
        # There are none selected -- we will cover everything
        tuples = list()
        for k in self._fingerprint_types:
          tuples.append(rdf_client_action.FingerprintTuple(fp_type=k))

      for finger in tuples:
        hashers = [self._hash_types[h] for h in finger.hashers] or None
        if finger.fp_type in self._fingerprint_types:
          invoke = self._fingerprint_types[finger.fp_type]
          res = invoke(fingerprinter, hashers)
          if res:
            response.matching_types.append(finger.fp_type)
        else:
          raise RuntimeError(
              "Encountered unknown fingerprint type. %s" % finger.fp_type)

      # Structure of the results is a list of dicts, each containing the
      # name of the hashing method, hashes for enabled hash algorithms,
      # and auxilliary data where present (e.g. signature blobs).
      # Also see Fingerprint:HashIt()
      response.results = fingerprinter.HashIt()

      # We now return data in a more structured form.
      for result in response.results:
        if result.GetItem("name") == "generic":
          for hash_type in ["md5", "sha1", "sha256"]:
            value = result.GetItem(hash_type)
            if value is not None:
              setattr(response.hash, hash_type, value)

        if result["name"] == "pecoff":
          for hash_type in ["md5", "sha1", "sha256"]:
            value = result.GetItem(hash_type)
            if value:
              setattr(response.hash, "pecoff_" + hash_type, value)

          signed_data = result.GetItem("SignedData", [])
          for data in signed_data:
            response.hash.signed_data.Append(
                revision=data[0], cert_type=data[1], certificate=data[2])

      self.SendReply(response)
599907
def perform_update(self, data, instance):
        

        for key, val in data.items():
            setattr(instance, key, val)